Add more architectures, build more featureful curl
This commit is contained in:
parent
a94f48bb07
commit
2ca94ad332
12
.travis.yml
12
.travis.yml
@ -1,19 +1,19 @@
|
|||||||
language: minimal
|
language: minimal
|
||||||
services: docker
|
services: docker
|
||||||
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
- CURL_VERSION='7.67.0'
|
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- env: ARCH='amd64' DOCKER_IMAGE='alpine'
|
- env: ARCH='amd64' DOCKER_IMAGE='alpine'
|
||||||
- env: ARCH='i386' DOCKER_IMAGE='i386/alpine'
|
|
||||||
- env: ARCH='aarch64' DOCKER_IMAGE='alpine'
|
- env: ARCH='aarch64' DOCKER_IMAGE='alpine'
|
||||||
arch: arm64
|
arch: arm64
|
||||||
|
- env: ARCH='i386' DOCKER_IMAGE='multiarch/alpine:i386-latest-stable'
|
||||||
|
# - env: ARCH='x86' DOCKER_IMAGE='multiarch/alpine:x86-latest-stable'
|
||||||
|
- env: ARCH='ppc64le' DOCKER_IMAGE='multiarch/alpine:ppc64le-latest-stable'
|
||||||
|
# - env: ARCH='armhf' DOCKER_IMAGE='multiarch/alpine:armhf-latest-stable'
|
||||||
|
- env: ARCH='armv7' DOCKER_IMAGE='multiarch/alpine:armv7-edge'
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- ./docker_build.sh "$DOCKER_IMAGE" "$ARCH" "$CURL_VERSION"
|
- ./docker_build.sh "$DOCKER_IMAGE" "$ARCH"
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
api_key:
|
api_key:
|
||||||
|
@ -2,12 +2,16 @@
|
|||||||
-----------
|
-----------
|
||||||
[![Travis-CI Build Status](https://api.travis-ci.org/moparisthebest/static-curl.svg?branch=master)](https://travis-ci.org/moparisthebest/static-curl)
|
[![Travis-CI Build Status](https://api.travis-ci.org/moparisthebest/static-curl.svg?branch=master)](https://travis-ci.org/moparisthebest/static-curl)
|
||||||
|
|
||||||
These are a couple simple scripts to build a fully static curl binary using an alpine linux docker container. Currently it is a minimal build with OpenSSL and only supporting HTTP and FTP. Tweak configure options in [build.sh](build.sh#L33) if you need something else (and/or suggest or PR).
|
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 (curl 7.67.0) from one of these links, by CPU architecture:
|
Grab the latest release (curl 7.67.0) from one of these links, by CPU architecture:
|
||||||
- [curl-amd64](https://github.com/moparisthebest/static-curl/releases/download/v7.67.0/curl-amd64)
|
- [curl-amd64](https://github.com/moparisthebest/static-curl/releases/download/v7.67.0/curl-amd64)
|
||||||
- [curl-i386](https://github.com/moparisthebest/static-curl/releases/download/v7.67.0/curl-i386)
|
- [curl-i386](https://github.com/moparisthebest/static-curl/releases/download/v7.67.0/curl-i386)
|
||||||
- [curl-aarch64](https://github.com/moparisthebest/static-curl/releases/download/v7.67.0/curl-aarch64)
|
- [curl-aarch64](https://github.com/moparisthebest/static-curl/releases/download/v7.67.0/curl-aarch64)
|
||||||
|
- [curl-armv7](https://github.com/moparisthebest/static-curl/releases/download/v7.67.0/curl-armv7)
|
||||||
|
- [curl-ppc64le](https://github.com/moparisthebest/static-curl/releases/download/v7.67.0/curl-ppc64le)
|
||||||
|
|
||||||
|
Static binaries for windows are provided directly by [curl](https://curl.haxx.se/windows/) itself.
|
||||||
|
|
||||||
Development
|
Development
|
||||||
-----------
|
-----------
|
||||||
|
23
build.sh
23
build.sh
@ -1,5 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# to test locally, run one of:
|
||||||
|
# docker run --rm -v $(pwd):/tmp alpine /tmp/build.sh
|
||||||
|
# docker run --rm -v $(pwd):/tmp multiarch/alpine:armhf-latest-stable /tmp/build.sh
|
||||||
|
# docker run --rm -v $(pwd):/tmp i386/alpine /tmp/build.sh
|
||||||
|
# docker run --rm -v $(pwd):/tmp ALPINE_IMAGE_HERE /tmp/build.sh
|
||||||
|
|
||||||
CURL_VERSION='7.67.0'
|
CURL_VERSION='7.67.0'
|
||||||
|
|
||||||
[ "$1" != ""] && CURL_VERSION="$1"
|
[ "$1" != ""] && CURL_VERSION="$1"
|
||||||
@ -9,6 +15,9 @@ set -exu
|
|||||||
# change to the directory this script is in, we assume mykey.asc is there
|
# change to the directory this script is in, we assume mykey.asc is there
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
if [ ! -f curl-${CURL_VERSION}.tar.gz ]
|
||||||
|
then
|
||||||
|
|
||||||
# for gpg verification of the curl download below
|
# for gpg verification of the curl download below
|
||||||
apk add gnupg
|
apk add gnupg
|
||||||
|
|
||||||
@ -19,18 +28,26 @@ gpg --no-default-keyring --yes -o ./curl.gpg --dearmor mykey.asc
|
|||||||
# this has a non-zero exit code if it fails, which will halt the script
|
# this has a non-zero exit code if it fails, which will halt the script
|
||||||
gpg --no-default-keyring --keyring ./curl.gpg --verify curl-${CURL_VERSION}.tar.gz.asc
|
gpg --no-default-keyring --keyring ./curl.gpg --verify curl-${CURL_VERSION}.tar.gz.asc
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf "curl-${CURL_VERSION}/"
|
||||||
tar xzf curl-${CURL_VERSION}.tar.gz
|
tar xzf curl-${CURL_VERSION}.tar.gz
|
||||||
|
|
||||||
cd curl-${CURL_VERSION}/
|
cd curl-${CURL_VERSION}/
|
||||||
|
|
||||||
# dependencies to build curl
|
# dependencies to build curl
|
||||||
apk add build-base clang openssl-dev
|
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
|
||||||
|
|
||||||
# gcc is apparantly incapable of building a static binary, even gcc -static helloworld.c ends up linked to libc, instead of solving, use clang
|
# 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
|
export CC=clang
|
||||||
|
|
||||||
# set up any required curl options here
|
# 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
|
#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
|
||||||
|
|
||||||
make -j4 V=1 curl_LDFLAGS=-all-static
|
make -j4 V=1 curl_LDFLAGS=-all-static
|
||||||
|
|
||||||
@ -42,6 +59,8 @@ ls -lah src/curl
|
|||||||
file src/curl
|
file src/curl
|
||||||
ldd src/curl || true
|
ldd src/curl || true
|
||||||
|
|
||||||
|
./src/curl -V
|
||||||
|
|
||||||
#./src/curl -v http://www.moparisthebest.com/; ./src/curl -v https://www.moparisthebest.com/ip
|
#./src/curl -v http://www.moparisthebest.com/; ./src/curl -v https://www.moparisthebest.com/ip
|
||||||
|
|
||||||
# we only want to save curl here, by moving it to /tmp/ for now
|
# we only want to save curl here, by moving it to /tmp/ for now
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
DOCKER_IMAGE="$1"
|
DOCKER_IMAGE="$1"
|
||||||
shift
|
shift
|
||||||
ARCH="$1"
|
ARCH="$1"
|
||||||
shift
|
|
||||||
CURL_VERSION="$1"
|
|
||||||
|
|
||||||
BUILD_DIR=/tmp/static-curl/
|
BUILD_DIR=/tmp/static-curl/
|
||||||
|
|
||||||
@ -12,7 +10,10 @@ rm -rf "$BUILD_DIR"
|
|||||||
mkdir -p "$BUILD_DIR"
|
mkdir -p "$BUILD_DIR"
|
||||||
cp build.sh mykey.asc "$BUILD_DIR"
|
cp build.sh mykey.asc "$BUILD_DIR"
|
||||||
|
|
||||||
docker run --rm -v "$BUILD_DIR":/tmp "$DOCKER_IMAGE" /tmp/build.sh "$CURL_VERSION" || exit 1
|
# if this is a multiarch image, must register binfmt handlers
|
||||||
|
echo "$DOCKER_IMAGE" | grep multiarch && docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||||
|
|
||||||
|
docker run --rm -v "$BUILD_DIR":/tmp "$DOCKER_IMAGE" /tmp/build.sh || exit 1
|
||||||
|
|
||||||
mv "$BUILD_DIR"curl "./curl-$ARCH"
|
mv "$BUILD_DIR"curl "./curl-$ARCH"
|
||||||
rm -rf "$BUILD_DIR" 2>/dev/null
|
rm -rf "$BUILD_DIR" 2>/dev/null
|
||||||
|
Loading…
Reference in New Issue
Block a user