blob: e8e15f5483b61370ea8dddf3b2346b5a07fa4898 [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}"
Pirama Arumuga Nainar7519f992021-10-27 17:19:18 -070016CLANG_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"
Haibo Huang21926d52019-01-08 14:27:10 -080019
Bertrand SIMONNET92c9b182015-07-01 18:24:39 -070020CFLAGS=(
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 Huang21926d52019-01-08 14:27:10 -080025 "-isystem ${T}/bionic/libc/kernel/android/uapi/"
Bertrand SIMONNET92c9b182015-07-01 18:24:39 -070026 "-isystem ${T}/bionic/libm/include"
Bertrand SIMONNET92c9b182015-07-01 18:24:39 -070027 "-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 Deymo16246822017-11-28 14:10:40 +010039CFLAGS="${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
Alex Deymo251844e2017-12-19 14:16:42 +010057 # Disable FTP and FTPS support.
58 --disable-ftp
59
Alex Deymo16246822017-11-28 14:10:40 +010060 # 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 Deymo54ee1ae2018-05-14 11:36:37 +020076 ### Enable HTTP and FILE explicitly. These are enabled by default but
Alex Deymo16246822017-11-28 14:10:40 +010077 # listed here as documentation.
78 --enable-http
Alex Deymo16246822017-11-28 14:10:40 +010079 --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
Bertrand SIMONNET92c9b182015-07-01 18:24:39 -070092
Bertrand SIMONNET92c9b182015-07-01 18:24:39 -070093./buildconf
Alex Deymo16246822017-11-28 14:10:40 +010094./configure "${CONFIGURE_ARGS[@]}"
Bertrand SIMONNET92c9b182015-07-01 18:24:39 -070095
Alex Deymo234096a2016-06-28 16:26:00 -070096# Apply local changes to the default configure output.
97patch -p1 --no-backup-if-mismatch < local-configure.patch