Skip to content

Instantly share code, notes, and snippets.

@thevery
Created October 23, 2021 22:55
Show Gist options
  • Save thevery/6c0251889fc3d7d821e6bc0ef8bdaa77 to your computer and use it in GitHub Desktop.
Save thevery/6c0251889fc3d7d821e6bc0ef8bdaa77 to your computer and use it in GitHub Desktop.
wget static build for macos
export PREFIX=$HOME/prefix/usr
curl -L https://github.com/openssl/openssl/archive/refs/tags/OpenSSL_1_1_1l.tar.gz -o openssl.tar.gz
tar xf openssl.tar.gz
cd openssl-OpenSSL_1_1_1l
./config --prefix=$PREFIX
make install_sw
cd ..
curl https://ftp.gnu.org/gnu/wget/wget-1.21.2.tar.gz -o wget.tar.gz
tar xf wget.tar.gz
cd wget-1.21.2
./configure --disable-nls --disable-iri --disable-pcre --disable-pcre2 --without-libpsl --without-included-regex --with-ssl=openssl --with-libssl-prefix=$PREFIX --prefix=$PREFIX
// remove dynamic libraries to force use static for linker
rm $PREFIX/lib/*.dylib
make install LDFLAGS="-L$PREFIX/lib -lssl -lcrypto"
echo "please make sure there is no '$PREFIX' or '/usr/local' in dependencies"
otool -L ./src/wget
echo "wget static binary: `pwd`/src/wget"
@thevery
Copy link
Author

thevery commented Nov 15, 2021

add export MACOSX_DEPLOYMENT_TARGET=10.14 to build mojave-compatible binary

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