diff --git a/android-configure b/android-configure index cbf137f47174c7..1dc238ebd0c522 100755 --- a/android-configure +++ b/android-configure @@ -1,5 +1,14 @@ #!/bin/bash +# In order to cross-compile node for Android using NDK, run: +# source android-configure [arch] +# +# By running android-configure with source, will allow environment variables to +# be persistent in current session. This is useful for installing native node +# modules with npm. Also, don't forget to set the arch in npm config using +# 'npm config set arch=' + + if [ -z "$2" ]; then ARCH=arm else @@ -42,8 +51,16 @@ export CC=$TOOLCHAIN/bin/$SUFFIX-gcc export CXX=$TOOLCHAIN/bin/$SUFFIX-g++ export LINK=$TOOLCHAIN/bin/$SUFFIX-g++ -./configure \ - --dest-cpu=$DEST_CPU \ - --dest-os=android \ - --without-snapshot \ - --openssl-no-asm +GYP_DEFINES="target_arch=$ARCH" +GYP_DEFINES+=" v8_target_arch=$ARCH" +GYP_DEFINES+=" android_target_arch=$ARCH" +GYP_DEFINES+=" host_os=linux OS=android" +export GYP_DEFINES + +if [ -f "configure" ]; then + ./configure \ + --dest-cpu=$DEST_CPU \ + --dest-os=android \ + --without-snapshot \ + --openssl-no-asm +fi