From 3db67e73440f7da405fe85ed291678fac83f6490 Mon Sep 17 00:00:00 2001 From: Marek Szuba Date: Mon, 16 Nov 2020 18:36:11 +0100 Subject: net-libs/nodejs: bump to 12.19.1 and 14.15.1 Security updates due to CVE-2020-8277. Bug: https://bugs.gentoo.org/754942 Signed-off-by: Marek Szuba --- net-libs/nodejs/Manifest | 3 +- net-libs/nodejs/nodejs-12.19.0.ebuild | 215 ---------------------------------- net-libs/nodejs/nodejs-12.19.1.ebuild | 215 ++++++++++++++++++++++++++++++++++ net-libs/nodejs/nodejs-14.15.1.ebuild | 202 ++++++++++++++++++++++++++++++++ 4 files changed, 419 insertions(+), 216 deletions(-) delete mode 100644 net-libs/nodejs/nodejs-12.19.0.ebuild create mode 100644 net-libs/nodejs/nodejs-12.19.1.ebuild create mode 100644 net-libs/nodejs/nodejs-14.15.1.ebuild (limited to 'net-libs') diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest index 62f5d5fddf9b..bc8534112df8 100644 --- a/net-libs/nodejs/Manifest +++ b/net-libs/nodejs/Manifest @@ -1,4 +1,5 @@ DIST node-v12.18.4.tar.xz 23679924 BLAKE2B 14de3c83851b89f85f7d6f549d9e43e3e97c7a84de94eef8c3a2789e960595749726b8039fdff1be822377355ede2bb95bba4fd1d17c3e5165c844a80eb32e53 SHA512 07101a9acc8dee5189f8484746715b57d4227d819e38a79c100da33f803b0f061e7b37fbd4114ce2bc3eea647726f8786880d3096dfab187c177679f3e1c78e8 -DIST node-v12.19.0.tar.xz 23819884 BLAKE2B 5affa4ef9bd4c88218cf8845341f8f7d357a807af5fb8a3633f47de278b20272be1f46365b2b1525c50f0c6ea40025c16725ab5236fb09dfb2f9167b727a1f8e SHA512 ca14aac0f6f95190fd63a87cdc0195c4d38697aef98c111392d71654bb482f1a8c4c925c4fa8387c41fa8a9515ac5e54af8fa365dbc0034fedc271c072801dc7 +DIST node-v12.19.1.tar.xz 23829692 BLAKE2B 244ca8ef29e315ce027638d9d5c66469ac8cd69abec47d5bf6370b990da0d9d2a7af812963530e5187d273d3f20638be0d23ccb1c0409fbbd678677740939f4f SHA512 7c628ca214d3b17b34658aae32e335ce863d90853c92f1cd4119e9a82b7097ddf47d0d4cc7c9bbdbfdd4b403811aa6ee08e844078a947f31a3adc78f569b931a DIST node-v14.15.0.tar.xz 33440584 BLAKE2B dda9fb44f163b2268db126dfcda34e80064eba24921e4f8e6c14c212deb9170c79f31f7b2be272c8fa7ca992d14540df490c6cad078833514bd348825934ad95 SHA512 2a0cd1b9d95e0ac228a90aca82cb04b9f4fc4d08ab86f0286eed7a519ca6e756081b37375ad5d14d7f0e09affdd27bad658c3e364237eb3c212fe5b5e27af96e +DIST node-v14.15.1.tar.xz 33437304 BLAKE2B f08251d2a76e4030433001fd7f062c71193de190036d1147ade0ea36350df0d65df9e1b749fbac77837dd090cbeda6c133ff88099691c932bc29e75b7bfa2acc SHA512 cbab757e370a09b73c29a9bcb310b4122e4424d6baeaeaf1b10919ed6b348bc6ddbfc0e0eaff99d8ebb4d3d74f0206f575e2656245151eda564dd2cd33ff823a DIST node-v14.2.0.tar.xz 32884616 BLAKE2B 7bcb07cb7623c5e08c20267c320cdf23ad110f124c5ad1f2447ef8b76ab8dc44ed50dab7c5651424d9d3a36f7eeecdf3292b07c02cb2e22c3fbe4ed633c4b842 SHA512 47e5ec0b7a207082d43419a7e0a6ea9242ec43b4d7c2217eb66d0b45e2f4d5cb561b3f6fe35fdc41a8be95c182dc122ba262f696ebd12833596d71b372ec85d2 diff --git a/net-libs/nodejs/nodejs-12.19.0.ebuild b/net-libs/nodejs/nodejs-12.19.0.ebuild deleted file mode 100644 index bf5eb49acbd9..000000000000 --- a/net-libs/nodejs/nodejs-12.19.0.ebuild +++ /dev/null @@ -1,215 +0,0 @@ -# Copyright 1999-2020 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -PYTHON_COMPAT=( python3_{6..8} ) -PYTHON_REQ_USE="threads(+)" - -inherit bash-completion-r1 flag-o-matic python-any-r1 toolchain-funcs xdg-utils - -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/$(ver_cut 1)" -KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-linux ~x64-macos" -IUSE="cpu_flags_x86_sse2 debug doc icu inspector +npm +snapshot +ssl +system-ssl systemtap test" -REQUIRED_USE=" - inspector? ( icu ssl ) - npm? ( ssl ) - system-ssl? ( ssl ) -" - -RDEPEND=" - >=app-arch/brotli-1.0.9 - >=dev-libs/libuv-1.39.0:= - >=net-dns/c-ares-1.16.0 - >=net-libs/http-parser-2.9.3:= - >=net-libs/nghttp2-1.40.0 - sys-libs/zlib - icu? ( >=dev-libs/icu-64.2:= ) - system-ssl? ( >=dev-libs/openssl-1.1.1:0= ) -" -BDEPEND=" - ${PYTHON_DEPS} - sys-apps/coreutils - systemtap? ( dev-util/systemtap ) - test? ( net-misc/curl ) -" -DEPEND=" - ${RDEPEND} -" -PATCHES=( - "${FILESDIR}"/${PN}-10.3.0-global-npm-config.patch - "${FILESDIR}"/${PN}-99999999-llhttp.patch -) -RESTRICT="test" -S="${WORKDIR}/node-v${PV}" - -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 - - # 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 node.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() { - xdg_environment_reset - - local myconf=( - --shared-brotli - --shared-cares - --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+=( --without-node-snapshot ) - if use ssl; then - use system-ssl && myconf+=( --shared-openssl --openssl-use-def-ca-store ) - else - myconf+=( --without-ssl ) - fi - - 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" \ - "${EPYTHON}" configure.py \ - --prefix="${EPREFIX}"/usr \ - --dest-cpu=${myarch} \ - $(use_with systemtap dtrace) \ - "${myconf[@]}" || die -} - -src_compile() { - emake -C out mksnapshot - emake -C out -} - -src_install() { - local LIBDIR="${ED}/usr/$(get_libdir)" - default - - # 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 - 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="$(TMPDIR="${T}" mktemp -t npm.XXXXXXXXXX)" - "${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 "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die -} - -src_test() { - out/${BUILDTYPE}/cctest || die - "${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die -} - -pkg_postinst() { - elog "The global npm config lives in /etc/npm. This deviates slightly" - elog "from upstream which otherwise would have it live in /usr/etc/." - elog "" - elog "Protip: When using node-gyp to install native modules, you can" - elog "avoid having to download extras by doing the following:" - elog "$ node-gyp --nodedir /usr/include/node " -} diff --git a/net-libs/nodejs/nodejs-12.19.1.ebuild b/net-libs/nodejs/nodejs-12.19.1.ebuild new file mode 100644 index 000000000000..bf5eb49acbd9 --- /dev/null +++ b/net-libs/nodejs/nodejs-12.19.1.ebuild @@ -0,0 +1,215 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{6..8} ) +PYTHON_REQ_USE="threads(+)" + +inherit bash-completion-r1 flag-o-matic python-any-r1 toolchain-funcs xdg-utils + +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/$(ver_cut 1)" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-linux ~x64-macos" +IUSE="cpu_flags_x86_sse2 debug doc icu inspector +npm +snapshot +ssl +system-ssl systemtap test" +REQUIRED_USE=" + inspector? ( icu ssl ) + npm? ( ssl ) + system-ssl? ( ssl ) +" + +RDEPEND=" + >=app-arch/brotli-1.0.9 + >=dev-libs/libuv-1.39.0:= + >=net-dns/c-ares-1.16.0 + >=net-libs/http-parser-2.9.3:= + >=net-libs/nghttp2-1.40.0 + sys-libs/zlib + icu? ( >=dev-libs/icu-64.2:= ) + system-ssl? ( >=dev-libs/openssl-1.1.1:0= ) +" +BDEPEND=" + ${PYTHON_DEPS} + sys-apps/coreutils + systemtap? ( dev-util/systemtap ) + test? ( net-misc/curl ) +" +DEPEND=" + ${RDEPEND} +" +PATCHES=( + "${FILESDIR}"/${PN}-10.3.0-global-npm-config.patch + "${FILESDIR}"/${PN}-99999999-llhttp.patch +) +RESTRICT="test" +S="${WORKDIR}/node-v${PV}" + +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 + + # 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 node.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() { + xdg_environment_reset + + local myconf=( + --shared-brotli + --shared-cares + --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+=( --without-node-snapshot ) + if use ssl; then + use system-ssl && myconf+=( --shared-openssl --openssl-use-def-ca-store ) + else + myconf+=( --without-ssl ) + fi + + 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" \ + "${EPYTHON}" configure.py \ + --prefix="${EPREFIX}"/usr \ + --dest-cpu=${myarch} \ + $(use_with systemtap dtrace) \ + "${myconf[@]}" || die +} + +src_compile() { + emake -C out mksnapshot + emake -C out +} + +src_install() { + local LIBDIR="${ED}/usr/$(get_libdir)" + default + + # 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 + 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="$(TMPDIR="${T}" mktemp -t npm.XXXXXXXXXX)" + "${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 "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die +} + +src_test() { + out/${BUILDTYPE}/cctest || die + "${PYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die +} + +pkg_postinst() { + elog "The global npm config lives in /etc/npm. This deviates slightly" + elog "from upstream which otherwise would have it live in /usr/etc/." + elog "" + elog "Protip: When using node-gyp to install native modules, you can" + elog "avoid having to download extras by doing the following:" + elog "$ node-gyp --nodedir /usr/include/node " +} diff --git a/net-libs/nodejs/nodejs-14.15.1.ebuild b/net-libs/nodejs/nodejs-14.15.1.ebuild new file mode 100644 index 000000000000..14423d4f088c --- /dev/null +++ b/net-libs/nodejs/nodejs-14.15.1.ebuild @@ -0,0 +1,202 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{7..9} ) +PYTHON_REQ_USE="threads(+)" + +inherit bash-completion-r1 flag-o-matic python-any-r1 toolchain-funcs xdg-utils + +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/$(ver_cut 1)" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-linux ~x64-macos" + +IUSE="cpu_flags_x86_sse2 debug doc +icu inspector +npm +snapshot +ssl system-icu +system-ssl systemtap test" +REQUIRED_USE="inspector? ( icu ssl ) + npm? ( ssl ) + system-icu? ( icu ) + system-ssl? ( ssl )" + +# FIXME: test-fs-mkdir fails with "no such file or directory". Investigate. +RESTRICT="test" + +RDEPEND=">=app-arch/brotli-1.0.9 + >=dev-libs/libuv-1.40.0:= + >=net-dns/c-ares-1.16.1 + >=net-libs/nghttp2-1.41.0 + sys-libs/zlib + system-icu? ( >=dev-libs/icu-67:= ) + system-ssl? ( >=dev-libs/openssl-1.1.1:0= )" +BDEPEND="${PYTHON_DEPS} + sys-apps/coreutils + systemtap? ( dev-util/systemtap ) + test? ( net-misc/curl )" +DEPEND="${RDEPEND}" + +PATCHES=( + "${FILESDIR}"/${PN}-10.3.0-global-npm-config.patch + "${FILESDIR}"/${PN}-14.15.0-fix_ppc64_crashes.patch +) + +S="${WORKDIR}/node-v${PV}" + +pkg_pretend() { + (use x86 && ! use cpu_flags_x86_sse2) && \ + die "Your CPU doesn't support the required SSE2 instruction." +} + +src_prepare() { + tc-export AR 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 + + # 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 node.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() { + xdg_environment_reset + + local myconf=( + --shared-brotli + --shared-cares + --shared-libuv + --shared-nghttp2 + --shared-zlib + ) + use debug && myconf+=( --debug ) + if use system-icu; then + myconf+=( --with-intl=system-icu ) + elif use icu; then + myconf+=( --with-intl=full-icu ) + else + myconf+=( --with-intl=none ) + fi + use inspector || myconf+=( --without-inspector ) + use npm || myconf+=( --without-npm ) + use snapshot || myconf+=( --without-node-snapshot ) + if use ssl; then + use system-ssl && myconf+=( --shared-openssl --openssl-use-def-ca-store ) + else + myconf+=( --without-ssl ) + fi + + 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" \ + "${EPYTHON}" configure.py \ + --prefix="${EPREFIX}"/usr \ + --dest-cpu=${myarch} \ + $(use_with systemtap dtrace) \ + "${myconf[@]}" || die +} + +src_compile() { + emake -C out +} + +src_install() { + local LIBDIR="${ED}/usr/$(get_libdir)" + default + + # 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 + 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="$(TMPDIR="${T}" mktemp -t npm.XXXXXXXXXX)" + "${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 "${ED}"/usr/share/doc/node "${ED}"/usr/share/doc/${PF} || die +} + +src_test() { + out/${BUILDTYPE}/cctest || die + "${EPYTHON}" tools/test.py --mode=${BUILDTYPE,,} -J message parallel sequential || die +} -- cgit v1.2.3-65-gdbad