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