pthbs

Packaging Through Hashed Build Scripts
git clone https://ccx.te2000.cz/git/pthbs
Log | Files | Refs | Submodules | README

musl-cross-make:bootstrap (3540B)


      1 #!/usr/bin/env pthbs-build
      2 #@pragma:nosandbox
      3 #@pragma:nopath
      4 #+musl-cross-make.96e6501dce1d35d3debcc35756f15d7568a3a994a3bb4109b3ab3660715e83d5
      5 #@git:fe915821b652a7fa37b34a596f47d8e20bc72338:musl-cross-make
      6 #@sha256:ab66fc2d1c3ec0359b8e08843c9f33b63e8707efdff5e4cc5c200eae24722cbf:musl-cross-make/sources/binutils-2.33.1.tar.xz
      7 #@sha256:75d5d255a2a273b6e651f82eecfabf6cbcd8eaeae70e86b417384c8f4a58d8d3:musl-cross-make/sources/config.sub
      8 #@sha256:d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b:musl-cross-make/sources/gcc-11.2.0.tar.xz
      9 #@sha256:5275bb04f4863a13516b2f39392ac5e272f5e1bb8057b18aec1c9b79d73d8fb2:musl-cross-make/sources/gmp-6.1.2.tar.bz2
     10 #@sha256:995bc76ccf0c40d752b5ea67c022232a17eef6c9ec80ea74ea742e3c19992813:musl-cross-make/sources/linux-headers-4.19.88-1.tar.xz
     11 #@sha256:6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e:musl-cross-make/sources/mpc-1.1.0.tar.gz
     12 #@sha256:c05e3f02d09e0e9019384cdd58e0f19c64e6db1fd6f5ecf77b4b1c61ca253acc:musl-cross-make/sources/mpfr-4.0.2.tar.bz2
     13 #@sha256:7d5b0b6062521e4627e099e4c9dc8248d32a30285e959b7eecaa780cf8cfd4a4:musl-cross-make/sources/musl-1.2.3.tar.gz
     14 
     15 : ${JOBS:=1}
     16 bootstrap=/home/ccx/versions/musl-cross-make.96e6501dce1d35d3debcc35756f15d7568a3a994a3bb4109b3ab3660715e83d5
     17 printf '%s\n' >musl-cross-make/config.mak \
     18 	"OUTPUT=${pthbs_destdir%/}/home/ccx/versions/$pthbs_package" \
     19 	'GCC_VER=11.2.0' \
     20 	"TARGET=x86_64-linux-musl" \
     21 	'st=-static --static' \
     22 	'fl=-g0 -O2' \
     23 	"bbin=$bootstrap/bin" \
     24 	'COMMON_CONFIG += CFLAGS="${fl}" CXXFLAGS="${fl}" FFLAGS="${fl}" LDFLAGS="-s ${st}"' \
     25 	'COMMON_CONFIG += CC="${bbin}/x86_64-linux-musl-gcc ${st}" CXX="${bbin}/x86_64-linux-musl-g++ ${st}"'
     26 touch musl-cross-make/sources/*
     27 export PATH="$bootstrap/bin:$PATH"
     28 make -j${JOBS:-1} -l$((1+${JOBS:-1})) -C musl-cross-make
     29 make -C musl-cross-make install
     30 "$bootstrap/bin/x86_64-linux-musl-gcc" --version
     31 make -j${JOBS:-1} -l$((1+${JOBS:-1})) -C musl-cross-make
     32 make -C musl-cross-make install
     33 "${pthbs_destdir%/}"'/home/ccx/versions'"/$pthbs_package/bin/"'x86_64-linux-musl-gcc' --version
     34 
     35 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package"
     36 find -type d -o -print | awk -F/ '
     37 BEGIN {
     38 	x["./bin/x86_64-linux-musl-g++"]=1
     39 	x["./bin/x86_64-linux-musl-gcc"]=1
     40 }
     41 
     42 function r1(s) {
     43 	sub("^[.]/[^/]*", ".", s)
     44 	return s
     45 }
     46 function s1(repl, s) {
     47 	sub("^[.]/[^/]*", "./"repl, s)
     48 	return s
     49 }
     50 function link(src) {
     51 	x[$0]=0
     52 	printf "%s\t%s\n", $0, src
     53 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     54 }
     55 $1!="."{exit 1}
     56 
     57 
     58 $2 == "bin" && $3 ~ /^x86_64-linux-musl-/ { target=$3; sub("x86_64-linux-musl-", "", target); link("./command/" target) }
     59 $2 == "command" { link($0); next }
     60 $2 == "bin" { link(s1("command", $0)); next }
     61 
     62 $2 == "library.so" { link($0); next }
     63 $2 == "library" { link($0); next }
     64 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
     65 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next }
     66 
     67 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
     68 
     69 $2 == "man" { link($0); next }
     70 $2 == "info" { link($0); next }
     71 $2 == "doc" { link($0); next }
     72 $2 == "icons" { link($0); next }
     73 $2 == "terminfo" { link($0); next }
     74 
     75 $2 == "include" { link($0); next }
     76 
     77 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
     78 
     79 END {
     80 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
     81 	for(fname in x) {
     82 		if(x[fname]) {
     83 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
     84 			exit 3
     85 		}
     86 	}
     87 }' >.install-links.new
     88 mv .install-links.new .install-links