blob: 16bea199dabfff2687ed6ffba54f7f995721b1ea [file] [log] [blame]
Bertrand SIMONNET92c9b182015-07-01 18:24:39 -07001#!/bin/bash
2
Alex Deymo234096a2016-06-28 16:26:00 -07003set -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.
Alex Deymo16246822017-11-28 14:10:40 +01008 echo "Run 'lunch aosp_arm-eng' and build the current version first." >&2
Alex Deymo234096a2016-06-28 16:26:00 -07009 exit 1
10fi
11
12cd $(dirname "$0")
13
Alex Deymo16246822017-11-28 14:10:40 +010014HOST="arm-linux-androideabi"
Bertrand SIMONNET92c9b182015-07-01 18:24:39 -070015T="${ANDROID_BUILD_TOP}"
Haibo Huangc3c04f42020-08-19 13:00:07 -070016export CC="${T}/prebuilts/clang/host/linux-x86/clang-r399163/bin/clang"
17export LD="${T}/prebuilts/clang/host/linux-x86/clang-r399163/bin/lld"
Haibo Huang21926d52019-01-08 14:27:10 -080018
Bertrand SIMONNET92c9b182015-07-01 18:24:39 -070019CFLAGS=(
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/uapi/"
Haibo Huang21926d52019-01-08 14:27:10 -080024 "-isystem ${T}/bionic/libc/kernel/android/uapi/"
Bertrand SIMONNET92c9b182015-07-01 18:24:39 -070025 "-isystem ${T}/bionic/libm/include"
Bertrand SIMONNET92c9b182015-07-01 18:24:39 -070026 "-fno-exceptions"
27 "-ffunction-sections"
28 "-fdata-sections"
29 "-fstack-protector"
30 "-fno-short-enums"
31 "-no-canonical-prefixes"
32 "-fmessage-length=0"
33 "-fomit-frame-pointer"
34 "-fPIC"
35 "-fno-strict-aliasing"
36 "-nostdlib"
37)
Alex Deymo16246822017-11-28 14:10:40 +010038CFLAGS="${CFLAGS[@]}"
39
40CONFIGURE_ARGS=(
41 --host="${HOST}"
42 CFLAGS="${CFLAGS}"
43 LIBS="-lc"
44 CPPFLAGS="${CFLAGS} -I${T}/external/zlib/src"
45 LDFLAGS="-L${ANDROID_PRODUCT_OUT}/system/lib/"
46
47 # Disable NTLM delegation to winbind's ntlm_auth.
48 --disable-ntlm-wb
49
50 ### Disable many protocols unused in Android systems:
51 --disable-telnet
52 --disable-tftp
53 --disable-smb
54 --disable-gopher
55
Alex Deymo251844e2017-12-19 14:16:42 +010056 # Disable FTP and FTPS support.
57 --disable-ftp
58
Alex Deymo16246822017-11-28 14:10:40 +010059 # Disable LDAP and LDAPS support.
60 --disable-ldap
61 --disable-ldaps
62
63 # Disable mail protocols (IMAP, POP3).
64 --disable-pop3
65 --disable-imap
66 --disable-smtp
67
68 # Disable RTSP support (RFC 2326 / 7826).
69 --disable-rtsp
70
71 # Disable DICT support (RFC 2229).
72 --disable-dict
73
74
Alex Deymo54ee1ae2018-05-14 11:36:37 +020075 ### Enable HTTP and FILE explicitly. These are enabled by default but
Alex Deymo16246822017-11-28 14:10:40 +010076 # listed here as documentation.
77 --enable-http
Alex Deymo16246822017-11-28 14:10:40 +010078 --enable-file
79 --enable-proxy
80
81 # Enabled IPv6.
82 --enable-ipv6
83
84 --with-ssl="${T}/external/boringssl"
85 --with-zlib
86 --with-ca-path="/system/etc/security/cacerts"
87)
88
89# Show the commands on the terminal.
90set -x
Bertrand SIMONNET92c9b182015-07-01 18:24:39 -070091
Bertrand SIMONNET92c9b182015-07-01 18:24:39 -070092./buildconf
Alex Deymo16246822017-11-28 14:10:40 +010093./configure "${CONFIGURE_ARGS[@]}"
Bertrand SIMONNET92c9b182015-07-01 18:24:39 -070094
Alex Deymo234096a2016-06-28 16:26:00 -070095# Apply local changes to the default configure output.
96patch -p1 --no-backup-if-mismatch < local-configure.patch