babashka/script/setup-musl
Thiago Kenji Okada ddc900a656
Build BABASHKA_STATIC with musl C library (#828)
* Build BABASHKA_STATIC with musl C library

Based on https://github.com/babashka/pod-babashka-aws/pull/37.

This is the recommended way to build static binaries with GraalVM by the
documentation and multiple issues on GitHub. See:

- https://www.graalvm.org/reference-manual/native-image/StaticImages/
- oracle/graal#571 (comment)

The reason that building a statically binary with glibc is complicated
is explained in the glib documentation:

https://sourceware.org/glibc/wiki/FAQ#Even_statically_linked_programs_need_some_shared_libraries_which_is_not_acceptable_for_me.__What_can_I_do.3F

* Bring back zlib1g-dev

Seems it is necessary for the non-static build.
2021-05-09 23:30:27 +02:00

24 lines
755 B
Bash
Executable file

#!/usr/bin/env bash
# This script sets up the latest available musl-tools using apt pinning from debian unstable.
# The one available in stable and testing are quite outdated and this ensures we get the latest improvements
# This explictly installs musl from unstable and keeps the others at a higher priority
cat >> /etc/apt/sources.list <<eof
deb http://ftp.us.debian.org/debian unstable main non-free contrib
deb http://non-us.debian.org/debian-non-us unstable/non-us main contrib non-free
eof
cat >> /etc/apt/preferences <<eof
Package: *
Pin: release a=stable
Pin-Priority: 700
Package: *
Pin: release a=testing
Pin-Priority: 650
Package: *
pin: release a=unstable
pin-priority: 600
eof
apt-get update -y && apt-get install musl-tools/unstable -y