musllvm

musl and LLVM cross-toolchain build system
git clone https://git.daat.foo/repos/musllvm.git
Log | Files | Refs | README | LICENSE

env.sh (601B)


      1 #!/bin/sh
      2 set -eu
      3 prefix=$(CDPATH= cd "$(dirname "$0")/.." && pwd -P)
      4 
      5 quote()
      6 {
      7 	printf "'"
      8 	printf '%s' "$1" | sed "s/'/'\\\\''/g"
      9 	printf "'"
     10 }
     11 
     12 emit()
     13 {
     14 	printf 'export %s=' "$1"
     15 	quote "$2"
     16 	printf '\n'
     17 }
     18 
     19 emit MUSLLVM_HOME "$prefix"
     20 emit MUSLLVM_SYSROOT "$prefix/sysroot"
     21 emit TARGET @TARGET@
     22 emit PATH "$prefix/bin:$PATH"
     23 for pair in CC:cc CXX:c++ AR:ar RANLIB:ranlib NM:nm STRIP:strip \
     24 	OBJCOPY:objcopy OBJDUMP:objdump READELF:readelf LD:ld PKG_CONFIG:pkg-config; do
     25 	emit "${pair%%:*}" "$prefix/bin/@TARGET@-${pair#*:}"
     26 done
     27 emit CMAKE_TOOLCHAIN_FILE "$prefix/share/musllvm/toolchain.cmake"