• 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}/mipsel-linux-android-gcc"
10cpp="${ANDROID_TOOLCHAIN}/mipsel-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-mips/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-mips"
29  "-isystem ${ANDROID_BUILD_TOP}/bionic/libm/include"
30  "-isystem ${ANDROID_BUILD_TOP}/bionic/libm/include/mips"
31  "-isystem ${ANDROID_BUILD_TOP}/bionic/libthread_db/include"
32)
33
34ldflags=(
35  "-nostdlib"
36  "-Bdynamic"
37  "-fPIE"
38  "-pie"
39  "-Wl,-dynamic-linker,/system/bin/linker"
40  "-Wl,--gc-sections"
41  "-Wl,-z,nocopyreloc"
42  "-L${OUT}/obj/lib"
43  "-Wl,-rpath-link=${OUT}/obj/lib"
44  "-Wl,--whole-archive"
45  "-Wl,--no-whole-archive"
46  "-lc"
47  "-lstdc++"
48  "-lm"
49  "-Wl,-z,noexecstack"
50  "-Wl,-z,relro"
51  "-Wl,-z,now"
52  "-Wl,--warn-shared-textrel"
53  "-EL"
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=mips
64