summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-04-01 19:41:32 +0200
committerFlorian Dold <florian.dold@gmail.com>2019-04-03 16:12:55 +0200
commit0647cb311e4b5e25dbdcdf227bc7a455cc6dce2d (patch)
treea255d3d552e1ca807a8ff871f27719022a40cdf8
parent71e285b94c7edaa43aa8115965cf5a36b8e0f80a (diff)
downloadakono-0647cb311e4b5e25dbdcdf227bc7a455cc6dce2d.tar.gz
akono-0647cb311e4b5e25dbdcdf227bc7a455cc6dce2d.tar.bz2
akono-0647cb311e4b5e25dbdcdf227bc7a455cc6dce2d.zip
build script and patches
-rw-r--r--deps/.gitignore1
-rw-r--r--deps/README.md14
-rwxr-xr-xdeps/build_node53
-rw-r--r--deps/node/common.gypi8
-rw-r--r--deps/node/deps/cares/config/android/ares_config.h2
-rw-r--r--deps/node/deps/openssl/openssl-cl_no_asm.gypi2
-rw-r--r--deps/node/deps/openssl/openssl_no_asm.gypi2
-rw-r--r--deps/node/node.gyp4
-rw-r--r--deps/node/node.gypi3
9 files changed, 82 insertions, 7 deletions
diff --git a/deps/.gitignore b/deps/.gitignore
new file mode 100644
index 00000000..fb17e1f5
--- /dev/null
+++ b/deps/.gitignore
@@ -0,0 +1 @@
+android-toolchain/
diff --git a/deps/README.md b/deps/README.md
new file mode 100644
index 00000000..3325702b
--- /dev/null
+++ b/deps/README.md
@@ -0,0 +1,14 @@
+Building node for Android isn't officially supported, so there are some difficulties:
+
+* Node tries to build v8 via gyp, but the gyp build is broken for cross-compiling to Android.
+ Also, the V8 team doesn't maintain the gyp build files anymore. Only the gn build (gn is Chromium's build
+ tool) works.
+* The --build-v8-with-gn option for node is also broken.
+
+
+We build node with the --without-bundled-v8 option. This is necessary since we
+manually have to compile the bundled v8.
+
+
+Resources:
+* https://v8.dev/docs/cross-compile-arm
diff --git a/deps/build_node b/deps/build_node
new file mode 100755
index 00000000..40363be6
--- /dev/null
+++ b/deps/build_node
@@ -0,0 +1,53 @@
+#!/usr/bin/env bash
+
+set -euf -o pipefail
+
+NDK=$1
+
+DEST_CPU_ARCH='arm'
+API_LEVEL=26
+BUILD_HOST_TAG='linux-x86_64'
+TOOLCHAIN_DIR=$NDK/toolchains/llvm/prebuilt/$BUILD_HOST_TAG/
+
+if [[ ! -d "$NDK" ]]; then
+ echo "Android NDK directory '$NDK' invalid"
+ exit 1
+fi
+
+if [[ ! -d "$TOOLCHAIN_DIR" ]]; then
+ echo "Toolchain directory '$TOOLCHAIN_DIR' invalid"
+ exit 1
+fi
+
+# The naming of these isn't very consistent, as some tools start with arm,
+# others with arm7a.
+export AR=$TOOLCHAIN_DIR/bin/arm-linux-androideabi-ar
+export CC=$TOOLCHAIN_DIR/bin/armv7a-linux-androideabi$API_LEVEL-clang
+export CXX=$TOOLCHAIN_DIR/bin/armv7a-linux-androideabi$API_LEVEL-clang++
+export LD=$TOOLCHAIN_DIR/bin/arm-linux-androideabi-ld
+export LINK=$TOOLCHAIN_DIR/bin/armv7a-linux-androideabi$API_LEVEL-clang++
+export RANLIB=$TOOLCHAIN_DIR/bin/arm-linux-androideabi-ranlib
+export STRIP=$TOOLCHAIN_DIR/bin/arm-linux-androideabi-strip
+
+export LDFLAGS="-static-libstdc++"
+
+cd node
+
+export GYP_DEFINES="OS=android clang=1"
+
+function myconf() {
+ ./configure \
+ --dest-cpu=$DEST_CPU_ARCH \
+ --dest-os=android \
+ --without-snapshot \
+ --without-intl \
+ --openssl-no-asm \
+ --without-bundled-v8 \
+ --shared
+}
+
+if [ -z ${2+x} ]; then
+ myconf && make
+else
+ eval $2
+fi
diff --git a/deps/node/common.gypi b/deps/node/common.gypi
index 338ed2cb..36a773a4 100644
--- a/deps/node/common.gypi
+++ b/deps/node/common.gypi
@@ -123,8 +123,8 @@
'ldflags': [ '-Wl,-bbigtoc' ],
}],
['OS == "android"', {
- 'cflags': [ '-fPIE' ],
- 'ldflags': [ '-fPIE', '-pie' ]
+ 'cflags': [ '-fPIC' ],
+ 'ldflags': [ '-fPIC' ]
}],
['node_shared=="true"', {
'msvs_settings': {
@@ -198,8 +198,8 @@
],
},],
['OS == "android"', {
- 'cflags': [ '-fPIE' ],
- 'ldflags': [ '-fPIE', '-pie' ]
+ 'cflags': [ '-fPIC' ],
+ 'ldflags': [ '-fPIC' ]
}],
['node_shared=="true"', {
'msvs_settings': {
diff --git a/deps/node/deps/cares/config/android/ares_config.h b/deps/node/deps/cares/config/android/ares_config.h
index 1a5265a5..2d469d5c 100644
--- a/deps/node/deps/cares/config/android/ares_config.h
+++ b/deps/node/deps/cares/config/android/ares_config.h
@@ -128,7 +128,7 @@
#define HAVE_GETNAMEINFO 1
/* Define to 1 if you have the getservbyport_r function. */
-#define HAVE_GETSERVBYPORT_R 1
+#undef HAVE_GETSERVBYPORT_R
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
diff --git a/deps/node/deps/openssl/openssl-cl_no_asm.gypi b/deps/node/deps/openssl/openssl-cl_no_asm.gypi
index 8b44e1f6..dff1146b 100644
--- a/deps/node/deps/openssl/openssl-cl_no_asm.gypi
+++ b/deps/node/deps/openssl/openssl-cl_no_asm.gypi
@@ -16,6 +16,8 @@
'includes': ['config/archs/linux64-s390x/no-asm/openssl-cl.gypi'],
}, 'target_arch=="arm" and OS=="linux"', {
'includes': ['config/archs/linux-armv4/no-asm/openssl-cl.gypi'],
+ }, 'target_arch=="arm" and OS=="android"', {
+ 'includes': ['config/archs/linux-armv4/no-asm/openssl-cl.gypi'],
}, 'target_arch=="arm64" and OS=="linux"', {
'includes': ['config/archs/linux-aarch64/no-asm/openssl-cl.gypi'],
}, 'target_arch=="ia32" and OS=="linux"', {
diff --git a/deps/node/deps/openssl/openssl_no_asm.gypi b/deps/node/deps/openssl/openssl_no_asm.gypi
index 2e0d9639..080577c5 100644
--- a/deps/node/deps/openssl/openssl_no_asm.gypi
+++ b/deps/node/deps/openssl/openssl_no_asm.gypi
@@ -17,6 +17,8 @@
'includes': ['config/archs/linux64-s390x/no-asm/openssl.gypi'],
}, 'target_arch=="arm" and OS=="linux"', {
'includes': ['config/archs/linux-armv4/no-asm/openssl.gypi'],
+ }, 'target_arch=="arm" and OS=="android"', {
+ 'includes': ['config/archs/linux-armv4/no-asm/openssl.gypi'],
}, 'target_arch=="arm64" and OS=="linux"', {
'includes': ['config/archs/linux-aarch64/no-asm/openssl.gypi'],
}, 'target_arch=="ia32" and OS=="linux"', {
diff --git a/deps/node/node.gyp b/deps/node/node.gyp
index 6bd2e63a..61d232cd 100644
--- a/deps/node/node.gyp
+++ b/deps/node/node.gyp
@@ -362,7 +362,8 @@
'include_dirs': [
'src',
- '<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h
+ '<(SHARED_INTERMEDIATE_DIR)', # for node_natives.h
+ 'deps/v8/include/'
],
'dependencies': [ 'deps/histogram/histogram.gyp:histogram' ],
@@ -991,7 +992,6 @@
'deps/uv/include',
'<(SHARED_INTERMEDIATE_DIR)', # for node_natives.h
],
-
'defines': [ 'NODE_WANT_INTERNALS=1' ],
'sources': [
diff --git a/deps/node/node.gypi b/deps/node/node.gypi
index c07b5ea7..5721a375 100644
--- a/deps/node/node.gypi
+++ b/deps/node/node.gypi
@@ -84,6 +84,9 @@
}],
],
}],
+ [ 'node_use_bundled_v8=="false"', {
+ 'libraries' : [ '<!(pwd)/deps/v8/out.gn/arm.release/obj/libv8_monolith.a' ],
+ }],
[ 'node_use_v8_platform=="true"', {
'defines': [
'NODE_USE_V8_PLATFORM=1',