2021-05-10 21:03:46 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
2021-05-10 22:10:11 +00:00
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
if [[ -z "${BABASHKA_STATIC:-}" ]]; then
|
|
|
|
|
echo "BABASHKA_STATIC wasn't set, skipping musl installation."
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [[ -z "${BABASHKA_MUSL:-}" ]]; then
|
|
|
|
|
echo "BABASHKA_MUSL wasn't set, skipping musl installation."
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
2021-09-13 21:28:13 +00:00
|
|
|
apt-get update -y && apt-get install musl-tools -y
|
2021-05-10 21:03:46 +00:00
|
|
|
|
|
|
|
|
ZLIB_VERSION="1.2.11"
|
|
|
|
|
|
|
|
|
|
curl -O -sL "https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz"
|
|
|
|
|
|
|
|
|
|
echo "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1 zlib-${ZLIB_VERSION}.tar.gz" |
|
|
|
|
|
sha256sum --check
|
|
|
|
|
tar xf "zlib-${ZLIB_VERSION}.tar.gz"
|
|
|
|
|
|
|
|
|
|
arch=${BABASHKA_ARCH:-"x86_64"}
|
|
|
|
|
echo "ARCH: $arch"
|
|
|
|
|
|
|
|
|
|
cd "zlib-${ZLIB_VERSION}"
|
2021-05-25 16:52:30 +00:00
|
|
|
CC=musl-gcc ./configure --static --prefix="/usr/local"
|
2021-05-10 21:03:46 +00:00
|
|
|
make CC=musl-gcc
|
2021-05-25 16:52:30 +00:00
|
|
|
make install
|
2021-05-10 21:03:46 +00:00
|
|
|
cd ..
|
|
|
|
|
|
2021-05-25 16:52:30 +00:00
|
|
|
# Install libz.a in the correct place so ldd can find it
|
|
|
|
|
install -Dm644 "/usr/local/lib/libz.a" "/usr/lib/$arch-linux-musl/libz.a"
|
2021-11-04 10:27:41 +00:00
|
|
|
|
|
|
|
|
ln -s /usr/bin/musl-gcc /usr/bin/x86_64-linux-musl-gcc
|