Skip to content

Commit

Permalink
net-libs/nodejs: Version 11.0.0
Browse files Browse the repository at this point in the history
Package-Manager: Portage-2.3.51, Repoman-2.3.11
Signed-off-by: Jeroen Roovers <[email protected]>
  • Loading branch information
Jeroen Roovers committed Oct 24, 2018
1 parent ab8ae66 commit 0f5d39c
Show file tree
Hide file tree
Showing 2 changed files with 205 additions and 0 deletions.
1 change: 1 addition & 0 deletions net-libs/nodejs/Manifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ DIST node-v10.10.0.tar.xz 19960760 BLAKE2B dc16e2afba4be727c5169ac5cd77324e0e8d7
DIST node-v10.11.0.tar.xz 20144576 BLAKE2B 956d940554748f420589adab0f14bd6fcc6a4781cdecd537abd6eb9aa43e9cf754ef009b20d416f1ef4c9a01ef91a27a59a8c080c1c0a49a59388f75713d6286 SHA512 00a678a829de9b836e77dd0806799029b657cf000369ca653540d7e1b82c3895da43dbbfe4d3c2b3b2b1e711bf55b3835a351fad18affdd0c25dcceea8e3406c
DIST node-v10.12.0.tar.xz 20185168 BLAKE2B 1a827ed08222900ef196921a57d64466fc558412bb27a26759553686c69d59d8e6686394a484156d254a01030077b09c9abfec87a7716aee06dbe9937a861efd SHA512 3b59bbe7b795e7a85520f6b4691806d8939d26cc2a5e5d22e6406d3d373ee7758da225bd25b6f6b71b105e3d7ef4c58220bfa5e558afd0cd873fbd7d6ba9efc4
DIST node-v10.9.0.tar.xz 19987812 BLAKE2B 4a5bd257cd527500b691b15d177bde53158b5e46e710ffeaa45224bae821cfaffdf59f24ad6bdc822cf468b90c1a4422a2f82d29e1d4b2dc0f838e3e0ab5b4ac SHA512 19c7366b4c9d1e255b5ac56e974ff86b9ca87c363534b467ecc3c59e170b891e86c479a2bcda6647c6df686b018caaedea84270e848b93a4f1c80ff04af12461
DIST node-v11.0.0.tar.xz 20142548 BLAKE2B 97fc14392c449abde0c2b4ef27f020ac215747a5cca327b07ed735dd9867a01f1a64bfa19a62758111b0fbdca92b5536c15d7946bf968b5c3eab9c0b55f7dd26 SHA512 232243f37a8344775b2e0302601ec23310a8915e0913dc0cb0133df75cb7aad315ca0a6d039f8f9e6ae0d9f98aa8049532d80d470cf9ea0e309f8183be870000
DIST node-v4.8.7.tar.xz 13370828 BLAKE2B b1ee93a586b66f8582783b1be50667547afe4bf48038ebc0b8148db55542cbc0520ac84ef88e4a7f453cabc245f484c32dbc238c1932bbc708791ceeb5c9d2ab SHA512 25837a31023747723b146c45984a5b2096b61c0aa43cbf45fc8ff50b4bd5079bd0bc9f1dfd3fb076817448dc5537eb93ffb2f345280b7756ba93b67ad757c696
DIST node-v4.9.1.tar.xz 13250164 BLAKE2B 7a689b99bb4bf507f7f21dd2c096a5766d023a8174c0f468cab37365af1920b8700da04157e1a406917790524255ef32c243a74662fd50ef7d3567d189dac9cf SHA512 690c9fdf608e5194069a10955bdd94ec87cb1c308f13bc4d2cae92fa01436ace10fadf58f2e51d477dde6c570b23edc1c71fafea79bfc9cab2903eb2fa5f87aa
DIST node-v6.11.5.tar.xz 15699404 BLAKE2B ba2df91bf5ef38cedb60b42919cf56f16807e619a81876fc92a5741e49da7ec91c4239d00f549c5e80d0bb8282bb9b396dd984507916cd18d61b403a3a7cef94 SHA512 62490725ef7957294c1bddf21ef0626c7472876791210168116501255ecee58457e9de9b044e10033706243299bbfd1495efeca169596fbf26f5eeba6d8fa4c9
Expand Down
204 changes: 204 additions & 0 deletions net-libs/nodejs/nodejs-11.0.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
# Copyright 1999-2018 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=6

PYTHON_COMPAT=( python2_7 )
PYTHON_REQ_USE="threads"

inherit bash-completion-r1 eutils flag-o-matic pax-utils python-single-r1 toolchain-funcs

DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine"
HOMEPAGE="https://nodejs.org/"
SRC_URI="https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz"

LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x64-macos"
IUSE="cpu_flags_x86_sse2 debug doc icu inspector +npm +snapshot +ssl systemtap test"
REQUIRED_USE="
${PYTHON_REQUIRED_USE}
inspector? ( icu ssl )
npm? ( ssl )
"

RDEPEND="
>=dev-libs/libuv-1.23.1:=
>=net-libs/http-parser-2.8.0:=
>=net-libs/nghttp2-1.34.0
sys-libs/zlib
icu? ( >=dev-libs/icu-62.1:= )
ssl? ( =dev-libs/openssl-1.1.0*:0=[-bindist] )
"
DEPEND="
${RDEPEND}
${PYTHON_DEPS}
systemtap? ( dev-util/systemtap )
test? ( net-misc/curl )
"
S="${WORKDIR}/node-v${PV}"
PATCHES=(
"${FILESDIR}"/${PN}-10.3.0-global-npm-config.patch
)

pkg_pretend() {
(use x86 && ! use cpu_flags_x86_sse2) && \
die "Your CPU doesn't support the required SSE2 instruction."

( [[ ${MERGE_TYPE} != "binary" ]] && ! test-flag-CXX -std=c++11 ) && \
die "Your compiler doesn't support C++11. Use GCC 4.8, Clang 3.3 or newer."
}

src_prepare() {
tc-export CC CXX PKG_CONFIG
export V=1
export BUILDTYPE=Release

# fix compilation on Darwin
# https://code.google.com/p/gyp/issues/detail?id=260
sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die

# make sure we use python2.* while using gyp
sed -i -e "s/python/${EPYTHON}/" deps/npm/node_modules/node-gyp/gyp/gyp || die
sed -i -e "s/|| 'python2'/|| '${EPYTHON}'/" deps/npm/node_modules/node-gyp/lib/configure.js || die

# less verbose install output (stating the same as portage, basically)
sed -i -e "/print/d" tools/install.py || die

# proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
local LIBDIR=$(get_libdir)
sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
sed -i -e "s/'lib'/'${LIBDIR}'/" deps/npm/lib/npm.js || die

# Avoid writing a depfile, not useful
sed -i -e "/DEPFLAGS =/d" tools/gyp/pylib/gyp/generator/make.py || die

sed -i -e "/'-O3'/d" common.gypi deps/v8/gypfiles/toolchain.gypi || die

# Avoid a test that I've only been able to reproduce from emerge. It doesnt
# seem sandbox related either (invoking it from a sandbox works fine).
# The issue is that no stdin handle is openened when asked for one.
# It doesn't really belong upstream , so it'll just be removed until someone
# with more gentoo-knowledge than me (jbergstroem) figures it out.
rm test/parallel/test-stdout-close-unref.js || die

# debug builds. change install path, remove optimisations and override buildtype
if use debug; then
sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
BUILDTYPE=Debug
fi

default
}

src_configure() {
local myconf=( --shared-http-parser --shared-libuv --shared-nghttp2 --shared-zlib )
use debug && myconf+=( --debug )
use icu && myconf+=( --with-intl=system-icu ) || myconf+=( --with-intl=none )
use inspector || myconf+=( --without-inspector )
use npm || myconf+=( --without-npm )
use snapshot && myconf+=( --with-snapshot )
use ssl && myconf+=( --shared-openssl ) || myconf+=( --without-ssl )

local myarch=""
case ${ABI} in
amd64) myarch="x64";;
arm) myarch="arm";;
arm64) myarch="arm64";;
ppc64) myarch="ppc64";;
x32) myarch="x32";;
x86) myarch="ia32";;
*) myarch="${ABI}";;
esac

GYP_DEFINES="linux_use_gold_flags=0
linux_use_bundled_binutils=0
linux_use_bundled_gold=0" \
"${PYTHON}" configure \
--prefix="${EPREFIX}"/usr \
--dest-cpu=${myarch} \
$(use_with systemtap dtrace) \
"${myconf[@]}" || die
}

src_compile() {
emake -C out mksnapshot
pax-mark m "out/${BUILDTYPE}/mksnapshot"
emake -C out
}

src_install() {
local LIBDIR="${ED}/usr/$(get_libdir)"
emake install DESTDIR="${D}"
pax-mark -m "${ED}"usr/bin/node

# set up a symlink structure that node-gyp expects..
dodir /usr/include/node/deps/{v8,uv}
dosym . /usr/include/node/src
for var in deps/{uv,v8}/include; do
dosym ../.. /usr/include/node/${var}
done

if use doc; then
# Patch docs to make them offline readable
for i in `grep -rl 'fonts.googleapis.com' "${S}"/out/doc/api/*`; do
sed -i '/fonts.googleapis.com/ d' $i;
done
# Install docs
docinto html
dodoc -r "${S}"/doc/*
fi

if use npm; then
dodir /etc/npm

# Install bash completion for `npm`
# We need to temporarily replace default config path since
# npm otherwise tries to write outside of the sandbox
local npm_config="usr/$(get_libdir)/node_modules/npm/lib/config/core.js"
sed -i -e "s|'/etc'|'${ED}/etc'|g" "${ED}/${npm_config}" || die
local tmp_npm_completion_file="$(emktemp)"
"${ED}/usr/bin/npm" completion > "${tmp_npm_completion_file}"
newbashcomp "${tmp_npm_completion_file}" npm
sed -i -e "s|'${ED}/etc'|'/etc'|g" "${ED}/${npm_config}" || die

# Move man pages
doman "${LIBDIR}"/node_modules/npm/man/man{1,5,7}/*

# Clean up
rm "${LIBDIR}"/node_modules/npm/{.mailmap,.npmignore,Makefile} || die
rm -rf "${LIBDIR}"/node_modules/npm/{doc,html,man} || die

local find_exp="-or -name"
local find_name=()
for match in "AUTHORS*" "CHANGELOG*" "CONTRIBUT*" "README*" \
".travis.yml" ".eslint*" ".wercker.yml" ".npmignore" \
"*.md" "*.markdown" "*.bat" "*.cmd"; do
find_name+=( ${find_exp} "${match}" )
done

# Remove various development and/or inappropriate files and
# useless docs of dependend packages.
find "${LIBDIR}"/node_modules \
\( -type d -name examples \) -or \( -type f \( \
-iname "LICEN?E*" \
"${find_name[@]}" \
\) \) -exec rm -rf "{}" \;
fi

mv "${D}"/usr/share/doc/node "${D}"/usr/share/doc/${PF} || die
}

src_test() {
out/${BUILDTYPE}/cctest || die
"${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die
}

pkg_postinst() {
einfo "The global npm config lives in /etc/npm. This deviates slightly"
einfo "from upstream which otherwise would have it live in /usr/etc/."
einfo ""
einfo "Protip: When using node-gyp to install native modules, you can"
einfo "avoid having to download extras by doing the following:"
einfo "$ node-gyp --nodedir /usr/include/node <command>"
}

0 comments on commit 0f5d39c

Please sign in to comment.