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" 15T="${ANDROID_BUILD_TOP}" 16CLANG_VERSION="$(exec ${T}/build/soong/scripts/get_clang_version.py)" 17export CC="${T}/prebuilts/clang/host/linux-x86/${CLANG_VERSION}/bin/clang" 18export LD="${T}/prebuilts/clang/host/linux-x86/${CLANG_VERSION}/bin/lld" 19 20CFLAGS=( 21 "-isystem ${T}/external/libcxx/include" 22 "-isystem ${T}/bionic/libc/include/" 23 "-isystem ${T}/bionic/libc/arch-arm/include" 24 "-isystem ${T}/bionic/libc/kernel/uapi/" 25 "-isystem ${T}/bionic/libc/kernel/android/uapi/" 26 "-isystem ${T}/bionic/libm/include" 27 "-fno-exceptions" 28 "-ffunction-sections" 29 "-fdata-sections" 30 "-fstack-protector" 31 "-fno-short-enums" 32 "-no-canonical-prefixes" 33 "-fmessage-length=0" 34 "-fomit-frame-pointer" 35 "-fPIC" 36 "-fno-strict-aliasing" 37 "-nostdlib" 38) 39CFLAGS="${CFLAGS[@]}" 40 41CONFIGURE_ARGS=( 42 --host="${HOST}" 43 CFLAGS="${CFLAGS}" 44 LIBS="-lc" 45 CPPFLAGS="${CFLAGS} -I${T}/external/zlib/src" 46 LDFLAGS="-L${ANDROID_PRODUCT_OUT}/system/lib/" 47 48 # Disable NTLM delegation to winbind's ntlm_auth. 49 --disable-ntlm-wb 50 51 ### Disable many protocols unused in Android systems: 52 --disable-telnet 53 --disable-tftp 54 --disable-smb 55 --disable-gopher 56 57 # Disable FTP and FTPS support. 58 --disable-ftp 59 60 # Disable LDAP and LDAPS support. 61 --disable-ldap 62 --disable-ldaps 63 64 # Disable mail protocols (IMAP, POP3). 65 --disable-pop3 66 --disable-imap 67 --disable-smtp 68 69 # Disable RTSP support (RFC 2326 / 7826). 70 --disable-rtsp 71 72 # Disable DICT support (RFC 2229). 73 --disable-dict 74 75 76 ### Enable HTTP and FILE explicitly. These are enabled by default but 77 # listed here as documentation. 78 --enable-http 79 --enable-file 80 --enable-proxy 81 82 # Enabled IPv6. 83 --enable-ipv6 84 85 --with-ssl="${T}/external/boringssl" 86 --with-zlib 87 --with-ca-path="/system/etc/security/cacerts" 88) 89 90# Show the commands on the terminal. 91set -x 92 93./buildconf 94./configure "${CONFIGURE_ARGS[@]}" 95 96# Apply local changes to the default configure output. 97patch -p1 --no-backup-if-mismatch < local-configure.patch 98