Skip to content

Instantly share code, notes, and snippets.

@bagder
Last active July 12, 2024 12:51
Show Gist options
  • Save bagder/4d3e326b395f7706e550f68fcfe8ccc7 to your computer and use it in GitHub Desktop.
Save bagder/4d3e326b395f7706e550f68fcfe8ccc7 to your computer and use it in GitHub Desktop.
build a tiny curl (on Linux)
#!/bin/sh
export CFLAGS="-Os -ffunction-sections -fdata-sections -fno-unwind-tables -fno-asynchronous-unwind-tables -flto"
export LDFLAGS="-Wl,-s -Wl,-Bsymbolic -Wl,--gc-sections"
./configure \
--disable-cookies \
--disable-crypto-auth \
--disable-dict \
--disable-file \
--disable-ftp \
--disable-gopher \
--disable-imap \
--disable-ldap \
--disable-mqtt \
--disable-pop3 \
--disable-proxy \
--disable-rtmp \
--disable-rtsp \
--disable-scp \
--disable-sftp \
--disable-smtp \
--disable-telnet \
--disable-tftp \
--disable-unix-sockets \
--disable-verbose \
--disable-versioned-symbols \
--disable-http-auth \
--disable-doh \
--disable-mime \
--disable-dateparse \
--disable-netrc \
--disable-dnsshuffle \
--disable-progress-meter \
--enable-maintainer-mode \
--enable-werror \
--without-brotli \
--without-gssapi \
--without-libidn2 \
--without-libpsl \
--without-librtmp \
--without-libssh2 \
--without-nghttp2 \
--without-ntlm-auth \
--without-ssl \
--without-zlib \
--without-zstd \
--with-wolfssl=[install prefix]
@abitrolly
Copy link

@bagder thanks for the clarification. I thought is a parallel tool with less dependencies and attack surface.

@maggie44
Copy link

maggie44 commented Mar 13, 2022

I ran the build in an Alpine Linux container and the output is 4.9M. That's bigger than I had expected.

Edit: Of the output looks like only the curl file and lib/libcurl.so.4 were required. Brought the size down to 300k.

@slugvision
Copy link

Hi Does tinycurl my target architecture (e.g., ARM Cortex-M0+ for Raspberry Pi Pico)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment