musl-cross-make:bootstrap-0 (4034B)
1 #!/usr/bin/env pthbs-build 2 #@pragma:nosandbox 3 #@pragma:nopath 4 #@sha256:ab66fc2d1c3ec0359b8e08843c9f33b63e8707efdff5e4cc5c200eae24722cbf:musl-cross-make/sources/binutils-2.33.1.tar.xz 5 #@sha256:75d5d255a2a273b6e651f82eecfabf6cbcd8eaeae70e86b417384c8f4a58d8d3:musl-cross-make/sources/config.sub 6 #@sha256:c95da32f440378d7751dd95533186f7fc05ceb4fb65eb5b85234e6299eb9838e:musl-cross-make/sources/gcc-9.4.0.tar.xz 7 #@sha256:5275bb04f4863a13516b2f39392ac5e272f5e1bb8057b18aec1c9b79d73d8fb2:musl-cross-make/sources/gmp-6.1.2.tar.bz2 8 #@sha256:dc7abf734487553644258a3822cfd429d74656749e309f2b25f09f4282e05588:musl-cross-make/sources/linux-headers-4.19.88-2.tar.xz 9 #@sha256:6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e:musl-cross-make/sources/mpc-1.1.0.tar.gz 10 #@sha256:c05e3f02d09e0e9019384cdd58e0f19c64e6db1fd6f5ecf77b4b1c61ca253acc:musl-cross-make/sources/mpfr-4.0.2.tar.bz2 11 #@sha256:a9a118bbe84d8764da0ea0d28b3ab3fae8477fc7e4085d90102b8596fc7c75e4:musl-cross-make/sources/musl-1.2.5.tar.gz 12 #@git:6f3701d08137496d5aac479e3a3977b5ae993c1f:musl-cross-make 13 14 15 # - build script start - 16 17 prefix=/home/ccx/versions/$pthbs_package 18 dest=${pthbs_destdir%/}${prefix} 19 cd '.' 20 21 # For validating the compiler 22 printf '%s\n' 'int main(void) { return 0; }' >true.c 23 24 printf '%s\n' >musl-cross-make/config.mak \ 25 "OUTPUT=${pthbs_destdir%/}/home/ccx/versions/$pthbs_package" \ 26 "TARGET=x86_64-linux-musl" \ 27 'fl=-g0 -O2' \ 28 'COMMON_CONFIG += CFLAGS="${fl}" CXXFLAGS="${fl}" FFLAGS="${fl}" LDFLAGS="-s"' 29 30 touch musl-cross-make/sources/* 31 32 33 # Patch linker path for dynamic executables 34 make -C musl-cross-make gcc-9.4.0 35 sed -i -e 's|/lib/ld-musl-|/home/ccx/versions/'"$pthbs_package"'/x86_64-linux-musl/lib/ld-musl-|' musl-cross-make/gcc-9.4.0/gcc/config/*/linux*.h 36 37 make -j${JOBS:-1} -l$((1+${JOBS:-1})) -C musl-cross-make 38 make -C musl-cross-make install 39 40 # Override linker symlink 41 for linkname in "${pthbs_destdir%/}"'/home/ccx/versions/'"$pthbs_package"'/x86_64-linux-musl/lib/'ld-musl-*so*; do 42 ln -s -f libc.so "$linkname" 43 done 44 45 # Validate the compiler 46 "${pthbs_destdir%/}"'/home/ccx/versions'"/$pthbs_package/bin/"'x86_64-linux-musl-gcc' --version 47 "${pthbs_destdir%/}"'/home/ccx/versions'"/$pthbs_package/bin/"'x86_64-linux-musl-gcc' -o true true.c 48 "${pthbs_destdir%/}"'/home/ccx/versions'"/$pthbs_package/bin/"'x86_64-linux-musl-readelf' --string-dump=.interp true >true.linker 49 grep -F "$pthbs_package" true.linker 50 51 52 53 54 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package" 55 find -type d -o -print | awk -F/ ' 56 BEGIN { 57 x["./bin/x86_64-linux-musl-g++"]=1 58 x["./bin/x86_64-linux-musl-gcc"]=1 59 } 60 61 function r1(s) { 62 sub("^[.]/[^/]*", ".", s) 63 return s 64 } 65 function s1(repl, s) { 66 sub("^[.]/[^/]*", "./"repl, s) 67 return s 68 } 69 function link(src) { 70 x[$0]=0 71 printf "%s\t%s\n", $0, src 72 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 73 } 74 $1!="."{exit 1} 75 76 77 $2 == "bin" && $3 ~ /^x86_64-linux-musl-/ { target=$3; sub("x86_64-linux-musl-", "", target); link("./command/" target) } 78 79 $2 == "config" { link($0); next } 80 $2 == "keys" { link($0); next } 81 $2 == "zsh" { link($0); next } 82 $2 == "env" { link($0); next } 83 $2 == "command" { link($0); next } 84 $2 == "bin" { link(s1("command", $0)); next } 85 86 $2 == "library.so" { link($0); next } 87 $2 == "library" { link($0); next } 88 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 89 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next } 90 91 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } 92 93 $2 == "man" { link($0); next } 94 $2 == "info" { link($0); next } 95 $2 == "doc" { link($0); next } 96 $2 == "icons" { link($0); next } 97 $2 == "terminfo" { link($0); next } 98 $2 == "data" { link($0); next } 99 $2 == "include" { link($0); next } 100 101 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 102 103 END { 104 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 105 for(fname in x) { 106 if(x[fname]) { 107 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 108 exit 3 109 } 110 } 111 }' >.install-links.new 112 mv .install-links.new .install-links 113