chiark / gitweb /
532f67690e68bb616a6aeddb80dd6a808332b997
[termux-packages] / packages / nodejs / build.sh
1 TERMUX_PKG_HOMEPAGE=http://nodejs.org/
2 TERMUX_PKG_DESCRIPTION="Platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications"
3 TERMUX_PKG_VERSION=6.7.0
4 TERMUX_PKG_SRCURL=https://nodejs.org/dist/v${TERMUX_PKG_VERSION}/node-v${TERMUX_PKG_VERSION}.tar.gz
5 # Note that we do not use a shared libuv to avoid an issue with the Android
6 # linker, which does not use symbols of linked shared libraries when resolving
7 # symbols on dlopen(). See https://github.com/termux/termux-packages/issues/462.
8 TERMUX_PKG_DEPENDS="openssl, c-ares"
9 TERMUX_PKG_RM_AFTER_INSTALL="lib/node_modules/npm/html lib/node_modules/npm/make.bat share/systemtap lib/dtrace"
10 TERMUX_PKG_BUILD_IN_SRC=yes
11
12 termux_step_configure () {
13         # See https://github.com/nodejs/build/issues/266 about enabling snapshots
14         # when cross compiling. We use {CC,CXX}_host for compilation of code to
15         # be run on the build maching (snapshots when cross compiling are
16         # generated using a CPU emulator provided by v8) and {CC,CXX} for the
17         # cross compile. We unset flags such as CFLAGS as they would affect
18         # both the host and cross compiled build.
19         # Remaining issue to be solved before enabling snapshots by removing
20         # the --without-snapshot flag is that pkg-config picks up cross compilation
21         # flags which breaks the host build.
22         #export CC_host="gcc -pthread"
23         #export CXX_host="g++ -pthread"
24         #export CC="$CC $CFLAGS $CPPFLAGS $LDFLAGS"
25         #export CXX="$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS"
26         #export CFLAGS="-Os"
27         #export CXXFLAGS="-Os"
28         #unset CPPFLAGS LDFLAGS
29
30         if [ $TERMUX_ARCH = "arm" ]; then
31                 DEST_CPU="arm"
32         elif [ $TERMUX_ARCH = "i686" ]; then
33                 DEST_CPU="ia32"
34         elif [ $TERMUX_ARCH = "aarch64" ]; then
35                 DEST_CPU="arm64"
36         elif [ $TERMUX_ARCH = "x86_64" ]; then
37                 DEST_CPU="x64"
38         else
39                 echo "Unsupported arch: $TERMUX_ARCH"
40                 exit 1
41         fi
42
43         # See note above TERMUX_PKG_DEPENDS why we do not use a shared libuv.
44         ./configure \
45                 --prefix=$TERMUX_PREFIX \
46                 --dest-cpu=$DEST_CPU \
47                 --dest-os=android \
48                 --shared-cares \
49                 --shared-openssl \
50                 --shared-zlib \
51                 --without-inspector \
52                 --without-intl \
53                 --without-snapshot
54 }