aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Deymo <deymo@google.com>2017-11-28 14:10:40 +0100
committerAlex Deymo <deymo@google.com>2017-11-28 22:06:16 +0100
commit1624682957c213f4a2493ae621b68cfa847c90a3 (patch)
tree446779a1538d4c5a4ac4590d142ed9377dad8710
parentd8a68223b1c4e6364984b86601e5d06af8a141f7 (diff)
downloadandroid_external_curl-1624682957c213f4a2493ae621b68cfa847c90a3.tar.gz
android_external_curl-1624682957c213f4a2493ae621b68cfa847c90a3.tar.bz2
android_external_curl-1624682957c213f4a2493ae621b68cfa847c90a3.zip
Disable lots of unused protocols and rerun androidconfigure.
These less used protocol that we don't need will often contain bugs we don't want. Stop compiling them. Rearranged the ./configure args into an array to allow documenation of the comments and udpated the path to the lib/ directory to make ./configure happy. Updated the local-configure.patch to reflect changes in the curl_config.h file. Several types are now unused so the patch is different. We still remove those from the curl_configure.h file even if they are just "#undef" comments to conflict (and fail androidconfigure command) if somebody ever needs them in the future. These values are defined in the Android.mk instead. The ./androidconfigure command now shows: Protocols: FILE FTP FTPS HTTP HTTPS Bug: 69830574 Test: mmma external/libcurl; Inspected curl_config.h changes. Change-Id: If9f4ce09ef54e9ba82fd725ab11224a92d794535
-rwxr-xr-xandroidconfigure71
-rw-r--r--lib/curl_config.h43
-rw-r--r--local-configure.patch67
3 files changed, 120 insertions, 61 deletions
diff --git a/androidconfigure b/androidconfigure
index d9f25f4..f807e96 100755
--- a/androidconfigure
+++ b/androidconfigure
@@ -5,14 +5,15 @@ 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' first." >&2
+ echo "Run 'lunch aosp_arm-eng' and build the current version first." >&2
exit 1
fi
cd $(dirname "$0")
-export CC="$(ls "${ANDROID_TOOLCHAIN}" | grep "\-gcc$" | grep -v kernel)"
-export LD="$(ls "${ANDROID_TOOLCHAIN}" | grep "\-ld$" | grep -v kernel)"
+HOST="arm-linux-androideabi"
+export CC="${ANDROID_TOOLCHAIN}/${HOST}-gcc"
+export LD="${ANDROID_TOOLCHAIN}/${HOST}-ld"
T="${ANDROID_BUILD_TOP}"
CFLAGS=(
@@ -36,20 +37,60 @@ CFLAGS=(
"-fno-strict-aliasing"
"-nostdlib"
)
-
-./buildconf
CFLAGS="${CFLAGS[@]}"
-./configure \
- --host=arm-linux-androideabi \
- CFLAGS="${CFLAGS}" \
- LIBS="-lc" \
- CPPFLAGS="${CFLAGS} -I${T}/external/zlib/src" \
- LDFLAGS="-L${ANDROID_PRODUCT_OUT}/obj/lib/" \
- --disable-ntlm-wb \
- --enable-ipv6 \
- --with-ssl="${T}/external/boringssl" \
- --with-zlib \
+
+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 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, FTP and FILE explicitly. These are enabled by default but
+ # listed here as documentation.
+ --enable-http
+ --enable-ftp
+ --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
diff --git a/lib/curl_config.h b/lib/curl_config.h
index bd0b5c7..6ba8fac 100644
--- a/lib/curl_config.h
+++ b/lib/curl_config.h
@@ -17,7 +17,7 @@
/* #undef CURL_DISABLE_CRYPTO_AUTH */
/* to disable DICT */
-/* #undef CURL_DISABLE_DICT */
+#define CURL_DISABLE_DICT 1
/* to disable FILE */
/* #undef CURL_DISABLE_FILE */
@@ -26,13 +26,13 @@
/* #undef CURL_DISABLE_FTP */
/* to disable Gopher */
-/* #undef CURL_DISABLE_GOPHER */
+#define CURL_DISABLE_GOPHER 1
/* to disable HTTP */
/* #undef CURL_DISABLE_HTTP */
/* to disable IMAP */
-/* #undef CURL_DISABLE_IMAP */
+#define CURL_DISABLE_IMAP 1
/* to disable LDAP */
#define CURL_DISABLE_LDAP 1
@@ -44,25 +44,25 @@
/* #undef CURL_DISABLE_LIBCURL_OPTION */
/* to disable POP3 */
-/* #undef CURL_DISABLE_POP3 */
+#define CURL_DISABLE_POP3 1
/* to disable proxies */
/* #undef CURL_DISABLE_PROXY */
/* to disable RTSP */
-/* #undef CURL_DISABLE_RTSP */
+#define CURL_DISABLE_RTSP 1
/* to disable SMB/CIFS */
-/* #undef CURL_DISABLE_SMB */
+#define CURL_DISABLE_SMB 1
/* to disable SMTP */
-/* #undef CURL_DISABLE_SMTP */
+#define CURL_DISABLE_SMTP 1
/* to disable TELNET */
-/* #undef CURL_DISABLE_TELNET */
+#define CURL_DISABLE_TELNET 1
/* to disable TFTP */
-/* #undef CURL_DISABLE_TFTP */
+#define CURL_DISABLE_TFTP 1
/* to disable TLS-SRP authentication */
/* #undef CURL_DISABLE_TLS_SRP */
@@ -129,6 +129,7 @@
/* Define to 1 if you have the clock_gettime function and monotonic timer. */
#if !defined(__APPLE__)
+/* CLOCK_MONOTONIC is not defined in mac when building for the host. */
#define HAVE_CLOCK_GETTIME_MONOTONIC 1
#endif
@@ -378,7 +379,7 @@
/* #undef HAVE_LDAP_INIT_FD */
/* Use LDAPS implementation */
-#define HAVE_LDAP_SSL 1
+/* #undef HAVE_LDAP_SSL */
/* Define to 1 if you have the ldap_ssl.h header file. */
/* #undef HAVE_LDAP_SSL_H */
@@ -548,7 +549,7 @@
/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */
/* Define to 1 if you have the <sgtty.h> header file. */
-#define HAVE_SGTTY_H 1
+/* #undef HAVE_SGTTY_H */
/* Define to 1 if you have the sigaction function. */
#define HAVE_SIGACTION 1
@@ -692,7 +693,7 @@
#define HAVE_SYS_UN_H 1
/* Define to 1 if you have the <sys/utime.h> header file. */
-#define HAVE_SYS_UTIME_H 1
+/* #undef HAVE_SYS_UTIME_H */
/* Define to 1 if you have the <sys/wait.h> header file. */
#define HAVE_SYS_WAIT_H 1
@@ -871,27 +872,9 @@
/* The size of `int', as computed by sizeof. */
#define SIZEOF_INT 4
-/* The size of `long', as computed by sizeof. */
-/* #undef SIZEOF_LONG */
-
-/* The size of `long long', as computed by sizeof. */
-/* #undef SIZEOF_LONG_LONG */
-
-/* The size of `off_t', as computed by sizeof. */
-#define SIZEOF_OFF_T 8
-
/* The size of `short', as computed by sizeof. */
#define SIZEOF_SHORT 2
-/* The size of `size_t', as computed by sizeof. */
-/* #undef SIZEOF_SIZE_T */
-
-/* The size of `time_t', as computed by sizeof. */
-/* #undef SIZEOF_TIME_T */
-
-/* The size of `void*', as computed by sizeof. */
-/* #undef SIZEOF_VOIDP */
-
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
diff --git a/local-configure.patch b/local-configure.patch
index b3444fe..25bb3c4 100644
--- a/local-configure.patch
+++ b/local-configure.patch
@@ -1,57 +1,92 @@
diff --git a/lib/curl_config.h b/lib/curl_config.h
-index d3d74dc..526bcf7 100644
+index 273593ba6..6ba8faca3 100644
--- a/lib/curl_config.h
+++ b/lib/curl_config.h
@@ -128,7 +128,10 @@
#define HAVE_BORINGSSL 1
/* Define to 1 if you have the clock_gettime function and monotonic timer. */
-+#ifndef __APPLE__
++#if !defined(__APPLE__)
+/* CLOCK_MONOTONIC is not defined in mac when building for the host. */
#define HAVE_CLOCK_GETTIME_MONOTONIC 1
+#endif
/* Define to 1 if you have the closesocket function. */
/* #undef HAVE_CLOSESOCKET */
-@@ -442,10 +445,14 @@
+@@ -430,10 +433,14 @@
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the memrchr function or macro. */
-+#ifndef __APPLE__
++#if !defined(__APPLE__)
#define HAVE_MEMRCHR 1
+#endif
/* Define to 1 if you have the MSG_NOSIGNAL flag. */
-+#ifndef __APPLE__
++#if !defined(__APPLE__)
#define HAVE_MSG_NOSIGNAL 1
+#endif
/* Define to 1 if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1
-@@ -858,7 +865,7 @@
+@@ -787,9 +794,6 @@
+ /* Define absolute filename for winbind's ntlm_auth helper. */
+ /* #undef NTLM_WB_FILE */
+
+-/* cpu-machine-OS */
+-#define OS "arm-unknown-linux-androideabi"
+-
+ /* Name of package */
+ #define PACKAGE "curl"
+
+@@ -827,7 +831,7 @@
+ #define RECV_TYPE_ARG4 int
+
+ /* Define to the function return type for recv. */
+-#define RECV_TYPE_RETV int
++#define RECV_TYPE_RETV ssize_t
+
+ /* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
+@@ -845,7 +849,7 @@
+ #define SELECT_TYPE_ARG5 struct timeval *
+
+ /* Define to the function return type for select. */
+-#define SELECT_TYPE_RETV int
++#define SELECT_TYPE_RETV ssize_t
- /* Define to the type qualifier of arg 5 for select. */
--#define SELECT_QUAL_ARG5
-+#define SELECT_QUAL_ARG5
+ /* Define to the type qualifier of arg 2 for send. */
+ #define SEND_QUAL_ARG2 const
+@@ -863,32 +867,14 @@
+ #define SEND_TYPE_ARG4 int
- /* Define to the type of arg 1 for select. */
- #define SELECT_TYPE_ARG1 int
-@@ -890,18 +897,9 @@
/* Define to the function return type for send. */
- #define SEND_TYPE_RETV int
+-#define SEND_TYPE_RETV int
++#define SEND_TYPE_RETV ssize_t
+
+ /* The size of `int', as computed by sizeof. */
+ #define SIZEOF_INT 4
-/* The size of `long', as computed by sizeof. */
-#define SIZEOF_LONG 4
-
- /* The size of `long long', as computed by sizeof. */
- /* #undef SIZEOF_LONG_LONG */
-
+-/* The size of `long long', as computed by sizeof. */
+-/* #undef SIZEOF_LONG_LONG */
+-
-/* The size of `off_t', as computed by sizeof. */
-#define SIZEOF_OFF_T 8
-
+ /* The size of `short', as computed by sizeof. */
+ #define SIZEOF_SHORT 2
+
+-/* The size of `size_t', as computed by sizeof. */
+-#define SIZEOF_SIZE_T 4
+-
+-/* The size of `time_t', as computed by sizeof. */
+-#define SIZEOF_TIME_T 4
+-
-/* The size of `void*', as computed by sizeof. */
-#define SIZEOF_VOIDP 4
-
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
+