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 12T="${ANDROID_BUILD_TOP}" 13cd $(dirname "$0") 14 15# Build all the dependencies we'll need, so we can find them under 16# /system/lib in the out directory. 17source ${T}/build/envsetup.sh 18mm 19 20HOST="arm-linux-androideabi" 21CLANG_VERSION="$(exec ${T}/build/soong/scripts/get_clang_version.py)" 22export CC="${T}/prebuilts/clang/host/linux-x86/${CLANG_VERSION}/bin/clang" 23export LD="${T}/prebuilts/clang/host/linux-x86/${CLANG_VERSION}/bin/lld" 24 25CFLAGS=( 26 # We don't have an NDK sysroot prebuilt in AOSP, so we'll have use 27 # soong's. 28 "--sysroot ${T}/out/soong/ndk/sysroot/" 29 # We also need zlib. (We don't have to do anything for boringssl here, 30 # because we provide that path directly on the configure command line.) 31 "-I${T}/external/zlib/" 32 # We don't have target-specific clang binaries like the NDK, so provide 33 # a target. The "34" here is arbitrary. 34 "--target=armv7a-linux-androideabi34" 35) 36CFLAGS="${CFLAGS[@]}" 37 38LDFLAGS=( 39 # We need the device zlib and openssl/boringssl libraries, so tell ld 40 # where they are. 41 "-L${ANDROID_PRODUCT_OUT}/system/lib/" 42) 43LDFLAGS="${LDFLAGS[@]}" 44 45CONFIGURE_ARGS=( 46 --host="${HOST}" 47 CFLAGS="${CFLAGS}" 48 CPPFLAGS="${CFLAGS}" 49 LDFLAGS="${LDFLAGS}" 50 51 # Disable NTLM delegation to winbind's ntlm_auth. 52 --disable-ntlm-wb 53 54 ### Disable many protocols unused in Android systems: 55 --disable-telnet 56 --disable-tftp 57 --disable-smb 58 --disable-gopher 59 60 # Disable FTP and FTPS support. 61 --disable-ftp 62 63 # Disable LDAP and LDAPS support. 64 --disable-ldap 65 --disable-ldaps 66 67 # Disable mail protocols (IMAP, POP3). 68 --disable-pop3 69 --disable-imap 70 --disable-smtp 71 72 # Disable RTSP support (RFC 2326 / 7826). 73 --disable-rtsp 74 75 # Disable DICT support (RFC 2229). 76 --disable-dict 77 78 ### Enable HTTP and FILE explicitly. These are enabled by default but 79 # listed here as documentation. 80 --enable-http 81 --enable-file 82 --enable-proxy 83 84 # Enabled IPv6. 85 --enable-ipv6 86 87 --with-ssl="${T}/external/boringssl" 88 --with-zlib 89 --with-ca-path="/system/etc/security/cacerts" 90) 91 92# Show the commands on the terminal. 93set -x 94 95./buildconf 96./configure "${CONFIGURE_ARGS[@]}" 97 98# Apply local changes to the default configure output. 99patch -p1 --no-backup-if-mismatch < local-configure.patch 100