aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2021-09-25 21:28:04 -0400
committerMitchell Riedstra <mitch@riedstra.dev>2021-09-25 21:28:04 -0400
commit03976ecac8e5b062936f692f45768da512d89421 (patch)
treea3cfd4dd618a3bc1f150be285844f8f32533dadc /build
parente4cee4641ecc042c96855bdf81ad790fe6173082 (diff)
downloaddotfiles-03976ecac8e5b062936f692f45768da512d89421.tar.gz
dotfiles-03976ecac8e5b062936f692f45768da512d89421.tar.xz
add a script for building musl libc
Diffstat (limited to 'build')
-rwxr-xr-xbuild/musl53
1 files changed, 53 insertions, 0 deletions
diff --git a/build/musl b/build/musl
new file mode 100755
index 0000000..13487e5
--- /dev/null
+++ b/build/musl
@@ -0,0 +1,53 @@
+#!/bin/sh
+set -e
+set -x
+relver="1.2.2"
+build_dir="/v/pub/musl"
+
+PREFIX="$HOME/musl"
+
+if ! [ -d "$build_dir" ] ; then
+ mkdir -p "$build_dir"
+fi
+cd "$build_dir"
+
+sigLoc="https://musl.libc.org/releases/musl-${relver}.tar.gz.asc"
+sigFn="musl-${relver}.tar.gz.asc"
+arLoc="https://musl.libc.org/releases/musl-${relver}.tar.gz"
+arFn="musl-${relver}.tar.gz"
+
+curl https://musl.libc.org/musl.pub | gpg --import
+
+if ! [ -e "$arFn" ] ; then
+ curl -o "$arFn" "$arLoc"
+fi
+
+if ! [ -e "$sigFn" ] ; then
+ curl -o "$sigFn" "$sigLoc"
+fi
+
+_out="$(mktemp)";
+gpg --fingerprint --verify "$sigFn" >"$_out" 2>&1
+ret=$?
+
+if [ $ret -ne 0 ] ; then
+ cat "$_out"
+ rm "$_out"
+ echo "Bad signature"
+fi
+
+if ! grep -q '^Primary key fingerprint: 8364 8929 0BB6 B70F 99FF DA05 56BC DB59 3020 450F' \
+ < "$_out" ; then
+ cat "$_out"
+ rm "$_out"
+ echo "Bad signature"
+ exit 1
+fi
+rm "$_out" || printf ""
+
+tar xzvf "$arFn"
+cd "musl-${relver}"
+./configure --prefix="$PREFIX" --bindir="$HOME/bin" --disable-shared \
+ --enable-static
+make
+make install -j$(nproc)