Last active
September 24, 2018 06:32
-
-
Save myfreeer/e9b6a5eef7d64743d311e4addf5ac374 to your computer and use it in GitHub Desktop.
size-sensitive curl build script for msys2 mingw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# workaround for static zlib | |
test -e /mingw64/lib/libz.dll.a && mv -f /mingw64/lib/libz.dll.a /mingw64/lib/_libz.dll.a | |
test -e /mingw32/lib/libz.dll.a && mv -f /mingw32/lib/libz.dll.a /mingw32/lib/_libz.dll.a | |
set -e | |
# git clone https://github.com/curl/curl --depth=1 && cd curl | |
CURL_VER='7.61.1' | |
# CURL_VER="$(curl -s --retry 10 --retry-connrefused --retry-delay 1 'https://curl.haxx.se/docs/releases.csv' | cut -f2 -d';' | sort -ruV | head -1)" | |
wget -c https://curl.haxx.se/download/curl-${CURL_VER}.tar.xz | |
tar xf curl-${CURL_VER}.tar.xz | |
cd curl-${CURL_VER} | |
mkdir build | |
cd build | |
cmake -GNinja .. \ | |
-DCMAKE_USE_WINSSL=ON \ | |
-DCMAKE_USE_LIBSSH2=OFF \ | |
-DBUILD_SHARED_LIBS=OFF \ | |
-DBUILD_TESTING=OFF \ | |
-DENABLE_MANUAL=OFF \ | |
-DCMAKE_C_FLAGS='-pipe -Wl,--gc-sections,--build-id=none -Os -fmerge-all-constants -fno-asynchronous-unwind-tables' | |
ninja | |
# ~500k stripped curl.exe in my local mingw64 gcc 8.2.0 and binutils 2.31.1 | |
strip -s src/curl.exe | |
cd ../.. | |
set +e | |
test -e /mingw64/lib/_libz.dll.a && mv -f /mingw64/lib/_libz.dll.a /mingw64/lib/libz.dll.a | |
test -e /mingw32/lib/_libz.dll.a && mv -f /mingw32/lib/_libz.dll.a /mingw32/lib/libz.dll.a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment