package/libcurl: introduce a 'small' config option
PATCH 1/1 package/libcurl: introduce a 'small' config option
From: Thomas De Schampheleire <[email protected]>
Libcurl is more than 250 KiB in size. About 50 KiB of this can be saved by disabling features/protocols that are not commonly needed.
Other packages that are selecting libcurl could be incompatible with this 'small' mode. But, there is no clear way to find out which packages are in this situation, in particular because issues may only be visible at runtime.
--- package/libcurl/Config.in | 19 +++++++++++++++++++ package/libcurl/libcurl.mk | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+)
To check the impact on other packages, I made a build with as much packages enabled that select libcurl, and with the 'small' option enabled as well. There were no compilation failures.
Defconfig used for this test:
BR2_arm=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_ROOTFS_MERGED_USR=y
BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
BR2_SYSTEM_DHCP="eth0"
BR2_TARGET_TZ_INFO=y
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.16.7" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/arm-versatile/linux.config" BR2_LINUX_KERNEL_DTS_SUPPORT=y BR2_LINUX_KERNEL_INTREE_DTS_NAME="versatile-pb" BR2_PACKAGE_GSTREAMER=y
BR2_PACKAGE_GST_PLUGINS_BAD=y BR2_PACKAGE_GST_PLUGINS_BAD_PLUGIN_CURL=y BR2_PACKAGE_GSTREAMER1=y
BR2_PACKAGE_GST1_PLUGINS_BAD=y BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_CURL=y BR2_PACKAGE_VORBIS_TOOLS=y
BR2_PACKAGE_LZ4=y
BR2_PACKAGE_SYSDIG=y
BR2_PACKAGE_CMAKE_CTEST=y
BR2_PACKAGE_CURLFTPFS=y
BR2_PACKAGE_PHP=y
BR2_PACKAGE_PHP_EXT_CURL=y
BR2_PACKAGE_LIBGCRYPT=y
BR2_PACKAGE_LIBXMLRPC=y
BR2_PACKAGE_AZURE_IOT_SDK_C=y
BR2_PACKAGE_CURLPP=y
BR2_PACKAGE_FLICKCURL=y
BR2_PACKAGE_LIBCURL_SMALL=y
BR2_PACKAGE_LIBUPNP=y
BR2_PACKAGE_LIBCAP=y
BR2_PACKAGE_COLLECTD=y
BR2_PACKAGE_COLLECTD_CURL=y
BR2_PACKAGE_ASTERISK=y
BR2_PACKAGE_BOINC=y
BR2_PACKAGE_DEHYDRATED=y
BR2_PACKAGE_FREESWITCH=y
BR2_PACKAGE_STRONGSWAN=y
BR2_PACKAGE_STRONGSWAN_CURL=y
BR2_PACKAGE_TRANSMISSION=y
BR2_PACKAGE_KMOD=y
BR2_PACKAGE_KMOD_TOOLS=y
BR2_PACKAGE_RAUC=y
BR2_PACKAGE_RAUC_NETWORK=y
BR2_PACKAGE_TPM2_TOOLS=y
BR2_PACKAGE_UTIL_LINUX_BINARIES=y
BR2_PACKAGE_UTIL_LINUX_FSCK=y
BR2_PACKAGE_UTIL_LINUX_MOUNT=y
BR2_PACKAGE_UTIL_LINUX_NOLOGIN=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_SIZE="600M"
# BR2_TARGET_ROOTFS_TAR is not set
package/libcurl/Config.in +19 -0
@@ -19,6 +19,25 @@ config BR2_PACKAGE_LIBCURL_VERBOSE help Enable verbose text strings +config BR2_PACKAGE_LIBCURL_SMALL + bool "disable non-basic features to reduce size" + help + Compile libcurl only with basic features enabled, to save + about 50 KiB in the root filesystem. + + Following protocols/features are disabled: + - LDAP / LDAPS + - POP3 / IMAP / SMTP + - Telnet + - TFTP + - RTSP + - SMB / CIFS + - DICT + - Gopher + - Proxy support + - Cookie support + - The --libcurl option to generate C programs + config BR2_PACKAGE_LIBCURL_TLS_SUPPORT bool default y if BR2_PACKAGE_OPENSSL
package/libcurl/libcurl.mk +18 -0
@@ -108,6 +108,24 @@ else LIBCURL_CONF_OPTS += --without-nghttp2 endif +ifeq ($(BR2_PACKAGE_LIBCURL_SMALL),y) +LIBCURL_CONF_OPTS += \ + --disable-cookies \ + --disable-dict \ + --disable-gopher \ + --disable-imap \ + --disable-ldap \ + --disable-ldaps \ + --disable-libcurl-option \ + --disable-pop3 \ + --disable-proxy \ + --disable-rtsp \ + --disable-smb \ + --disable-smtp \ + --disable-telnet \ + --disable-tftp +endif + define LIBCURL_FIX_DOT_PC printf 'Requires: openssl\n' >>$(@D)/libcurl.pc.in endef
Signature · 1 line
2.19.2
PATCH 1/1 package/libcurl: introduce a 'small' config option
Hello,
Quoted 7 lines · On Wed, 6 Feb 2019 20:13:05 +0100 Thomas De Schampheleire…
package/libcurl/Config.in +7
-0+config BR2_PACKAGE_LIBCURL_SMALL + bool "disable non-basic features to reduce size" + help + Compile libcurl only with basic features enabled, to save + about 50 KiB in the root filesystem. + + Following protocols/features are disabled:
package/libcurl/Config.in config BR2_PACKAGE_LIBCURL_VERBOSE · line 38
Quoted 10 lines
package/libcurl/Config.in +10
-0+ - LDAP / LDAPS + - POP3 / IMAP / SMTP + - Telnet + - TFTP + - RTSP + - SMB / CIFS + - DICT + - Gopher + - Proxy support + - Cookie support
Discussing with Yann, we think that it would make sense to keep Proxy support and Cookie support, which are both kind of expected for curl as a tool for HTTP interaction. All the other features are not HTTP related, so indeed it makes sense to disable them in this "small" variant.
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 package/libcurl: introduce a 'small' config option
El mi?., 6 feb. 2019 a las 20:32, Thomas Petazzoni (<[email protected]>) escribi?:
Quoted 21 lines
Hello,
Quoted 15 lines · On Wed, 6 Feb 2019 20:13:05 +0100 Thomas De Schampheleire…
package/libcurl/Config.in +15
-0+config BR2_PACKAGE_LIBCURL_SMALL + bool "disable non-basic features to reduce size" + help + Compile libcurl only with basic features enabled, to save + about 50 KiB in the root filesystem. + + Following protocols/features are disabled: + - LDAP / LDAPS + - POP3 / IMAP / SMTP + - Telnet + - TFTP + - RTSP + - SMB / CIFS + - DICT + - Gopher
Quoted 8 lines
package/libcurl/Config.in config BR2_PACKAGE_LIBCURL_VERBOSE · line 38
Quoted 2 lines
package/libcurl/Config.in +2
-0+ - Proxy support + - Cookie supportDiscussing with Yann, we think that it would make sense to keep Proxy support and Cookie support, which are both kind of expected for curl as a tool for HTTP interaction. All the other features are not HTTP related, so indeed it makes sense to disable them in this "small" variant.
I understand your reasoning, but note that both together amount to about 25KB which is roughly half of what the 'small' feature saves today.
Also, while cookies may be needed when interacting with 'real' websites, you would not normally need them to download standard files from a web server.
Perhaps, we should introduce separate options for cookie (10 KB) and proxy (15 KB), given their size? I.e. three new options?
/Thomas
PATCH 1/1 package/libcurl: introduce a 'small' config option
Quoted 37 lines · Thomas De Schampheleire
El mi?., 6 feb. 2019 a las 20:32, Thomas Petazzoni (<[email protected]>) escribi?:
Quoted 21 lines
Hello,
Quoted 15 lines · On Wed, 6 Feb 2019 20:13:05 +0100 Thomas De Schampheleire…
package/libcurl/Config.in +15
-0+config BR2_PACKAGE_LIBCURL_SMALL + bool "disable non-basic features to reduce size" + help + Compile libcurl only with basic features enabled, to save + about 50 KiB in the root filesystem. + + Following protocols/features are disabled: + - LDAP / LDAPS + - POP3 / IMAP / SMTP + - Telnet + - TFTP + - RTSP + - SMB / CIFS + - DICT + - GopherQuoted 8 lines
package/libcurl/Config.in config BR2_PACKAGE_LIBCURL_VERBOSE · line 38
Quoted 2 lines
package/libcurl/Config.in +2
-0+ - Proxy support + - Cookie supportDiscussing with Yann, we think that it would make sense to keep Proxy support and Cookie support, which are both kind of expected for curl as a tool for HTTP interaction. All the other features are not HTTP related, so indeed it makes sense to disable them in this "small" variant.
I understand your reasoning, but note that both together amount to about 25KB which is roughly half of what the 'small' feature saves today.
Quoted 6 lines
Also, while cookies may be needed when interacting with 'real' websites, you would not normally need them to download standard files from a web server.
Perhaps, we should introduce separate options for cookie (10 KB) and proxy (15 KB), given their size? I.e. three new options?
That sounds acceptable to me.
Regards,
Arnout