diff --git a/packages/nodejs-lts/build.sh b/packages/nodejs-lts/build.sh index d4e078394..35bfad8c1 100644 --- a/packages/nodejs-lts/build.sh +++ b/packages/nodejs-lts/build.sh @@ -1,17 +1,18 @@ TERMUX_PKG_HOMEPAGE=https://nodejs.org/ TERMUX_PKG_DESCRIPTION="Platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications" -TERMUX_PKG_VERSION=8.14.0 -TERMUX_PKG_SHA256=8ce252913c9f6aaa9871f2d9661b6e54858dae2f0064bd3c624676edb09083c4 +TERMUX_PKG_VERSION=10.15.0 +TERMUX_PKG_SHA256=797ab34c74b83b21b7d6ea261b5ca235d34c61a7da5aebb32459a963097ede3e TERMUX_PKG_SRCURL=https://nodejs.org/dist/v${TERMUX_PKG_VERSION}/node-v${TERMUX_PKG_VERSION}.tar.xz # Note that we do not use a shared libuv to avoid an issue with the Android # linker, which does not use symbols of linked shared libraries when resolving # symbols on dlopen(). See https://github.com/termux/termux-packages/issues/462. -TERMUX_PKG_DEPENDS="openssl, c-ares" +TERMUX_PKG_DEPENDS="openssl, c-ares, libicu" 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_CONFLICTS="nodejs" termux_step_configure () { + local DEST_CPU if [ $TERMUX_ARCH = "arm" ]; then DEST_CPU="arm" elif [ $TERMUX_ARCH = "i686" ]; then @@ -25,6 +26,9 @@ termux_step_configure () { fi export GYP_DEFINES="host_os=linux" + export CC_host=gcc + export CXX_host=g++ + export LINK_host=g++ # See note above TERMUX_PKG_DEPENDS why we do not use a shared libuv. ./configure \ @@ -34,7 +38,10 @@ termux_step_configure () { --shared-cares \ --shared-openssl \ --without-inspector \ - --without-intl \ + --with-intl=system-icu \ --without-snapshot \ --cross-compiling + + perl -p -i -e 's/LIBS := \$\(LIBS\)/LIBS := -lpthread/' \ + $TERMUX_PKG_SRCDIR/out/deps/v8/gypfiles/torque.host.mk } diff --git a/packages/nodejs-lts/deps-v8-gypfiles-v8.gyp.patch b/packages/nodejs-lts/deps-v8-gypfiles-v8.gyp.patch new file mode 100644 index 000000000..c841b6ea3 --- /dev/null +++ b/packages/nodejs-lts/deps-v8-gypfiles-v8.gyp.patch @@ -0,0 +1,13 @@ +diff -u -r ../node-v10.9.0/deps/v8/gypfiles/v8.gyp ./deps/v8/gypfiles/v8.gyp +--- ../node-v10.9.0/deps/v8/gypfiles/v8.gyp 2018-08-15 13:53:24.000000000 +0000 ++++ ./deps/v8/gypfiles/v8.gyp 2018-08-23 21:43:30.588264328 +0000 +@@ -2053,8 +2053,7 @@ + # library order and break (see crbug.com/469973). + # These libraries do not exist on Mac hosted builds. + 'libraries': [ +- '-ldl', +- '-lrt' ++ '-ldl' + ] + }] + ] diff --git a/packages/nodejs-lts/lib-os.js.patch b/packages/nodejs-lts/lib-os.js.patch index 9f3e97657..02d345fa5 100644 --- a/packages/nodejs-lts/lib-os.js.patch +++ b/packages/nodejs-lts/lib-os.js.patch @@ -1,10 +1,10 @@ -diff -u -r ../node-v5.10.0/lib/os.js ./lib/os.js ---- ../node-v5.10.0/lib/os.js 2016-03-31 21:52:17.000000000 -0400 -+++ ./lib/os.js 2016-04-04 04:46:05.148105544 -0400 -@@ -36,7 +36,7 @@ - path = process.env.TMPDIR || - process.env.TMP || - process.env.TEMP || +diff -u -r ../node-v10.9.0/lib/os.js ./lib/os.js +--- ../node-v10.9.0/lib/os.js 2018-08-15 13:53:34.000000000 +0000 ++++ ./lib/os.js 2018-08-23 20:42:39.611186774 +0000 +@@ -130,7 +130,7 @@ + path = safeGetenv('TMPDIR') || + safeGetenv('TMP') || + safeGetenv('TEMP') || - '/tmp'; + '@TERMUX_PREFIX@/tmp'; if (path.length > 1 && path.endsWith('/')) diff --git a/packages/nodejs-lts/node.gyp.patch b/packages/nodejs-lts/node.gyp.patch index 86aaae11f..a811b645d 100644 --- a/packages/nodejs-lts/node.gyp.patch +++ b/packages/nodejs-lts/node.gyp.patch @@ -1,11 +1,11 @@ -diff -u -r ../node-v8.12.0/node.gyp ./node.gyp ---- ../node-v8.12.0/node.gyp 2018-09-10 18:47:03.000000000 +0000 -+++ ./node.gyp 2018-09-11 20:53:55.711827836 +0000 -@@ -889,70 +889,6 @@ +diff -u -r ../node-v10.15.0/node.gyp ./node.gyp +--- ../node-v10.15.0/node.gyp 2018-12-26 05:26:18.000000000 +0000 ++++ ./node.gyp 2018-12-28 08:57:34.888459250 +0000 +@@ -902,81 +902,7 @@ ], } ], ] -- }, +- }, # rename_node_bin_win - { - 'target_name': 'cctest', - 'type': 'executable', @@ -14,7 +14,6 @@ diff -u -r ../node-v8.12.0/node.gyp ./node.gyp - '<(node_lib_target_name)', - 'rename_node_bin_win', - 'deps/gtest/gtest.gyp:gtest', -- 'node_js2c#host', - 'node_dtrace_header', - 'node_dtrace_ustack', - 'node_dtrace_provider', @@ -41,6 +40,8 @@ diff -u -r ../node-v8.12.0/node.gyp ./node.gyp - 'test/cctest/test_base64.cc', - 'test/cctest/test_node_postmortem_metadata.cc', - 'test/cctest/test_environment.cc', +- 'test/cctest/test_platform.cc', +- 'test/cctest/test_traced_value.cc', - 'test/cctest/test_util.cc', - 'test/cctest/test_url.cc' - ], @@ -68,7 +69,18 @@ diff -u -r ../node-v8.12.0/node.gyp ./node.gyp - ['OS=="solaris"', { - 'ldflags': [ '-I<(SHARED_INTERMEDIATE_DIR)' ] - }], +- # Skip cctest while building shared lib node for Windows +- [ 'OS=="win" and node_shared=="true"', { +- 'type': 'none', +- }], +- [ 'node_shared=="true"', { +- 'xcode_settings': { +- 'OTHER_LDFLAGS': [ '-Wl,-rpath,@loader_path', ], +- }, +- }], - ], - } +- }, # cctest ++ } ], # end targets + 'conditions': [ diff --git a/packages/nodejs-lts/src-node.cc.patch b/packages/nodejs-lts/src-node.cc.patch index c9bb4bdfc..df51d5cfe 100644 --- a/packages/nodejs-lts/src-node.cc.patch +++ b/packages/nodejs-lts/src-node.cc.patch @@ -1,34 +1,37 @@ -Without this patch functions such as process.getgroups -are not built on Android, which breaks things such as -npm/node_modules/which/which.js. - -diff -u -r ../node-v4.0.0/src/node.cc ./src/node.cc ---- ../node-v4.0.0/src/node.cc 2015-09-08 11:30:45.000000000 -0400 -+++ ./src/node.cc 2015-09-08 19:06:39.415724588 -0400 -@@ -69,7 +69,7 @@ +diff -u -r ../node-v10.9.0/src/node.cc ./src/node.cc +--- ../node-v10.9.0/src/node.cc 2018-08-15 13:53:34.000000000 +0000 ++++ ./src/node.cc 2018-08-23 20:49:59.353995878 +0000 +@@ -106,7 +106,7 @@ #include // setuid, getuid #endif --#if defined(__POSIX__) && !defined(__ANDROID__) -+#if defined(__POSIX__) +-#if defined(__POSIX__) && !defined(__ANDROID__) && !defined(__CloudABI__) ++#if defined(__POSIX__) && !defined(__CloudABI__) #include // getpwnam() #include // getgrnam() #endif -@@ -2866,7 +2866,7 @@ +@@ -690,7 +690,7 @@ - env->SetMethod(process, "umask", Umask); + // Look up environment variable unless running as setuid root. + bool SafeGetenv(const char* key, std::string* text) { +-#if !defined(__CloudABI__) && !defined(_WIN32) ++#if !defined(__CloudABI__) && !defined(_WIN32) && !defined(__ANDROID__) + if (linux_at_secure || getuid() != geteuid() || getgid() != getegid()) + goto fail; + #endif +@@ -2402,13 +2402,13 @@ + env->SetMethod(process, "reallyExit", Exit); + env->SetMethodNoSideEffect(process, "uptime", Uptime); --#if defined(__POSIX__) && !defined(__ANDROID__) -+#if defined(__POSIX__) - env->SetMethod(process, "getuid", GetUid); - env->SetMethod(process, "geteuid", GetEUid); - env->SetMethod(process, "setuid", SetUid); -@@ -2880,7 +2880,7 @@ - env->SetMethod(process, "getgroups", GetGroups); - env->SetMethod(process, "setgroups", SetGroups); - env->SetMethod(process, "initgroups", InitGroups); --#endif // __POSIX__ && !defined(__ANDROID__) -+#endif // __POSIX__ +-#if defined(__POSIX__) && !defined(__ANDROID__) && !defined(__CloudABI__) ++#if defined(__POSIX__) && !defined(__CloudABI__) + env->SetMethodNoSideEffect(process, "getuid", GetUid); + env->SetMethodNoSideEffect(process, "geteuid", GetEUid); + env->SetMethodNoSideEffect(process, "getgid", GetGid); + env->SetMethodNoSideEffect(process, "getegid", GetEGid); + env->SetMethodNoSideEffect(process, "getgroups", GetGroups); +-#endif // __POSIX__ && !defined(__ANDROID__) && !defined(__CloudABI__) ++#endif // __POSIX__ && !defined(__CloudABI__) + } - env->SetMethod(process, "_kill", Kill); diff --git a/packages/nodejs-lts/src-node_process.cc.patch b/packages/nodejs-lts/src-node_process.cc.patch index 6a1f2fe1f..8dd18c4b4 100644 --- a/packages/nodejs-lts/src-node_process.cc.patch +++ b/packages/nodejs-lts/src-node_process.cc.patch @@ -1,7 +1,7 @@ -diff -u -r ../node-v8.12.0/src/node_process.cc ./src/node_process.cc ---- ../node-v8.12.0/src/node_process.cc 2018-09-10 18:47:03.000000000 +0000 -+++ ./src/node_process.cc 2018-09-18 02:59:20.057281174 +0000 -@@ -22,7 +22,7 @@ +diff -u -r ../node-v10.9.0/src/node_process.cc ./src/node_process.cc +--- ../node-v10.9.0/src/node_process.cc 2018-08-15 13:53:35.000000000 +0000 ++++ ./src/node_process.cc 2018-08-23 23:40:53.046488108 +0000 +@@ -20,7 +20,7 @@ #include // setuid, getuid #endif @@ -10,20 +10,20 @@ diff -u -r ../node-v8.12.0/src/node_process.cc ./src/node_process.cc #include // getpwnam() #include // getgrnam() #endif -@@ -236,7 +236,7 @@ +@@ -247,7 +247,7 @@ } --#if defined(__POSIX__) && !defined(__ANDROID__) -+#if defined(__POSIX__) +-#if defined(__POSIX__) && !defined(__ANDROID__) && !defined(__CloudABI__) ++#if defined(__POSIX__) && !defined(__CloudABI__) static const uid_t uid_not_found = static_cast(-1); static const gid_t gid_not_found = static_cast(-1); -@@ -555,6 +555,6 @@ - } +@@ -546,6 +546,6 @@ + return env->ThrowErrnoException(errno, "initgroups"); } --#endif // __POSIX__ && !defined(__ANDROID__) -+#endif // __POSIX__ +-#endif // __POSIX__ && !defined(__ANDROID__) && !defined(__CloudABI__) ++#endif // __POSIX__ && !defined(__CloudABI__) } // namespace node