diff options
Diffstat (limited to 'net-libs/nodejs')
-rw-r--r-- | net-libs/nodejs/Manifest | 1 | ||||
-rw-r--r-- | net-libs/nodejs/nodejs-99999999.ebuild | 200 |
2 files changed, 201 insertions, 0 deletions
diff --git a/net-libs/nodejs/Manifest b/net-libs/nodejs/Manifest index dfbc329b4d5f..5e4fa48d1090 100644 --- a/net-libs/nodejs/Manifest +++ b/net-libs/nodejs/Manifest @@ -15,4 +15,5 @@ EBUILD nodejs-6.9.4.ebuild 6073 BLAKE2B cf41081773527f8efb120d6d7ba8d21dc834fc47 EBUILD nodejs-8.9.1-r1.ebuild 6421 BLAKE2B 1cc15687b44dc144b6f004483ed7fb875a3ebc3b2d82c6fdc95cd62b2c2e2ba2400dbb95c5a7ffa9cb338d6bab09fb4ef098fa71e3b3c2d32f6ddd302f384a6e SHA512 8c312851a25fd71aa64fc9b3a209f463b1c5099d87a0ae5ad3b6ba6c4c41651a683249c09b81079cc990c8bdb38bcca12138eec7f4a3d03d04a75c9036c60d7d EBUILD nodejs-8.9.2.ebuild 6421 BLAKE2B 1cc15687b44dc144b6f004483ed7fb875a3ebc3b2d82c6fdc95cd62b2c2e2ba2400dbb95c5a7ffa9cb338d6bab09fb4ef098fa71e3b3c2d32f6ddd302f384a6e SHA512 8c312851a25fd71aa64fc9b3a209f463b1c5099d87a0ae5ad3b6ba6c4c41651a683249c09b81079cc990c8bdb38bcca12138eec7f4a3d03d04a75c9036c60d7d EBUILD nodejs-9.2.0-r1.ebuild 6421 BLAKE2B 8373da68cf051d055edfe47e737ecd091dce243430efb25cd9ce2b04213a16364aac0613ff793ef7e44dde94a1c28bfa7b0711c7bfa02a80c01097fb6dfcb546 SHA512 25d09d0fed3bf63d67edfc98699388b8fdd33812577417704f2a242f9e8290dce509c6c90b335020960a387999e35c0343256e5a85003b9a253bcd14ba805eb1 +EBUILD nodejs-99999999.ebuild 6279 BLAKE2B 4fdab839abcf93e72846133d67e1bddbc3f6df9030f3c50136d21b1a563abffa03042f20264522d4fb6326f4cd7496790e50f027e9b9799d8c557dbb19acea9b SHA512 790483bcd7ca2f1cd362760a9b19bf0d09ec7359ea583909e64bba556b3ed3da13767e611bb64f91c2002650086c2247a1a52088ba62e271d2bb149f5b52fb13 MISC metadata.xml 502 BLAKE2B 8640b71810454f7c091026e02910563ee44866ed666fc18be431415054ce38e6dab45f8e1890161d5b39e6eafe0279caed936046b803e619880a7ddeb3e4e428 SHA512 bc6fd0a671ad96d8c3f190514932ccc19319c895829136cd04d99b4123666380ed84502d7dea711dfb1d0ba7f0c6edb88afdc95ff24fbca4a6ad636062b5c32a diff --git a/net-libs/nodejs/nodejs-99999999.ebuild b/net-libs/nodejs/nodejs-99999999.ebuild new file mode 100644 index 000000000000..846c80299fc9 --- /dev/null +++ b/net-libs/nodejs/nodejs-99999999.ebuild @@ -0,0 +1,200 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 +RESTRICT="test" + +PYTHON_COMPAT=( python2_7 ) +PYTHON_REQ_USE="threads" + +inherit bash-completion-r1 eutils flag-o-matic git-r3 pax-utils python-single-r1 toolchain-funcs + +DESCRIPTION="A JavaScript runtime built on Chrome's V8 JavaScript engine" +HOMEPAGE="https://nodejs.org/" +EGIT_REPO_URI="https://github.com/nodejs/node" + +LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT" +SLOT="0" +KEYWORDS="" +IUSE="cpu_flags_x86_sse2 debug doc icu inspector +npm +snapshot +ssl systemtap test" +REQUIRED_USE=" + ${PYTHON_REQUIRED_USE} + inspector? ( icu ssl ) +" + +RDEPEND=" + >=dev-libs/libuv-1.16.1:= + >=net-libs/http-parser-2.7.0:= + >=net-libs/nghttp2-1.25.0 + sys-libs/zlib + icu? ( >=dev-libs/icu-59:= ) + npm? ( ${PYTHON_DEPS} ) + ssl? ( >=dev-libs/openssl-1.0.2g:0=[-bindist] ) +" +DEPEND="${RDEPEND} + ${PYTHON_DEPS} + systemtap? ( dev-util/systemtap ) + test? ( net-misc/curl )" + +PATCHES=( + "${FILESDIR}"/gentoo-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}'/" lib/module.js 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! + dohtml -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 +} + +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>" +} |