From 928e15109f1c7a0676fc1cd0a8449f4927dd0d73 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Mon, 2 May 2016 00:48:34 -0400 Subject: [PATCH] nodejs: Cleanup and build against shared c-ares --- packages/nodejs/build.sh | 30 ++---- packages/nodejs/node.gyp.patch | 35 +++++++ packages/nodejs/src-cares_wrap.cc.patch | 12 +++ packages/nodejs/use-standard-c++lib.patch | 108 ---------------------- 4 files changed, 53 insertions(+), 132 deletions(-) create mode 100644 packages/nodejs/node.gyp.patch create mode 100644 packages/nodejs/src-cares_wrap.cc.patch delete mode 100644 packages/nodejs/use-standard-c++lib.patch diff --git a/packages/nodejs/build.sh b/packages/nodejs/build.sh index add38c044..777aa51df 100644 --- a/packages/nodejs/build.sh +++ b/packages/nodejs/build.sh @@ -3,21 +3,11 @@ TERMUX_PKG_DESCRIPTION="Platform built on Chrome's JavaScript runtime for easily TERMUX_PKG_VERSION=6.0.0 TERMUX_PKG_BUILD_REVISION=1 TERMUX_PKG_SRCURL=https://nodejs.org/dist/v${TERMUX_PKG_VERSION}/node-v${TERMUX_PKG_VERSION}.tar.gz -TERMUX_PKG_DEPENDS="openssl, libuv, libgnustl" +TERMUX_PKG_DEPENDS="openssl, libuv, libgnustl, c-ares" TERMUX_PKG_RM_AFTER_INSTALL="lib/node_modules/npm/html lib/node_modules/npm/make.bat share/systemtap lib/dtrace" TERMUX_PKG_BUILD_IN_SRC=yes termux_step_configure () { - #XXX: node.js build does not handle already installed headers - # https://github.com/nodejs/node/issues/2637 - # So we remove them here and restore afterwards. - rm -Rf $TERMUX_PKG_CACHEDIR/gtest-include-dir $TERMUX_PKG_CACHEDIR/ares-includes - test -d $TERMUX_PREFIX/include/gtest && - mv $TERMUX_PREFIX/include/gtest $TERMUX_PKG_CACHEDIR/gtest-include-dir - test -f $TERMUX_PREFIX/include/ares.h && - mkdir $TERMUX_PKG_CACHEDIR/ares-includes/ && - mv $TERMUX_PREFIX/include/ares* $TERMUX_PKG_CACHEDIR/ares-includes/ - # https://github.com/nodejs/build/issues/266: "V8 can handle cross compiling of # snapshots if the {CC,CXX}_host variables are defined, by compiling the # mksnapshot executable with the host compiler". But this currently fails @@ -25,8 +15,10 @@ termux_step_configure () { export CC_host=gcc export CXX_host=g++ + local _EXTRA_CONFIGURE_ARGS="" if [ $TERMUX_ARCH = "arm" ]; then DEST_CPU="arm" + _EXTRA_CONFIGURE_ARGS=" --with-arm-float-abi=hard --with-arm-fpu=neon" elif [ $TERMUX_ARCH = "i686" ]; then DEST_CPU="ia32" elif [ $TERMUX_ARCH = "aarch64" ]; then @@ -38,21 +30,11 @@ termux_step_configure () { exit 1 fi - #LDFLAGS+=" -lstlport_static" - ./configure \ --prefix=$TERMUX_PREFIX \ --dest-cpu=$DEST_CPU \ --dest-os=android \ - --shared-openssl --shared-zlib --shared-libuv \ - --without-snapshot -} - -termux_step_post_massage () { - test -d $TERMUX_PKG_CACHEDIR/gtest-include-dir && - mv $TERMUX_PKG_CACHEDIR/gtest-include-dir $TERMUX_PREFIX/include/gtest - test -d $TERMUX_PKG_CACHEDIR/ares-includes && - mv $TERMUX_PKG_CACHEDIR/ares-includes/* $TERMUX_PREFIX/include/ - # Exit with success to avoid aborting script due to set -e: - true + --shared-openssl --shared-zlib --shared-libuv --shared-cares \ + --without-snapshot \ + $_EXTRA_CONFIGURE_ARGS } diff --git a/packages/nodejs/node.gyp.patch b/packages/nodejs/node.gyp.patch new file mode 100644 index 000000000..8ec79990d --- /dev/null +++ b/packages/nodejs/node.gyp.patch @@ -0,0 +1,35 @@ +diff -u -r ../node-v6.0.0/node.gyp ./node.gyp +--- ../node-v6.0.0/node.gyp 2016-04-26 15:50:22.000000000 -0400 ++++ ./node.gyp 2016-05-02 00:04:38.044434363 -0400 +@@ -685,31 +685,6 @@ + ], + } ], + ] +- }, +- { +- 'target_name': 'cctest', +- 'type': 'executable', +- 'dependencies': [ +- 'deps/gtest/gtest.gyp:gtest', +- 'deps/v8/tools/gyp/v8.gyp:v8', +- 'deps/v8/tools/gyp/v8.gyp:v8_libplatform' +- ], +- 'include_dirs': [ +- 'src', +- 'deps/v8/include' +- ], +- 'defines': [ +- # gtest's ASSERT macros conflict with our own. +- 'GTEST_DONT_DEFINE_ASSERT_EQ=1', +- 'GTEST_DONT_DEFINE_ASSERT_GE=1', +- 'GTEST_DONT_DEFINE_ASSERT_GT=1', +- 'GTEST_DONT_DEFINE_ASSERT_LE=1', +- 'GTEST_DONT_DEFINE_ASSERT_LT=1', +- 'GTEST_DONT_DEFINE_ASSERT_NE=1', +- ], +- 'sources': [ +- 'test/cctest/util.cc', +- ], + } + ], # end targets + diff --git a/packages/nodejs/src-cares_wrap.cc.patch b/packages/nodejs/src-cares_wrap.cc.patch new file mode 100644 index 000000000..2d0ca4913 --- /dev/null +++ b/packages/nodejs/src-cares_wrap.cc.patch @@ -0,0 +1,12 @@ +diff -u -r ../node-v6.0.0/src/cares_wrap.cc ./src/cares_wrap.cc +--- ../node-v6.0.0/src/cares_wrap.cc 2016-04-26 15:50:22.000000000 -0400 ++++ ./src/cares_wrap.cc 2016-05-02 00:24:26.349502775 -0400 +@@ -15,8 +15,7 @@ + #include + #include + +-#if defined(__ANDROID__) || \ +- defined(__MINGW32__) || \ ++#if defined(__MINGW32__) || \ + defined(__OpenBSD__) || \ + defined(_MSC_VER) diff --git a/packages/nodejs/use-standard-c++lib.patch b/packages/nodejs/use-standard-c++lib.patch deleted file mode 100644 index 5dd5eb887..000000000 --- a/packages/nodejs/use-standard-c++lib.patch +++ /dev/null @@ -1,108 +0,0 @@ -diff -u -r ../node-v6.0.0/deps/v8/build/standalone.gypi ./deps/v8/build/standalone.gypi ---- ../node-v6.0.0/deps/v8/build/standalone.gypi 2016-04-26 15:50:10.000000000 -0400 -+++ ./deps/v8/build/standalone.gypi 2016-04-28 20:30:19.392238419 -0400 -@@ -320,7 +320,6 @@ - ['android_ndk_root==""', { - 'variables': { - 'android_sysroot': '<(android_toolchain)/sysroot/', -- 'android_stl': '<(android_toolchain)/sources/cxx-stl/', - }, - 'conditions': [ - ['target_arch=="x64"', { -@@ -329,15 +328,11 @@ - 'android_lib': '<(android_sysroot)/usr/lib', - }], - ], -- 'android_libcpp_include': '<(android_stl)/llvm-libc++/libcxx/include', -- 'android_libcpp_abi_include': '<(android_stl)/llvm-libc++abi/libcxxabi/include', -- 'android_libcpp_libs': '<(android_stl)/llvm-libc++/libs', - 'android_support_include': '<(android_toolchain)/sources/android/support/include', - 'android_sysroot': '<(android_sysroot)', - }, { - 'variables': { - 'android_sysroot': '<(android_ndk_root)/platforms/android-<(android_target_platform)/arch-<(android_target_arch)', -- 'android_stl': '<(android_ndk_root)/sources/cxx-stl/', - }, - 'conditions': [ - ['target_arch=="x64"', { -@@ -346,14 +341,10 @@ - 'android_lib': '<(android_sysroot)/usr/lib', - }], - ], -- 'android_libcpp_include': '<(android_stl)/llvm-libc++/libcxx/include', -- 'android_libcpp_abi_include': '<(android_stl)/llvm-libc++abi/libcxxabi/include', -- 'android_libcpp_libs': '<(android_stl)/llvm-libc++/libs', - 'android_support_include': '<(android_ndk_root)/sources/android/support/include', - 'android_sysroot': '<(android_sysroot)', - }], - ], -- 'android_libcpp_library': 'c++_static', - }], # OS=="android" - ['host_clang==1', { - 'host_cc': '<(clang_dir)/bin/clang', -@@ -1033,11 +1024,6 @@ - '-Wa,--noexecstack', - '--sysroot=<(android_sysroot)', - ], -- 'cflags_cc': [ -- '-isystem<(android_libcpp_include)', -- '-isystem<(android_libcpp_abi_include)', -- '-isystem<(android_support_include)', -- ], - 'defines': [ - 'ANDROID', - #'__GNU_SOURCE=1', # Necessary for clone() -@@ -1062,7 +1048,7 @@ - '-lpthread', '-lnss3', '-lnssutil3', '-lsmime3', '-lplds4', '-lplc4', '-lnspr4', - ], - 'libraries': [ -- '-l<(android_libcpp_library)', -+ 'libstdc++', - '-latomic', - # Manually link the libgcc.a that the cross compiler uses. - '