mrrl

Minimal Reliable Reproducible Linux
git clone https://ccx.te2000.cz/git/mrrl
Log | Files | Refs | Submodules | README

musl-cross-make:oldbootstrap-0 (4078B)


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