9 changed files with 263 additions and 0 deletions
@ -0,0 +1,55 @@ |
|||
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=7.4.0 |
|||
TERMUX_PKG_SRCURL=https://nodejs.org/dist/v${TERMUX_PKG_VERSION}/node-v${TERMUX_PKG_VERSION}.tar.gz |
|||
TERMUX_PKG_SHA256=69b76c86e6fc9914fa136089d8c28a4828c14aa8792cbdf946090a5a2afd25b6 |
|||
# 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_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 () { |
|||
# See https://github.com/nodejs/build/issues/266 about enabling snapshots |
|||
# when cross compiling. We use {CC,CXX}_host for compilation of code to |
|||
# be run on the build maching (snapshots when cross compiling are |
|||
# generated using a CPU emulator provided by v8) and {CC,CXX} for the |
|||
# cross compile. We unset flags such as CFLAGS as they would affect |
|||
# both the host and cross compiled build. |
|||
# Remaining issue to be solved before enabling snapshots by removing |
|||
# the --without-snapshot flag is that pkg-config picks up cross compilation |
|||
# flags which breaks the host build. |
|||
#export CC_host="gcc -pthread" |
|||
#export CXX_host="g++ -pthread" |
|||
#export CC="$CC $CFLAGS $CPPFLAGS $LDFLAGS" |
|||
#export CXX="$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS" |
|||
#export CFLAGS="-Os" |
|||
#export CXXFLAGS="-Os" |
|||
#unset CPPFLAGS LDFLAGS |
|||
|
|||
if [ $TERMUX_ARCH = "arm" ]; then |
|||
DEST_CPU="arm" |
|||
elif [ $TERMUX_ARCH = "i686" ]; then |
|||
DEST_CPU="ia32" |
|||
elif [ $TERMUX_ARCH = "aarch64" ]; then |
|||
DEST_CPU="arm64" |
|||
elif [ $TERMUX_ARCH = "x86_64" ]; then |
|||
DEST_CPU="x64" |
|||
else |
|||
echo "Unsupported arch: $TERMUX_ARCH" |
|||
exit 1 |
|||
fi |
|||
|
|||
# See note above TERMUX_PKG_DEPENDS why we do not use a shared libuv. |
|||
./configure \ |
|||
--prefix=$TERMUX_PREFIX \ |
|||
--dest-cpu=$DEST_CPU \ |
|||
--dest-os=android \ |
|||
--shared-cares \ |
|||
--shared-openssl \ |
|||
--shared-zlib \ |
|||
--without-inspector \ |
|||
--without-intl \ |
|||
--without-snapshot |
|||
} |
@ -0,0 +1,12 @@ |
|||
diff -u -r ../node-v5.1.0/deps/npm/lib/build.js ./deps/npm/lib/build.js
|
|||
--- ../node-v5.1.0/deps/npm/lib/build.js 2015-11-17 15:55:27.000000000 -0500
|
|||
+++ ./deps/npm/lib/build.js 2015-11-17 19:01:33.061204729 -0500
|
|||
@@ -223,6 +223,8 @@
|
|||
|
|||
function linkBin (from, to, gently, cb) { |
|||
if (process.platform !== 'win32') { |
|||
+ // Fix shebang paths in binary scripts:
|
|||
+ require('child_process').spawn('termux-fix-shebang', [from])
|
|||
return linkIfExists(from, to, gently, cb) |
|||
} else { |
|||
return cmdShimIfExists(from, to, cb) |
@ -0,0 +1,12 @@ |
|||
diff -u -r ../node-v6.2.0/lib/child_process.js ./lib/child_process.js
|
|||
--- ../node-v6.2.0/lib/child_process.js 2016-05-17 15:53:06.000000000 -0400
|
|||
+++ ./lib/child_process.js 2016-05-18 16:31:45.574685443 -0400
|
|||
@@ -335,7 +335,7 @@
|
|||
if (typeof options.shell === 'string') |
|||
file = options.shell; |
|||
else if (process.platform === 'android') |
|||
- file = '/system/bin/sh';
|
|||
+ file = '@TERMUX_PREFIX@/bin/sh';
|
|||
else |
|||
file = '/bin/sh'; |
|||
args = ['-c', command]; |
@ -0,0 +1,12 @@ |
|||
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 || |
|||
- '/tmp';
|
|||
+ '@TERMUX_PREFIX@/tmp';
|
|||
if (path.length > 1 && path.endsWith('/')) |
|||
path = path.slice(0, -1); |
|||
} |
@ -0,0 +1,82 @@ |
|||
diff -u -r ../node-v7.4.0/node.gyp ./node.gyp
|
|||
--- ../node-v7.4.0/node.gyp 2017-01-04 12:42:03.000000000 -0500
|
|||
+++ ./node.gyp 2017-01-09 17:25:27.918417691 -0500
|
|||
@@ -863,78 +863,6 @@
|
|||
], |
|||
} ], |
|||
] |
|||
- },
|
|||
- {
|
|||
- 'target_name': 'cctest',
|
|||
- 'type': 'executable',
|
|||
- 'dependencies': [ 'deps/gtest/gtest.gyp:gtest' ],
|
|||
- 'include_dirs': [
|
|||
- 'src',
|
|||
- 'deps/v8/include',
|
|||
- '<(SHARED_INTERMEDIATE_DIR)'
|
|||
- ],
|
|||
- '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',
|
|||
- 'NODE_WANT_INTERNALS=1',
|
|||
- ],
|
|||
- 'sources': [
|
|||
- 'test/cctest/util.cc',
|
|||
- ],
|
|||
-
|
|||
- 'conditions': [
|
|||
- ['v8_inspector=="true"', {
|
|||
- 'defines': [
|
|||
- 'HAVE_INSPECTOR=1',
|
|||
- ],
|
|||
- 'dependencies': [
|
|||
- 'deps/zlib/zlib.gyp:zlib',
|
|||
- 'v8_inspector_compress_protocol_json#host'
|
|||
- ],
|
|||
- 'include_dirs': [
|
|||
- '<(SHARED_INTERMEDIATE_DIR)'
|
|||
- ],
|
|||
- 'sources': [
|
|||
- 'src/inspector_socket.cc',
|
|||
- 'src/inspector_socket_server.cc',
|
|||
- 'test/cctest/test_inspector_socket.cc',
|
|||
- 'test/cctest/test_inspector_socket_server.cc'
|
|||
- ],
|
|||
- 'conditions': [
|
|||
- [ 'node_shared_openssl=="false"', {
|
|||
- 'dependencies': [
|
|||
- 'deps/openssl/openssl.gyp:openssl'
|
|||
- ]
|
|||
- }],
|
|||
- [ 'node_shared_http_parser=="false"', {
|
|||
- 'dependencies': [
|
|||
- 'deps/http_parser/http_parser.gyp:http_parser'
|
|||
- ]
|
|||
- }],
|
|||
- [ 'node_shared_libuv=="false"', {
|
|||
- 'dependencies': [
|
|||
- 'deps/uv/uv.gyp:libuv'
|
|||
- ]
|
|||
- }]
|
|||
- ]
|
|||
- }],
|
|||
- [ 'node_use_v8_platform=="true"', {
|
|||
- 'dependencies': [
|
|||
- 'deps/v8/src/v8.gyp:v8_libplatform',
|
|||
- ],
|
|||
- }],
|
|||
- [ 'node_use_bundled_v8=="true"', {
|
|||
- 'dependencies': [
|
|||
- 'deps/v8/src/v8.gyp:v8',
|
|||
- 'deps/v8/src/v8.gyp:v8_libplatform'
|
|||
- ],
|
|||
- }],
|
|||
- ]
|
|||
} |
|||
], # end targets |
|||
|
@ -0,0 +1,12 @@ |
|||
diff -u -r ../node-v0.12.7/deps/npm/node_modules/osenv/node_modules/os-tmpdir/index.js ./deps/npm/node_modules/osenv/node_modules/os-tmpdir/index.js
|
|||
--- ../node-v0.12.7/deps/npm/node_modules/osenv/node_modules/os-tmpdir/index.js 2015-07-09 18:41:19.000000000 -0400
|
|||
+++ ./deps/npm/node_modules/osenv/node_modules/os-tmpdir/index.js 2015-07-24 20:56:42.278310940 -0400
|
|||
@@ -14,7 +14,7 @@
|
|||
path = process.env.TMPDIR || |
|||
process.env.TMP || |
|||
process.env.TEMP || |
|||
- '/tmp';
|
|||
+ '@TERMUX_PREFIX@/tmp';
|
|||
} |
|||
|
|||
if (trailingSlashRe.test(path)) { |
@ -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) |
@ -0,0 +1,52 @@ |
|||
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 @@
|
|||
#include <unistd.h> // setuid, getuid |
|||
#endif |
|||
|
|||
-#if defined(__POSIX__) && !defined(__ANDROID__)
|
|||
+#if defined(__POSIX__)
|
|||
#include <pwd.h> // getpwnam() |
|||
#include <grp.h> // getgrnam() |
|||
#endif |
|||
@@ -1590,7 +1590,7 @@
|
|||
} |
|||
|
|||
|
|||
-#if defined(__POSIX__) && !defined(__ANDROID__)
|
|||
+#if defined(__POSIX__)
|
|||
|
|||
static const uid_t uid_not_found = static_cast<uid_t>(-1); |
|||
static const gid_t gid_not_found = static_cast<gid_t>(-1); |
|||
@@ -1910,7 +1910,7 @@
|
|||
} |
|||
} |
|||
|
|||
-#endif // __POSIX__ && !defined(__ANDROID__)
|
|||
+#endif // __POSIX__
|
|||
|
|||
|
|||
void Exit(const FunctionCallbackInfo<Value>& args) { |
|||
@@ -2866,7 +2866,7 @@
|
|||
|
|||
env->SetMethod(process, "umask", Umask); |
|||
|
|||
-#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__
|
|||
|
|||
env->SetMethod(process, "_kill", Kill); |
|||
|
@ -0,0 +1,14 @@ |
|||
diff -u -r ../node-v6.3.1/src/node_main.cc ./src/node_main.cc
|
|||
--- ../node-v6.3.1/src/node_main.cc 2016-07-21 16:44:43.000000000 -0400
|
|||
+++ ./src/node_main.cc 2016-07-23 13:53:57.530095071 -0400
|
|||
@@ -54,6 +54,10 @@
|
|||
// calls elsewhere in the program (e.g., any logging from V8.) |
|||
setvbuf(stdout, nullptr, _IONBF, 0); |
|||
setvbuf(stderr, nullptr, _IONBF, 0); |
|||
+ if (getenv("TMPDIR") == NULL) {
|
|||
+ // Give javascript programs (such as updated versions of npm) a working tmpdir.
|
|||
+ putenv("TMPDIR=@TERMUX_PREFIX@/tmp");
|
|||
+ }
|
|||
return node::Start(argc, argv); |
|||
} |
|||
#endif |
Loading…
Reference in new issue