Skip to contentSkip to conversation

package/libcurl: introduce options to reduce feature set

PATCH Superseded Thomas De Schampheleire 2 participants 3 messages Feb 7, 2019 – Feb 8, 2019

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/libcurl: introduce options to reduce feature set

From: Thomas De Schampheleire <[email protected]>

Libcurl is more than 250 KiB (libcurl) / 100 KiB (curl binary) in size. About 50 KiB / 15 KiB of this can be saved by disabling features/protocols that are not commonly needed:

- proxy support: 15 KiB
- cookies support: 10 KiB
- various less common protocols: 25 KiB (libcurl) + 15 KiB (curl binary)

Note that the exact amount of space saved depends on the architecture, toolchain, and other factors (for example the 'reduced' set disables the --libcurl option which only has impact on the curl binary).

Other packages that are selecting libcurl could be incompatible with these reduced options. 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.

Note: remove the text 'enable' on the option for 'verbose strings' as that is more common in Buildroot.

---
 package/libcurl/Config.in  | 30 +++++++++++++++++++++++++++++-
 package/libcurl/libcurl.mk | 28 ++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+), 1 deletion(-)

v2:
- steer proxy and cookies support via separate options
- reword option and help text

package/libcurl/Config.in +29 -1
index 9c62539e4d..8e2af61f7d 100644
@@ -15,10 +15,38 @@ config BR2_PACKAGE_CURL
 	  Install curl binary as well
 
 config BR2_PACKAGE_LIBCURL_VERBOSE
-	bool "enable verbose strings"
+	bool "verbose strings"
 	help
 	  Enable verbose text strings
 
+config BR2_PACKAGE_LIBCURL_PROXY_SUPPORT
+	bool "proxy support"
+	default y
+	help
+	  Enable proxy support.
+
+config BR2_PACKAGE_LIBCURL_COOKIES_SUPPORT
+	bool "cookies support"
+	default y
+	help
+	  Enable support for cookies.
+
+config BR2_PACKAGE_LIBCURL_SMALL
+	bool "reduced protocol/feature selection"
+	help
+	  Reduce the selection of supported protocols and features.
+	  Following protocols/features are disabled:
+	  - LDAP / LDAPS
+	  - POP3 / IMAP / SMTP
+	  - Telnet
+	  - TFTP
+	  - RTSP
+	  - SMB / CIFS
+	  - DICT
+	  - Gopher
+	  - The --libcurl option of the curl binary to generate C
+	    programs
+
 config BR2_PACKAGE_LIBCURL_TLS_SUPPORT
 	bool
 	default y if BR2_PACKAGE_OPENSSL
package/libcurl/libcurl.mk +28 -0
index 3bc5207951..8c5bc4a485 100644
@@ -108,6 +108,34 @@ else
 LIBCURL_CONF_OPTS += --without-nghttp2
 endif
 
+ifeq ($(BR2_PACKAGE_LIBCURL_COOKIES_SUPPORT),y)
+LIBCURL_CONF_OPTS += --enable-cookies
+else
+LIBCURL_CONF_OPTS += --disable-cookies
+endif
+
+ifeq ($(BR2_PACKAGE_LIBCURL_PROXY_SUPPORT),y)
+LIBCURL_CONF_OPTS += --enable-proxy
+else
+LIBCURL_CONF_OPTS += --disable-proxy
+endif
+
+ifeq ($(BR2_PACKAGE_LIBCURL_SMALL),y)
+LIBCURL_CONF_OPTS += \
+	--disable-dict \
+	--disable-gopher \
+	--disable-imap \
+	--disable-ldap \
+	--disable-ldaps \
+	--disable-libcurl-option \
+	--disable-pop3 \
+	--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
#1 lore raw

PATCH v2 1/1 package/libcurl: introduce options to reduce feature set

Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas De Schampheleire <[email protected]> writes:

From: Thomas De Schampheleire <[email protected]> Libcurl is more than 250 KiB (libcurl) / 100 KiB (curl binary) in size. About 50 KiB / 15 KiB of this can be saved by disabling features/protocols that are not commonly needed:

- proxy support: 15 KiB
- cookies support: 10 KiB
- various less common protocols: 25 KiB (libcurl) + 15 KiB (curl binary)

Quoted 7 lines

Note that the exact amount of space saved depends on the architecture, toolchain, and other factors (for example the 'reduced' set disables the --libcurl option which only has impact on the curl binary).

Other packages that are selecting libcurl could be incompatible with these reduced options. 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.

That is not really nice :/

package/libcurl/Config.in config BR2_PACKAGE_CURL · line 35

Quoted 2 lines
package/libcurl/Config.in +2 -0
+config BR2_PACKAGE_LIBCURL_SMALL
+	bool "reduced protocol/feature selection"

I know I proposed this option myself, but having a negative option like this is not really nice. What should a package that needs libcurl built without the _SMALL option do? Depending on !BR2_PACKAGE_LIBCURL_SMALL isn't really nice.

Could we perhaps invert the option and call it BR2_PACKAGE_LIBCURL_EXTRA or something like that? (with default y)

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH v2 1/1 package/libcurl: introduce options to reduce feature set

El jue., 7 feb. 2019 a las 22:41, Peter Korsgaard
(<[email protected]>) escribi?:

Quoted 25 lines
Quoted 12 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

"Thomas" == Thomas De Schampheleire <[email protected]> writes:

From: Thomas De Schampheleire <[email protected]> Libcurl is more than 250 KiB (libcurl) / 100 KiB (curl binary) in size. About 50 KiB / 15 KiB of this can be saved by disabling features/protocols that are not commonly needed:

- proxy support: 15 KiB
- cookies support: 10 KiB
- various less common protocols: 25 KiB (libcurl) + 15 KiB (curl binary)

Quoted 7 lines

Note that the exact amount of space saved depends on the architecture, toolchain, and other factors (for example the 'reduced' set disables the --libcurl option which only has impact on the curl binary).

Other packages that are selecting libcurl could be incompatible with these reduced options. 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.

That is not really nice :/

package/libcurl/Config.in config BR2_PACKAGE_CURL · line 35

Quoted 2 lines
package/libcurl/Config.in +2 -0
+config BR2_PACKAGE_LIBCURL_SMALL
+    bool "reduced protocol/feature selection"
Quoted 7 lines

I know I proposed this option myself, but having a negative option like this is not really nice. What should a package that needs libcurl built without the _SMALL option do? Depending on !BR2_PACKAGE_LIBCURL_SMALL isn't really nice.

Could we perhaps invert the option and call it BR2_PACKAGE_LIBCURL_EXTRA or something like that? (with default y)

Ok, sure.
I sent a v3 that does that. Feel free to rename the option name to what suits you.

Best regards,
Thomas