Compare commits

..

No commits in common. "master" and "v7.77.0" have entirely different histories.

2 changed files with 12 additions and 20 deletions

View File

@ -4,13 +4,12 @@
These are a couple simple scripts to build a fully static curl binary using alpine linux docker containers. Currently it is a featureful build with OpenSSL, libssh2, nghttp2, and zlib, supporting most protocols. Tweak configure options in [build.sh](build.sh#L50) if you need something else (and/or suggest or PR).
Grab the [latest release](https://github.com/moparisthebest/static-curl/releases/latest) from one of these links, by CPU architecture:
- [curl-amd64](https://github.com/moparisthebest/static-curl/releases/latest/download/curl-amd64)
- [curl-i386](https://github.com/moparisthebest/static-curl/releases/latest/download/curl-i386)
- [curl-aarch64](https://github.com/moparisthebest/static-curl/releases/latest/download/curl-aarch64)
- [curl-armv7](https://github.com/moparisthebest/static-curl/releases/latest/download/curl-armv7)
- [curl-armhf](https://github.com/moparisthebest/static-curl/releases/latest/download/curl-armhf)
- [curl-ppc64le](https://github.com/moparisthebest/static-curl/releases/latest/download/curl-ppc64le)
Grab the latest release (curl 7.77.0) from one of these links, by CPU architecture:
- [curl-amd64](https://github.com/moparisthebest/static-curl/releases/download/v7.77.0/curl-amd64)
- [curl-i386](https://github.com/moparisthebest/static-curl/releases/download/v7.77.0/curl-i386)
- [curl-aarch64](https://github.com/moparisthebest/static-curl/releases/download/v7.77.0/curl-aarch64)
- [curl-armv7](https://github.com/moparisthebest/static-curl/releases/download/v7.77.0/curl-armv7)
- [curl-ppc64le](https://github.com/moparisthebest/static-curl/releases/download/v7.77.0/curl-ppc64le)
Static binaries for windows are provided directly by [curl](https://curl.haxx.se/windows/) itself.

View File

@ -5,7 +5,7 @@
# docker run --rm -v $(pwd):/tmp -w /tmp -e ARCH=aarch64 multiarch/alpine:aarch64-latest-stable /tmp/build.sh
# docker run --rm -v $(pwd):/tmp -w /tmp -e ARCH=ARCH_HERE ALPINE_IMAGE_HERE /tmp/build.sh
CURL_VERSION='8.11.0'
CURL_VERSION='7.77.0'
[ "$1" != "" ] && CURL_VERSION="$1"
@ -32,7 +32,7 @@ tar xzf curl-${CURL_VERSION}.tar.gz
cd curl-${CURL_VERSION}/
# dependencies to build curl
apk add build-base clang openssl-dev nghttp2-dev nghttp2-static libssh2-dev libssh2-static perl
apk add build-base clang openssl-dev nghttp2-dev nghttp2-static libssh2-dev libssh2-static
# these are missing on at least armhf
apk add openssl-libs-static zlib-static || true
@ -40,18 +40,12 @@ apk add openssl-libs-static zlib-static || true
# gcc is apparantly incapable of building a static binary, even gcc -static helloworld.c ends up linked to libc, instead of solving, use clang
export CC=clang
# apply patches if needed
#patch -p1 < ../static.patch
#apk add autoconf automake libtool
#autoreconf -fi
# end apply patches
# set up any required curl options here
#LDFLAGS="-static" PKG_CONFIG="pkg-config --static" ./configure --disable-shared --enable-static --disable-libcurl-option --without-brotli --disable-manual --disable-unix-sockets --disable-dict --disable-file --disable-gopher --disable-imap --disable-smtp --disable-rtsp --disable-telnet --disable-tftp --disable-pop3 --without-zlib --disable-threaded-resolver --disable-ipv6 --disable-smb --disable-ntlm-wb --disable-tls-srp --disable-crypto-auth --without-ngtcp2 --without-nghttp2 --disable-ftp --disable-mqtt --disable-alt-svc --without-ssl
#LDFLAGS="-static" PKG_CONFIG="pkg-config --static" ./configure --disable-shared --enable-static --disable-libcurl-option --without-brotli --disable-manual --disable-unix-sockets --disable-dict --disable-file --disable-gopher --disable-imap --disable-smtp --disable-rtsp --disable-telnet --disable-tftp --disable-pop3 --without-zlib --disable-threaded-resolver --disable-ipv6 --disable-smb --disable-ntlm-wb --disable-tls-srp --disable-crypto-auth --with-ssl
LDFLAGS="-static" PKG_CONFIG="pkg-config --static" ./configure --disable-shared --enable-static --disable-ldap --enable-ipv6 --enable-unix-sockets --with-ssl --with-libssh2 --disable-docs --disable-manual --without-libpsl
LDFLAGS="-static" PKG_CONFIG="pkg-config --static" ./configure --disable-shared --enable-static --disable-ldap --enable-ipv6 --enable-unix-sockets --with-ssl --with-libssh2
make -j4 V=1 LDFLAGS="-static -all-static"
make -j4 V=1 curl_LDFLAGS=-all-static
# binary is ~13M before stripping, 2.6M after
strip src/curl
@ -59,8 +53,7 @@ strip src/curl
# print out some info about this, size, and to ensure it's actually fully static
ls -lah src/curl
file src/curl
# exit with error code 1 if the executable is dynamic, not static
ldd src/curl && exit 1 || true
ldd src/curl || true
./src/curl -V