comparison net-libs/nodejs/nodejs-0.12.7.ebuild @ 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
children
comparison
equal deleted inserted replaced
395:041db1ee4881 396:af9fcfc5c007
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 # has known failures. sigh.
8 RESTRICT="test"
9
10 PYTHON_COMPAT=( python2_7 )
11 PYTHON_REQ_USE="threads"
12
13 inherit pax-utils python-single-r1 toolchain-funcs
14
15 DESCRIPTION="Evented IO for V8 Javascript"
16 HOMEPAGE="http://nodejs.org/"
17 SRC_URI="http://nodejs.org/dist/v${PV}/node-v${PV}.tar.gz"
18
19 LICENSE="Apache-1.1 Apache-2.0 BSD BSD-2 MIT"
20 SLOT="0"
21 KEYWORDS="~amd64 ~arm ~x86 ~x64-macos"
22 IUSE="debug icu +npm +snapshot +ssl"
23
24 RDEPEND="icu? ( dev-libs/icu )
25 ${PYTHON_DEPS}
26 ssl? ( dev-libs/openssl:0=[-bindist] )
27 >=net-libs/http-parser-2.3
28 >=dev-libs/libuv-1.4.2"
29 DEPEND="${RDEPEND}
30 !!net-libs/iojs"
31
32 S="${WORKDIR}/node-v${PV}"
33 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
34
35 src_prepare() {
36 epatch "${FILESDIR}/${PN}-ssl.patch"
37
38 tc-export CC CXX PKG_CONFIG
39 export V=1 # Verbose build
40 export BUILDTYPE=Release
41
42 # fix compilation on Darwin
43 # https://code.google.com/p/gyp/issues/detail?id=260
44 sed -i -e "/append('-arch/d" tools/gyp/pylib/gyp/xcode_emulation.py || die
45
46 # make sure we use python2.* while using gyp
47 sed -i -e "s/python/${EPYTHON}/" deps/npm/node_modules/node-gyp/gyp/gyp || die
48 sed -i -e "s/|| 'python'/|| '${EPYTHON}'/" deps/npm/node_modules/node-gyp/lib/configure.js || die
49
50 # less verbose install output (stating the same as portage, basically)
51 sed -i -e "/print/d" tools/install.py || die
52
53 # proper libdir, hat tip @ryanpcmcquen https://github.com/iojs/io.js/issues/504
54 local LIBDIR=$(get_libdir)
55 sed -i -e "s|lib/|${LIBDIR}/|g" tools/install.py || die
56 sed -i -e "s/'lib'/'${LIBDIR}'/" lib/module.js || die
57 sed -i -e "s|\"lib\"|\"${LIBDIR}\"|" deps/npm/lib/npm.js || die
58
59 # debug builds. change install path, remove optimisations and override buildtype
60 if use debug; then
61 sed -i -e "s|out/Release/|out/Debug/|g" tools/install.py || die
62 BUILDTYPE=Debug
63 fi
64 }
65
66 src_configure() {
67 local myconf=()
68 local myarch=""
69 use debug && myconf+=( --debug )
70 use icu && myconf+=( --with-intl=system-icu )
71 use npm || myconf+=( --without-npm )
72 use snapshot || myconf+=( --without-snapshot )
73 use ssl || myconf+=( --without-ssl )
74
75 case ${ABI} in
76 x86) myarch="ia32";;
77 amd64) myarch="x64";;
78 arm) myarch="arm";;
79 *) die "Unrecognized ARCH ${ARCH}";;
80 esac
81
82 "${PYTHON}" configure \
83 --prefix="${EPREFIX}"/usr \
84 --dest-cpu=${myarch} \
85 --shared-openssl \
86 --shared-libuv \
87 --shared-http-parser \
88 --shared-zlib \
89 --without-dtrace \
90 "${myconf[@]}" || die
91 }
92
93 src_compile() {
94 emake -C out mksnapshot
95 pax-mark m "out/${BUILDTYPE}/mksnapshot"
96 emake -C out
97 }
98
99 src_install() {
100 local LIBDIR="${ED}/usr/$(get_libdir)"
101 emake install DESTDIR="${ED}" PREFIX=/usr
102 use npm && dodoc -r "${LIBDIR}"/node_modules/npm/html
103 rm -rf "${LIBDIR}"/node_modules/npm/{doc,html} || die
104 find "${LIBDIR}"/node_modules -type f -name "LICENSE*" -or -name "LICENCE*" -delete
105
106 # set up a symlink structure that npm expects..
107 dodir /usr/include/node/deps/{v8,uv}
108 dosym . /usr/include/node/src
109 for var in deps/{uv,v8}/include; do
110 dosym ../.. /usr/include/node/${var}
111 done
112
113 pax-mark -m "${ED}"/usr/bin/node
114 }
115
116 src_test() {
117 declare -xl TESTTYPE="${BUILDTYPE}"
118 "${PYTHON}" tools/test.py --mode=${TESTTYPE} -J message simple || die
119 }
120
121 pkg_postinst() {
122 einfo "When using node-gyp to install native modules, you can avoid"
123 einfo "having to download the full tarball by doing the following:"
124 einfo ""
125 einfo "node-gyp --nodedir /usr/include/node <command>"
126 }