Browse Source

nodejs: Cleanup and build against shared c-ares

android-5
Fredrik Fornwall 9 years ago
parent
commit
928e15109f
  1. 30
      packages/nodejs/build.sh
  2. 35
      packages/nodejs/node.gyp.patch
  3. 12
      packages/nodejs/src-cares_wrap.cc.patch
  4. 108
      packages/nodejs/use-standard-c++lib.patch

30
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_VERSION=6.0.0
TERMUX_PKG_BUILD_REVISION=1 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_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_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_PKG_BUILD_IN_SRC=yes
termux_step_configure () { 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 # 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 # snapshots if the {CC,CXX}_host variables are defined, by compiling the
# mksnapshot executable with the host compiler". But this currently fails # mksnapshot executable with the host compiler". But this currently fails
@ -25,8 +15,10 @@ termux_step_configure () {
export CC_host=gcc export CC_host=gcc
export CXX_host=g++ export CXX_host=g++
local _EXTRA_CONFIGURE_ARGS=""
if [ $TERMUX_ARCH = "arm" ]; then if [ $TERMUX_ARCH = "arm" ]; then
DEST_CPU="arm" DEST_CPU="arm"
_EXTRA_CONFIGURE_ARGS=" --with-arm-float-abi=hard --with-arm-fpu=neon"
elif [ $TERMUX_ARCH = "i686" ]; then elif [ $TERMUX_ARCH = "i686" ]; then
DEST_CPU="ia32" DEST_CPU="ia32"
elif [ $TERMUX_ARCH = "aarch64" ]; then elif [ $TERMUX_ARCH = "aarch64" ]; then
@ -38,21 +30,11 @@ termux_step_configure () {
exit 1 exit 1
fi fi
#LDFLAGS+=" -lstlport_static"
./configure \ ./configure \
--prefix=$TERMUX_PREFIX \ --prefix=$TERMUX_PREFIX \
--dest-cpu=$DEST_CPU \ --dest-cpu=$DEST_CPU \
--dest-os=android \ --dest-os=android \
--shared-openssl --shared-zlib --shared-libuv \ --shared-openssl --shared-zlib --shared-libuv --shared-cares \
--without-snapshot --without-snapshot \
} $_EXTRA_CONFIGURE_ARGS
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
} }

35
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

12
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 <stdlib.h>
#include <string.h>
-#if defined(__ANDROID__) || \
- defined(__MINGW32__) || \
+#if defined(__MINGW32__) || \
defined(__OpenBSD__) || \
defined(_MSC_VER)

108
packages/nodejs/use-standard-c++lib.patch

@ -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.
'<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
@@ -1083,24 +1069,6 @@
'-mtune=cortex-a8',
'-mfpu=vfp3',
],
- 'ldflags': [
- '-L<(android_libcpp_libs)/armeabi-v7a',
- ],
- }],
- ['target_arch=="arm" and arm_version < 7', {
- 'ldflags': [
- '-L<(android_libcpp_libs)/armeabi',
- ],
- }],
- ['target_arch=="x64"', {
- 'ldflags': [
- '-L<(android_libcpp_libs)/x86_64',
- ],
- }],
- ['target_arch=="arm64"', {
- 'ldflags': [
- '-L<(android_libcpp_libs)/arm64-v8a',
- ],
}],
['target_arch=="ia32" or target_arch=="x87"', {
# The x86 toolchain currently has problems with stack-protector.
@@ -1110,9 +1078,6 @@
'cflags': [
'-fno-stack-protector',
],
- 'ldflags': [
- '-L<(android_libcpp_libs)/x86',
- ],
}],
['target_arch=="mipsel"', {
# The mips toolchain currently has problems with stack-protector.
@@ -1123,9 +1088,6 @@
'cflags': [
'-fno-stack-protector',
],
- 'ldflags': [
- '-L<(android_libcpp_libs)/mips',
- ],
}],
['(target_arch=="arm" or target_arch=="arm64" or target_arch=="x64" or target_arch=="ia32") and component!="shared_library"', {
'cflags': [
Loading…
Cancel
Save