• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3if [[ "$OUT" == "" ]]; then
4  echo "In order for this script to function, please choose an arm target"
5  echo "using source build/envsetup.sh and lunch XXX\n"
6  exit 1
7fi
8
9cc="${ANDROID_TOOLCHAIN}/i686-linux-android-gcc"
10cpp="${ANDROID_TOOLCHAIN}/i686-linux-android-g++"
11
12includes=(
13  "-isystem ${ANDROID_BUILD_TOP}/system/core/include"
14  "-isystem ${ANDROID_BUILD_TOP}/hardware/libhardware/include"
15  "-isystem ${ANDROID_BUILD_TOP}/hardware/libhardware_legacy/include"
16  "-isystem ${ANDROID_BUILD_TOP}/hardware/ril/include"
17  "-isystem ${ANDROID_BUILD_TOP}/libnativehelper/include"
18  "-isystem ${ANDROID_BUILD_TOP}/frameworks/native/include"
19  "-isystem ${ANDROID_BUILD_TOP}/frameworks/native/opengl/include"
20  "-isystem ${ANDROID_BUILD_TOP}/frameworks/av/include"
21  "-isystem ${ANDROID_BUILD_TOP}/frameworks/base/include"
22  "-isystem ${ANDROID_BUILD_TOP}/external/skia/include"
23  "-isystem ${OUT}/obj/include"
24  "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/arch-x86/include"
25  "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/include"
26  "-isystem ${ANDROID_BUILD_TOP}/bionic/libstdc++/include"
27  "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/kernel/uapi"
28  "-isystem ${ANDROID_BUILD_TOP}/bionic/libc/kernel/uapi/asm-x86"
29  "-isystem ${ANDROID_BUILD_TOP}/bionic/libm/include"
30  "-isystem ${ANDROID_BUILD_TOP}/bionic/libm/include/i387"
31  "-isystem ${ANDROID_BUILD_TOP}/bionic/libthread_db/include"
32)
33
34ldflags=(
35  "-m32"
36  "-Wl,-z,noexecstack"
37  "-Wl,-z,relro"
38  "-Wl,-z,now"
39  "-Wl,--warn-shared-textrel"
40  "-Wl,--gc-sections"
41  "-nostdlib"
42  "-Bdynamic"
43  "-Wl,-dynamic-linker,/system/bin/linker"
44  "-Wl,-z,nocopyreloc"
45  "-fPIE"
46  "-pie"
47  "-L${OUT}/obj/lib"
48  "-Wl,-rpath-link=${OUT}/obj/lib"
49  "-Wl,--whole-archive"
50  "-Wl,--no-whole-archive"
51  "-lc"
52  "-lstdc++"
53  "-lm"
54  "-Wl,--no-undefined"
55  "-ldl"
56)
57
58eval ./configure CC=\"${cc} ${includes[@]}\" \
59                 CPP=\"${cc} ${includes[@]} -E\" \
60                 CXX=\"${cpp} ${includes[@]}\" \
61                 CXXCPP=\"${cpp} ${includes[@]} -E\" \
62                 LDFLAGS=\"${ldflags[@]}\" \
63                 --host=i386
64