aboutsummaryrefslogtreecommitdiffstats
path: root/androidconfigure
blob: 16bea199dabfff2687ed6ffba54f7f995721b1ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash

set -e

if [[ "${TARGET_PRODUCT}" != "aosp_arm" ]]; then
  # Some of the include paths below assume that this is an arm 32bit configure
  # run.
  echo "Run 'lunch aosp_arm-eng' and build the current version first." >&2
  exit 1
fi

cd $(dirname "$0")

HOST="arm-linux-androideabi"
T="${ANDROID_BUILD_TOP}"
export CC="${T}/prebuilts/clang/host/linux-x86/clang-r399163/bin/clang"
export LD="${T}/prebuilts/clang/host/linux-x86/clang-r399163/bin/lld"

CFLAGS=(
  "-isystem ${T}/external/libcxx/include"
  "-isystem ${T}/bionic/libc/include/"
  "-isystem ${T}/bionic/libc/arch-arm/include"
  "-isystem ${T}/bionic/libc/kernel/uapi/"
  "-isystem ${T}/bionic/libc/kernel/android/uapi/"
  "-isystem ${T}/bionic/libm/include"
  "-fno-exceptions"
  "-ffunction-sections"
  "-fdata-sections"
  "-fstack-protector"
  "-fno-short-enums"
  "-no-canonical-prefixes"
  "-fmessage-length=0"
  "-fomit-frame-pointer"
  "-fPIC"
  "-fno-strict-aliasing"
  "-nostdlib"
)
CFLAGS="${CFLAGS[@]}"

CONFIGURE_ARGS=(
  --host="${HOST}"
  CFLAGS="${CFLAGS}"
  LIBS="-lc"
  CPPFLAGS="${CFLAGS} -I${T}/external/zlib/src"
  LDFLAGS="-L${ANDROID_PRODUCT_OUT}/system/lib/"

  # Disable NTLM delegation to winbind's ntlm_auth.
  --disable-ntlm-wb

  ### Disable many protocols unused in Android systems:
  --disable-telnet
  --disable-tftp
  --disable-smb
  --disable-gopher

  # Disable FTP and FTPS support.
  --disable-ftp

  # Disable LDAP and LDAPS support.
  --disable-ldap
  --disable-ldaps

  # Disable mail protocols (IMAP, POP3).
  --disable-pop3
  --disable-imap
  --disable-smtp

  # Disable RTSP support (RFC 2326 / 7826).
  --disable-rtsp

  # Disable DICT support (RFC 2229).
  --disable-dict


  ### Enable HTTP and FILE explicitly. These are enabled by default but
  # listed here as documentation.
  --enable-http
  --enable-file
  --enable-proxy

  # Enabled IPv6.
  --enable-ipv6

  --with-ssl="${T}/external/boringssl"
  --with-zlib
  --with-ca-path="/system/etc/security/cacerts"
)

# Show the commands on the terminal.
set -x

./buildconf
./configure "${CONFIGURE_ARGS[@]}"

# Apply local changes to the default configure output.
patch -p1 --no-backup-if-mismatch < local-configure.patch