1#!/bin/bash 2 3set -e 4 5if [[ "${TARGET_PRODUCT}" != "aosp_arm" ]]; then 6 # Some of the include paths below assume that this is an arm 32bit configure 7 # run. 8 echo "Run 'lunch aosp_arm-eng' and build the current version first." >&2 9 exit 1 10fi 11 12cd $(dirname "$0") 13 14HOST="arm-linux-androideabi" 15export CC="${ANDROID_TOOLCHAIN}/${HOST}-gcc" 16export LD="${ANDROID_TOOLCHAIN}/${HOST}-ld" 17 18T="${ANDROID_BUILD_TOP}" 19CFLAGS=( 20 "-isystem ${T}/external/libcxx/include" 21 "-isystem ${T}/bionic/libc/include/" 22 "-isystem ${T}/bionic/libc/arch-arm/include" 23 "-isystem ${T}/bionic/libc/kernel/android/uapi/" 24 "-isystem ${T}/bionic/libc/kernel/uapi/" 25 "-isystem ${T}/bionic/libc/kernel/uapi/asm-arm/" 26 "-isystem ${T}/bionic/libm/include" 27 "-isystem ${T}/build/core/combo/include/arch/linux-arm/" 28 "-fno-exceptions" 29 "-ffunction-sections" 30 "-fdata-sections" 31 "-fstack-protector" 32 "-fno-short-enums" 33 "-no-canonical-prefixes" 34 "-fmessage-length=0" 35 "-fomit-frame-pointer" 36 "-fPIC" 37 "-fno-strict-aliasing" 38 "-nostdlib" 39) 40CFLAGS="${CFLAGS[@]}" 41 42CONFIGURE_ARGS=( 43 --host="${HOST}" 44 CFLAGS="${CFLAGS}" 45 LIBS="-lc" 46 CPPFLAGS="${CFLAGS} -I${T}/external/zlib/src" 47 LDFLAGS="-L${ANDROID_PRODUCT_OUT}/system/lib/" 48 49 # Disable NTLM delegation to winbind's ntlm_auth. 50 --disable-ntlm-wb 51 52 ### Disable many protocols unused in Android systems: 53 --disable-telnet 54 --disable-tftp 55 --disable-smb 56 --disable-gopher 57 58 # Disable FTP and FTPS support. 59 --disable-ftp 60 61 # Disable LDAP and LDAPS support. 62 --disable-ldap 63 --disable-ldaps 64 65 # Disable mail protocols (IMAP, POP3). 66 --disable-pop3 67 --disable-imap 68 --disable-smtp 69 70 # Disable RTSP support (RFC 2326 / 7826). 71 --disable-rtsp 72 73 # Disable DICT support (RFC 2229). 74 --disable-dict 75 76 77 ### Enable HTTP, FTP and FILE explicitly. These are enabled by default but 78 # listed here as documentation. 79 --enable-http 80 --enable-file 81 --enable-proxy 82 83 # Enabled IPv6. 84 --enable-ipv6 85 86 --with-ssl="${T}/external/boringssl" 87 --with-zlib 88 --with-ca-path="/system/etc/security/cacerts" 89) 90 91# Show the commands on the terminal. 92set -x 93 94./buildconf 95./configure "${CONFIGURE_ARGS[@]}" 96 97# Apply local changes to the default configure output. 98patch -p1 --no-backup-if-mismatch < local-configure.patch 99