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 9arm_cc="${ANDROID_TOOLCHAIN}/arm-linux-androideabi-gcc" 10arm_cpp="${ANDROID_TOOLCHAIN}/arm-linux-androideabi-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-arm/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-arm" 29 "-isystem ${ANDROID_BUILD_TOP}/bionic/libm/include" 30 "-isystem ${ANDROID_BUILD_TOP}/bionic/libm/include/arm" 31 "-isystem ${ANDROID_BUILD_TOP}/bionic/libthread_db/include" 32 "-include ${ANDROID_BUILD_TOP}/build/core/combo/include/arch/linux-arm/AndroidConfig.h" 33 "-I ${ANDROID_BUILD_TOP}/build/core/combo/include/arch/linux-arm/" 34) 35 36ldflags=( 37 "-nostdlib" 38 "-Bdynamic" 39 "-fPIE" 40 "-pie" 41 "-Wl,-dynamic-linker,/system/bin/linker" 42 "-Wl,--gc-sections" 43 "-Wl,-z,nocopyreloc" 44 "-L${OUT}/obj/lib" 45 "-Wl,-rpath-link=${OUT}/obj/lib" 46 "-Wl,--whole-archive" 47 "-Wl,--no-whole-archive" 48 "-lc" 49 "-lstdc++" 50 "-lm" 51 "-Wl,-z,noexecstack" 52 "-Wl,-z,relro" 53 "-Wl,-z,now" 54 "-Wl,--warn-shared-textrel" 55 "-Wl,--fatal-warnings" 56 "-Wl,--icf=safe" 57 "-Wl,--no-undefined" 58 "-ldl" 59) 60 61eval ./configure CC=\"${arm_cc} ${includes[@]}\" \ 62 CPP=\"${arm_cc} ${includes[@]} -E\" \ 63 CXX=\"${arm_cpp} ${includes[@]}\" \ 64 CXXCPP=\"${arm_cpp} ${includes[@]} -E\" \ 65 LDFLAGS=\"${ldflags[@]}\" \ 66 --host=arm 67