Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 64fb7a1

Browse filesBrowse files
robertchirasMyles Borins
authored andcommitted
build: update android-configure script for npm
Now, that we can cross-compile node for Android, we also need to take care of native node modules installed with npm. Since there is no way to install and run npm on an Android device, we could instal node on host and setup an environment for installing node modules and cross-compile the native sources using Android NDK. The changes to this script will allow npm, when installing a module, to compile it using NDK. In order to do this, the developer should do the following steps: 1. Compile and install node on host, using: configure, make and make install 2. Build node for Android, using: source android-configure <path_to_ndk> arch and make 3. Push node binary to Android device 4. Using the same session, configure npm arch using: npm config set arch=<arch> 5. Install desired node modules using: npm install 6. Push installed node modules to Android device Signed-off-by: Robert Chiras <robert.chiras@intel.com> PR-URL: #6349 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent 3b46187 commit 64fb7a1
Copy full SHA for 64fb7a1

File tree

Expand file treeCollapse file tree

1 file changed

+22
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+22
-5
lines changed
Open diff view settings
Collapse file

‎android-configure‎

Copy file name to clipboardExpand all lines: android-configure
+22-5Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
#!/bin/bash
22

3+
# In order to cross-compile node for Android using NDK, run:
4+
# source android-configure <path_to_ndk> [arch]
5+
#
6+
# By running android-configure with source, will allow environment variables to
7+
# be persistent in current session. This is useful for installing native node
8+
# modules with npm. Also, don't forget to set the arch in npm config using
9+
# 'npm config set arch=<arch>'
10+
11+
312
if [ -z "$2" ]; then
413
ARCH=arm
514
else
@@ -42,8 +51,16 @@ export CC=$TOOLCHAIN/bin/$SUFFIX-gcc
4251
export CXX=$TOOLCHAIN/bin/$SUFFIX-g++
4352
export LINK=$TOOLCHAIN/bin/$SUFFIX-g++
4453

45-
./configure \
46-
--dest-cpu=$DEST_CPU \
47-
--dest-os=android \
48-
--without-snapshot \
49-
--openssl-no-asm
54+
GYP_DEFINES="target_arch=$ARCH"
55+
GYP_DEFINES+=" v8_target_arch=$ARCH"
56+
GYP_DEFINES+=" android_target_arch=$ARCH"
57+
GYP_DEFINES+=" host_os=linux OS=android"
58+
export GYP_DEFINES
59+
60+
if [ -f "configure" ]; then
61+
./configure \
62+
--dest-cpu=$DEST_CPU \
63+
--dest-os=android \
64+
--without-snapshot \
65+
--openssl-no-asm
66+
fi

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.