Skip to content

Instantly share code, notes, and snippets.

@mcilloni
Last active August 29, 2015 14:02
Show Gist options
  • Save mcilloni/74dcbfc8a776848c2fff to your computer and use it in GitHub Desktop.
Save mcilloni/74dcbfc8a776848c2fff to your computer and use it in GitHub Desktop.
My musl-clang wrapper script. Change my paths with your paths if needed.
#!/usr/bin/env bash
containsElement () {
local e
for e in "${@:1}"; do [[ "$e" == "$2" ]] && return 0; done
return 1
}
PARAMS="-nostdinc -isystem /usr/musl/include/ "
if containsElement @ '-c' || containsElement @ '-S'; then
true
else
PARAMS+="-nostdlib -Wl,-dynamic-linker /lib/ld-musl-x86_64.so.1 -L/usr/musl/lib /usr/musl/lib/crt1.o /usr/musl/lib/crti.o /usr/musl/lib/crtn.o -lc"
fi
clang $PARAMS $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment