changeset 396:af9fcfc5c007

add a nodejs ebuild that supports building without the ssl flag
author Dirk Olmes <dirk@xanthippe.ping.de>
date Wed, 26 Aug 2015 09:27:04 +0200
parents 041db1ee4881
children a13344a4a7bb
files net-libs/nodejs/Manifest net-libs/nodejs/files/nodejs-ssl.patch net-libs/nodejs/nodejs-0.12.7.ebuild
diffstat 3 files changed, 155 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-libs/nodejs/Manifest	Wed Aug 26 09:27:04 2015 +0200
@@ -0,0 +1,3 @@
+AUX nodejs-ssl.patch 863 SHA256 2e4952286c145892b65091321b9ec5af88d2fb3114b3500ec78d7520a8952eb8 SHA512 23ebfe5c36f4f0998552c1a66eb8c3719990fa5dbd41d00cefdf65c0b598de29d1d88378c5600e7ea62997b13635b6fac59ec9a060e086acb453490cfda48569 WHIRLPOOL 289edc5d86b08bdc2987382907126bd6d0401d95e2ea207260bdcc7deee7a947d5ea6049efb1028af3619ab4c469392f58f52a183d85e3387fc68b9bbbe045c7
+DIST node-v0.12.7.tar.gz 20063992 SHA256 b23d64df051c9c969b0c583f802d5d71de342e53067127a5061415be7e12f39d SHA512 0c9cb7542530463e7703435c8d819949785c1c6497c6d98f9854ca615fe33a62f451833e856f0159b836a698b4dee5d165fa505bad5d474f664e1533090d8606 WHIRLPOOL 647391b8c49fda868c14bd4eb3089cac139f50e710ac6b141ea82e1013c4ff7d40cdb0e88d69604d06e3bd07775876c754211a2b099685cb7353ae5708812525
+EBUILD nodejs-0.12.7.ebuild 3488 SHA256 ba83a9bbf92a92a089183cdbfbaa37ceb2b9229c02b067e28466cb54921e5c3c SHA512 e6420cf39b4985b190af47d9aedd306f2691689cc562acbe7ee2578de15c5ed272db477199e9460efa78a072636fcaead307e6789ec311222066cd701f9f7311 WHIRLPOOL 8aac2d4ed1be172d0da0a52ad54d05b676bbf1b7bb16e5d6bd547249d8317beea6414ede16cb0bd538729ee7e44500041894f506a744d2e17acebb5e394eb1ee
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-libs/nodejs/files/nodejs-ssl.patch	Wed Aug 26 09:27:04 2015 +0200
@@ -0,0 +1,26 @@
+--- src/node.cc.orig	2015-07-10 06:41:19.000000000 +0800
++++ src/node.cc	2015-07-31 17:33:25.035074443 +0800
+@@ -2934,8 +2934,10 @@
+          "                       present.\n"
+ #endif
+ #endif
++#if HAVE_OPENSSL
+          "  --enable-ssl2        enable ssl2\n"
+          "  --enable-ssl3        enable ssl3\n"
++#endif // HAVE_OPENSSL
+          "\n"
+          "Environment variables:\n"
+ #ifdef _WIN32
+@@ -3003,10 +3005,12 @@
+     } else if (strcmp(arg, "--version") == 0 || strcmp(arg, "-v") == 0) {
+       printf("%s\n", NODE_VERSION);
+       exit(0);
++#if HAVE_OPENSSL
+     } else if (strcmp(arg, "--enable-ssl2") == 0) {
+       SSL2_ENABLE = true;
+     } else if (strcmp(arg, "--enable-ssl3") == 0) {
+       SSL3_ENABLE = true;
++#endif // HAVE_OPENSSL
+     } else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) {
+       PrintHelp();
+       exit(0);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-libs/nodejs/nodejs-0.12.7.ebuild	Wed Aug 26 09:27:04 2015 +0200
@@ -0,0 +1,126 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+# has known failures. sigh.
+RESTRICT="test"
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="threads"
+
+inherit pax-utils python-single-r1 toolchain-funcs
+
+DESCRIPTION="Evented IO for V8 Javascript"
+HOMEPAGE="http://nodejs.org/"
+SRC_URI="http://nodejs.org/dist/v${PV}/node-v${PV}.tar.gz"
+
+LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86 ~x64-macos"
+IUSE="debug icu +npm +snapshot +ssl"
+
+RDEPEND="icu? ( dev-libs/icu )
+	${PYTHON_DEPS}
+	ssl? ( dev-libs/openssl:0=[-bindist] )
+	>=net-libs/http-parser-2.3
+	>=dev-libs/libuv-1.4.2"
+DEPEND="${RDEPEND}
+	!!net-libs/iojs"
+
+S="${WORKDIR}/node-v${PV}"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+src_prepare() {
+	epatch "${FILESDIR}/${PN}-ssl.patch"
+
+	tc-export CC CXX PKG_CONFIG
+	export V=1 # Verbose build
+	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
+
+	# 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
+}
+
+src_configure() {
+	local myconf=()
+	local myarch=""
+	use debug && myconf+=( --debug )
+	use icu && myconf+=( --with-intl=system-icu )
+	use npm || myconf+=( --without-npm )
+	use snapshot || myconf+=( --without-snapshot )
+	use ssl || myconf+=( --without-ssl )
+
+	case ${ABI} in
+		x86) myarch="ia32";;
+		amd64) myarch="x64";;
+		arm) myarch="arm";;
+		*) die "Unrecognized ARCH ${ARCH}";;
+	esac
+
+	"${PYTHON}" configure \
+		--prefix="${EPREFIX}"/usr \
+		--dest-cpu=${myarch} \
+		--shared-openssl \
+		--shared-libuv \
+		--shared-http-parser \
+		--shared-zlib \
+		--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="${ED}" PREFIX=/usr
+	use npm && dodoc -r "${LIBDIR}"/node_modules/npm/html
+	rm -rf "${LIBDIR}"/node_modules/npm/{doc,html} || die
+	find "${LIBDIR}"/node_modules -type f -name "LICENSE*" -or -name "LICENCE*" -delete
+
+	# set up a symlink structure that npm 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
+
+	pax-mark -m "${ED}"/usr/bin/node
+}
+
+src_test() {
+	declare -xl TESTTYPE="${BUILDTYPE}"
+	"${PYTHON}" tools/test.py --mode=${TESTTYPE} -J message simple || die
+}
+
+pkg_postinst() {
+	einfo "When using node-gyp to install native modules, you can avoid"
+	einfo "having to download the full tarball by doing the following:"
+	einfo ""
+	einfo "node-gyp --nodedir /usr/include/node <command>"
+}