Skip to content

Commit 4ad7184

Browse files
robertchirasMyles Borins
authored andcommitted
build: add suport for x86 architecture
Modified android-configure script to support also x86 arch. Currently added support only for ia32 target arch. Also, compile openssl without asm, since using the asm sources will make node fail to run on Android, because it adds text relocations. Signed-off-by: Robert Chiras <robert.chiras@intel.com> PR-URL: #5544 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent c893cd3 commit 4ad7184

File tree

2 files changed

+47
-8
lines changed

2 files changed

+47
-8
lines changed

android-configure

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,49 @@
11
#!/bin/bash
22

3+
if [ -z "$2" ]; then
4+
ARCH=arm
5+
else
6+
ARCH="$2"
7+
fi
8+
9+
CC_VER="4.9"
10+
case $ARCH in
11+
arm)
12+
DEST_CPU="$ARCH"
13+
SUFFIX="$ARCH-linux-androideabi"
14+
TOOLCHAIN_NAME="$SUFFIX"
15+
;;
16+
x86)
17+
DEST_CPU="ia32"
18+
SUFFIX="i686-linux-android"
19+
TOOLCHAIN_NAME="$ARCH"
20+
;;
21+
x86_64)
22+
DEST_CPU="ia32"
23+
SUFFIX="$ARCH-linux-android"
24+
TOOLCHAIN_NAME="$ARCH"
25+
;;
26+
*)
27+
echo "Unsupported architecture provided: $ARCH"
28+
exit 1
29+
;;
30+
esac
31+
332
export TOOLCHAIN=$PWD/android-toolchain
433
mkdir -p $TOOLCHAIN
534
$1/build/tools/make-standalone-toolchain.sh \
6-
--toolchain=arm-linux-androideabi-4.9 \
7-
--arch=arm \
35+
--toolchain=$TOOLCHAIN_NAME-$CC_VER \
36+
--arch=$ARCH \
837
--install-dir=$TOOLCHAIN \
938
--platform=android-21
1039
export PATH=$TOOLCHAIN/bin:$PATH
11-
export AR=$TOOLCHAIN/bin/arm-linux-androideabi-ar
12-
export CC=$TOOLCHAIN/bin/arm-linux-androideabi-gcc
13-
export CXX=$TOOLCHAIN/bin/arm-linux-androideabi-g++
14-
export LINK=$TOOLCHAIN/bin/arm-linux-androideabi-g++
40+
export AR=$TOOLCHAIN/bin/$SUFFIX-ar
41+
export CC=$TOOLCHAIN/bin/$SUFFIX-gcc
42+
export CXX=$TOOLCHAIN/bin/$SUFFIX-g++
43+
export LINK=$TOOLCHAIN/bin/$SUFFIX-g++
1544

1645
./configure \
17-
--dest-cpu=arm \
18-
--dest-os=android
46+
--dest-cpu=$DEST_CPU \
47+
--dest-os=android \
48+
--without-snapshot \
49+
--openssl-no-asm

common.gypi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@
7070
'cflags': [ '-gxcoff' ],
7171
'ldflags': [ '-Wl,-bbigtoc' ],
7272
}],
73+
['OS == "android"', {
74+
'cflags': [ '-fPIE' ],
75+
'ldflags': [ '-fPIE', '-pie' ]
76+
}]
7377
],
7478
'msvs_settings': {
7579
'VCCLCompilerTool': {
@@ -103,6 +107,10 @@
103107
['OS!="mac" and OS!="win"', {
104108
'cflags': [ '-fno-omit-frame-pointer' ],
105109
}],
110+
['OS == "android"', {
111+
'cflags': [ '-fPIE' ],
112+
'ldflags': [ '-fPIE', '-pie' ]
113+
}]
106114
],
107115
'msvs_settings': {
108116
'VCCLCompilerTool': {

0 commit comments

Comments
 (0)