chiark / gitweb /
Add disabled-packages/nodejs-lts
[termux-packages] / disabled-packages / nodejs-lts / build.sh
1 # From https://github.com/etiago/termux-nodejs-lts
2 TERMUX_PKG_HOMEPAGE=http://nodejs.org/
3 TERMUX_PKG_DESCRIPTION="Platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications"
4 TERMUX_PKG_VERSION=4.4.3
5 TERMUX_PKG_SRCURL=https://nodejs.org/dist/v${TERMUX_PKG_VERSION}/node-v${TERMUX_PKG_VERSION}.tar.gz
6 TERMUX_PKG_DEPENDS="openssl, libuv"
7 TERMUX_PKG_RM_AFTER_INSTALL="lib/node_modules/npm/html lib/node_modules/npm/make.bat share/systemtap lib/dtrace"
8 TERMUX_PKG_BUILD_IN_SRC=yes
9 TERMUX_PKG_CONFLICTS=nodejs
10
11 termux_step_configure () {
12         #XXX: node.js build does not handle already installed headers
13         #     https://github.com/nodejs/node/issues/2637
14         #     So we remove them here and restore afterwards.
15         rm -Rf $TERMUX_PKG_CACHEDIR/gtest-include-dir $TERMUX_PKG_CACHEDIR/ares-includes
16         test -d $TERMUX_PREFIX/include/gtest &&
17                 mv $TERMUX_PREFIX/include/gtest $TERMUX_PKG_CACHEDIR/gtest-include-dir
18         test -f $TERMUX_PREFIX/include/ares.h &&
19                 mkdir $TERMUX_PKG_CACHEDIR/ares-includes/ &&
20                 mv $TERMUX_PREFIX/include/ares* $TERMUX_PKG_CACHEDIR/ares-includes/
21
22         # https://github.com/nodejs/build/issues/266: "V8 can handle cross compiling of
23         # snapshots if the {CC,CXX}_host variables are defined, by compiling the
24         # mksnapshot executable with the host compiler". But this currently fails
25         # due to the host build picking up targets flags.
26         export CC_host=gcc
27         export CXX_host=g++
28
29         if [ $TERMUX_ARCH = "arm" ]; then
30                 DEST_CPU="arm"
31         elif [ $TERMUX_ARCH = "i686" ]; then
32                 DEST_CPU="ia32"
33         elif [ $TERMUX_ARCH = "aarch64" ]; then
34                 DEST_CPU="arm64"
35         elif [ $TERMUX_ARCH = "x86_64" ]; then
36                 DEST_CPU="x64"
37         else
38                 echo "Unsupported arch: $TERMUX_ARCH"
39                 exit 1
40         fi
41
42         #LDFLAGS+=" -lstlport_static"
43
44         ./configure \
45                 --prefix=$TERMUX_PREFIX \
46                 --dest-cpu=$DEST_CPU \
47                 --dest-os=android \
48                 --shared-openssl --shared-zlib --shared-libuv \
49                 --without-snapshot
50 }
51
52 termux_step_post_massage () {
53         test -d $TERMUX_PKG_CACHEDIR/gtest-include-dir &&
54                 mv $TERMUX_PKG_CACHEDIR/gtest-include-dir $TERMUX_PREFIX/include/gtest
55         test -d $TERMUX_PKG_CACHEDIR/ares-includes &&
56                 mv $TERMUX_PKG_CACHEDIR/ares-includes/* $TERMUX_PREFIX/include/
57         # Exit with success to avoid aborting script due to set -e:
58         true
59 }