Bertrand SIMONNET | 92c9b18 | 2015-07-01 18:24:39 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Alex Deymo | 234096a | 2016-06-28 16:26:00 -0700 | [diff] [blame] | 3 | set -e |
| 4 | |
| 5 | if [[ "${TARGET_PRODUCT}" != "aosp_arm" ]]; then |
| 6 | # Some of the include paths below assume that this is an arm 32bit configure |
| 7 | # run. |
Alex Deymo | 1624682 | 2017-11-28 14:10:40 +0100 | [diff] [blame] | 8 | echo "Run 'lunch aosp_arm-eng' and build the current version first." >&2 |
Alex Deymo | 234096a | 2016-06-28 16:26:00 -0700 | [diff] [blame] | 9 | exit 1 |
| 10 | fi |
| 11 | |
| 12 | cd $(dirname "$0") |
| 13 | |
Alex Deymo | 1624682 | 2017-11-28 14:10:40 +0100 | [diff] [blame] | 14 | HOST="arm-linux-androideabi" |
Bertrand SIMONNET | 92c9b18 | 2015-07-01 18:24:39 -0700 | [diff] [blame] | 15 | T="${ANDROID_BUILD_TOP}" |
Pirama Arumuga Nainar | 7519f99 | 2021-10-27 17:19:18 -0700 | [diff] [blame] | 16 | CLANG_VERSION="$(exec ${T}/build/soong/scripts/get_clang_version.py)" |
| 17 | export CC="${T}/prebuilts/clang/host/linux-x86/${CLANG_VERSION}/bin/clang" |
| 18 | export LD="${T}/prebuilts/clang/host/linux-x86/${CLANG_VERSION}/bin/lld" |
Haibo Huang | 21926d5 | 2019-01-08 14:27:10 -0800 | [diff] [blame] | 19 | |
Bertrand SIMONNET | 92c9b18 | 2015-07-01 18:24:39 -0700 | [diff] [blame] | 20 | CFLAGS=( |
| 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/" |
Haibo Huang | 21926d5 | 2019-01-08 14:27:10 -0800 | [diff] [blame] | 25 | "-isystem ${T}/bionic/libc/kernel/android/uapi/" |
Bertrand SIMONNET | 92c9b18 | 2015-07-01 18:24:39 -0700 | [diff] [blame] | 26 | "-isystem ${T}/bionic/libm/include" |
Bertrand SIMONNET | 92c9b18 | 2015-07-01 18:24:39 -0700 | [diff] [blame] | 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 | ) |
Alex Deymo | 1624682 | 2017-11-28 14:10:40 +0100 | [diff] [blame] | 39 | CFLAGS="${CFLAGS[@]}" |
| 40 | |
| 41 | CONFIGURE_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 | |
Alex Deymo | 251844e | 2017-12-19 14:16:42 +0100 | [diff] [blame] | 57 | # Disable FTP and FTPS support. |
| 58 | --disable-ftp |
| 59 | |
Alex Deymo | 1624682 | 2017-11-28 14:10:40 +0100 | [diff] [blame] | 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 | |
Alex Deymo | 54ee1ae | 2018-05-14 11:36:37 +0200 | [diff] [blame] | 76 | ### Enable HTTP and FILE explicitly. These are enabled by default but |
Alex Deymo | 1624682 | 2017-11-28 14:10:40 +0100 | [diff] [blame] | 77 | # listed here as documentation. |
| 78 | --enable-http |
Alex Deymo | 1624682 | 2017-11-28 14:10:40 +0100 | [diff] [blame] | 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. |
| 91 | set -x |
Bertrand SIMONNET | 92c9b18 | 2015-07-01 18:24:39 -0700 | [diff] [blame] | 92 | |
Bertrand SIMONNET | 92c9b18 | 2015-07-01 18:24:39 -0700 | [diff] [blame] | 93 | ./buildconf |
Alex Deymo | 1624682 | 2017-11-28 14:10:40 +0100 | [diff] [blame] | 94 | ./configure "${CONFIGURE_ARGS[@]}" |
Bertrand SIMONNET | 92c9b18 | 2015-07-01 18:24:39 -0700 | [diff] [blame] | 95 | |
Alex Deymo | 234096a | 2016-06-28 16:26:00 -0700 | [diff] [blame] | 96 | # Apply local changes to the default configure output. |
| 97 | patch -p1 --no-backup-if-mismatch < local-configure.patch |