Skip to content

Commit

Permalink
net-libs/nodejs: Version bump.
Browse files Browse the repository at this point in the history
Package-Manager: Portage-2.3.12, Repoman-2.3.3
  • Loading branch information
Jeroen Roovers committed Oct 24, 2017
1 parent 2f57bff commit 7699732
Show file tree
Hide file tree
Showing 2 changed files with 194 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 @@ -2,6 +2,7 @@ DIST node-v0.12.17.tar.gz 19938029 SHA256 ddea5e253812f167608fbdda6ff29ffc30dc6f
DIST node-v4.6.1.tar.xz 13295568 SHA256 fe2a85df8758001878abb5bbaf17a6b6cdc12b3e465b1d3bace83b37fdf0345a SHA512 4eb2acbe13ee2373922420e3238be63d2108dacba640438bddbdea12ec2de9c655f33db611e4c0654b66bf4fdb844a7b6554a823aac73171b17599096856abdb WHIRLPOOL a6d21cce7ab8c430528682f78a6e6492f753c87949b7b1bdc15dc02911559cd89deb45329c2ba32da57b776dd4feaabec8a3e7a59a78094cfb079261b6475c76
DIST node-v6.11.2.tar.xz 15665456 SHA256 04af4992238b19124ea56f1bcfda36827613a24eb3b00fc3b50f261a415a26e4 SHA512 9ea203e402b5d57fb5d30cc4e9e59e9dac5303134d687888ee5e7e004388054086d82dd9097408bb3cfb25826dcefe720b75052542f8c88867de382efe91b3b8 WHIRLPOOL af8467f21b812fa2f6e723dbd7be2579257175cc7a826a1863044b69f8384a74bd9da2a7096cf29b6f1e7cfbb439ce179a66c45e063edd60f456dad0410aa42a
DIST node-v6.11.3.tar.xz 15684012 SHA256 5f09b77010cb3ec4e321ecdc30beb6b49d8a2843155b7f0ad97202ec308ab6bc SHA512 4afad49499d05f97ba45a27ea64d5ab514b276af5cf3b362a9c418dda8619dbf22baa1c958c2ee48ca576ec350f45f2fe02bf18aee91d82d44126c92e9ba547d WHIRLPOOL 65f1478794ad4f183cc7937987a9add24271c1641d6ab00d337c4415da606bde8378b557d2ac923f1d50b87b4aa06ba3b79488ed49a6f40e54f6c5852d41eb75
DIST node-v6.11.4.tar.xz 15699188 SHA256 4c2f0435e3088136ac4bc75236a7717f189d590a13f490065e7b3b8e5aacd450 SHA512 e495db0e1fe44a50c445424df6e9ea2e28245db485361e9ac928e4e6abbe0866f75b7948f70732f23218d4e93cf1b793613eba9d2551466fa56ac97c6c97de5e WHIRLPOOL dbb0cbeb6fe69da815e408dbbd16f40eb40f88b3493a9bad0d004294da738dbc1c0cde538cfddd10616ff1dc27f59dbd39f2818636575cb5cac2414de1d7ebe1
DIST node-v6.9.4.tar.xz 15519264 SHA256 c51d7c61db40455d57428abcadc7eb0f0a08a8878cb1d8ea3c1e211c54532c35 SHA512 86d3e2889031c2b50c021bd3fd63194c2c22c44291d51dff1b5e1652b01853c09d2880c2f58fdad062e3e2a3f637a3f0d78dac66b835b676790cf272e64f8dce WHIRLPOOL d1bcf488ed1aae7959303b988c9467fc5d0930166c7bfe0e441392763e19f788496971c07560a9f62586bbb2be7ce741ece8346140d665d29593b9b8f649b002
DIST node-v8.5.0.tar.xz 18326412 SHA256 e1cde5d8e5049e7e1b61aef128f26162059d885dc8cab5014bf5cbf693f75c3c SHA512 7ef83a6da7ba9d61c19df0530dfee7b769c0bc7ab066fc29fdb54c9b09085a3536699c7c92889cea8fbf3d6241cc66c383cd351451da8019fea4e0d25d043f3d WHIRLPOOL 63576159748e9423a0b1df7d032d4f5edc23d33f22fd76d3dc0f0b4804606abf57011097dcf4fd2d3707b22babe69bcd976133b7450558925b5d679872abd382
DIST node-v8.7.0.tar.xz 18186384 SHA256 5a17d08c68ee7c1e748fd32534edda766cb57c13ed98e693f3075bc9d9a0b59a SHA512 5ce41d2d7f1c07330c4d9acc8129840d03fb820dac2f87be3f277a372ed6d84d6e1516e1d804e2277d500f32f9838d4307122b26962029d4f811904523f72530 WHIRLPOOL f4541efef681204684d491c9a2539560602c017087fa895e41b3ee9616ce6860a22634179bb904e816eee45b5f5ebc06bada5bb55be05e6e1418cac45cc55966
193 changes: 193 additions & 0 deletions net-libs/nodejs/nodejs-6.11.4.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
# 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 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 +npm +snapshot +ssl test"

RDEPEND="icu? ( >=dev-libs/icu-56:= )
npm? ( ${PYTHON_DEPS} )
>=net-libs/http-parser-2.6.2:=
>=dev-libs/libuv-1.9.0:=
>=dev-libs/openssl-1.0.2g:0=[-bindist]
sys-libs/zlib"
DEPEND="${RDEPEND}
${PYTHON_DEPS}
test? ( net-misc/curl )"

S="${WORKDIR}/node-v${PV}"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"

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/|| 'python'/|| '${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 || 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

# 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 myarch=""
local myconf=( --shared-openssl --shared-libuv --shared-http-parser --shared-zlib )
use npm || myconf+=( --without-npm )
use icu && myconf+=( --with-intl=system-icu )
use snapshot && myconf+=( --with-snapshot )
use ssl || myconf+=( --without-ssl )
use debug && myconf+=( --debug )

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} \
--without-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>"
}

0 comments on commit 7699732

Please sign in to comment.