musl-cross-make:oldbootstrap-1 (4449B)
1 {%- import "package_sets" as ps -%} 2 #!/usr/bin/env pthbs-build 3 #@pragma:nofail_digest 4 #@pragma:nosandbox 5 #@pragma:nopath 6 #+{{pkg_install_name("musl-cross-make:bootstrap-0")}} 7 #+{{pkg_install_name("nawk:bootstrap")}} 8 {{ ps.mcm_sources( 9 gcc="gcc-14.3.0.tar.xz", 10 linux="linux-6.15.7.tar.xz", 11 musl="musl-1.2.5.tar.gz", 12 binutils="binutils-2.44.tar.gz", 13 gmp="gmp-6.3.0.tar.xz", 14 mpfr="mpfr-4.2.2.tar.xz", 15 mpc="mpc-1.3.1.tar.gz" 16 ) }} 17 #@sha256:4213e75809588e3f32ae0fde8fb11df2dfd6e0e013762ff5ee951c3aadb7ffc0:musl-cross-make/patches/linux-6.15.7/0001-no-rsync-headers.diff 18 #@git:{{submodule.current["musl-cross-make"]}}:musl-cross-make 19 20 21 # - build script start - 22 23 prefix={{versions}}/$pthbs_package 24 dest=${pthbs_destdir%/}${prefix} 25 cd '.' 26 27 bootstrap={{versions}}/{{pkg_install_name("musl-cross-make:bootstrap-0")}} 28 "$bootstrap/bin/{{triplet}}-gcc" --version 29 30 # For validating the compiler 31 printf '%s\n' 'int main(void) { return 0; }' >true.c 32 33 printf '%s\n' >musl-cross-make/config.mak \ 34 "OUTPUT=${pthbs_destdir%/}{{versions}}/$pthbs_package" \ 35 'GCC_VER=14.3.0' \ 36 'LINUX_VER=6.15.7' \ 37 'MUSL_VER=1.2.5' \ 38 'BINUTILS_VER=2.44' \ 39 'GMP_VER=6.3.0' \ 40 'MPC_VER=1.3.1' \ 41 'MPFR_VER=4.2.2' \ 42 "TARGET={{triplet}}" \ 43 'st=-static --static' \ 44 'fl=-g0 -O2' \ 45 "bbin=$bootstrap/bin" \ 46 'COMMON_CONFIG += CFLAGS="${fl}" CXXFLAGS="${fl}" FFLAGS="${fl}" LDFLAGS="-s ${st}"' \ 47 'COMMON_CONFIG += CC="${bbin}/{{triplet}}-gcc ${st}" CXX="${bbin}/{{triplet}}-g++ ${st}"' 48 49 touch musl-cross-make/sources/* 50 51 52 # Patch linker path for dynamic executables 53 make -C musl-cross-make gcc-14.3.0 54 sed -i -e 's|/lib/ld-musl-|{{versions}}/'"$pthbs_package"'/{{triplet}}/lib/ld-musl-|' musl-cross-make/gcc-14.3.0/gcc/config/*/linux*.h 55 56 export PATH="$pthbs_build_environment/command:$PATH" 57 make -j${JOBS:-1} -l$((1+${JOBS:-1})) -C musl-cross-make 58 make -C musl-cross-make install 59 60 mv "$dest/{{triplet}}/include" "$dest/" 61 mv "$dest/bin" "$dest/command" 62 mv "$dest/{{triplet}}/bin"/* "$dest/command/" 63 64 ln -s ../include "$dest/{{triplet}}/include" 65 ln -s ./command "$dest/bin" 66 ln -s ../command "$dest/{{triplet}}/bin" 67 68 # Override linker symlink 69 for linkname in "${pthbs_destdir%/}"'{{versions}}/'"$pthbs_package"'/{{triplet}}/lib/'ld-musl-*so*; do 70 ln -s -f libc.so "$linkname" 71 done 72 73 # Validate the compiler 74 "$dest/command/"'{{triplet}}-gcc' --version 75 "$dest/command/"'{{triplet}}-gcc' -o true true.c 76 "$dest/command/"'{{triplet}}-readelf' --string-dump=.interp true >true.linker 77 grep -F "$pthbs_package" true.linker 78 79 80 81 82 cd "$pthbs_destdir{{versions}}/$pthbs_package" 83 84 find -type d -o -print | awk -F/ ' 85 BEGIN { 86 x["./command/{{triplet}}-g++"]=1 87 x["./command/{{triplet}}-gcc"]=1 88 x["./include/linux/landlock.h"]=1 89 } 90 91 function r1(s) { 92 sub("^[.]/[^/]*", ".", s) 93 return s 94 } 95 function s1(repl, s) { 96 sub("^[.]/[^/]*", "./"repl, s) 97 return s 98 } 99 function link(src) { 100 x[$0]=0 101 printf "%s\t%s\n", $0, src 102 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 103 } 104 $1!="."{exit 1} 105 106 107 $2 == "command" && $3 ~ /^{{triplet}}-/ && ! ( \ 108 $3 == "{{triplet}}-ar" || \ 109 $3 == "{{triplet}}-as" || \ 110 $3 == "{{triplet}}-ld" || \ 111 $3 == "{{triplet}}-ld.bfd" || \ 112 $3 == "{{triplet}}-nm" || \ 113 $3 == "{{triplet}}-objcopy" || \ 114 $3 == "{{triplet}}-objdump" || \ 115 $3 == "{{triplet}}-ranlib" || \ 116 $3 == "{{triplet}}-readelf" || \ 117 $3 == "{{triplet}}-strip" \ 118 ) { 119 target=$3 120 sub("{{triplet}}-", "", target) 121 link("./command/" target) 122 } 123 $2 == "command" { link($0); next } 124 125 $2 == "config" { link($0); next } 126 $2 == "keys" { link($0); next } 127 $2 == "zsh" { link($0); next } 128 $2 == "env" { link($0); next } 129 130 $2 == "library.so" { link($0); next } 131 $2 == "library" { link($0); next } 132 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 133 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next } 134 135 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } 136 137 $2 == "man" { link($0); next } 138 $2 == "info" { link($0); next } 139 $2 == "doc" { link($0); next } 140 $2 == "icons" { link($0); next } 141 $2 == "terminfo" { link($0); next } 142 $2 == "data" { link($0); next } 143 $2 == "include" { link($0); next } 144 145 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 146 147 END { 148 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 149 for(fname in x) { 150 if(x[fname]) { 151 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 152 exit 3 153 } 154 } 155 }' >.install-links.new 156 mv .install-links.new .install-links 157 158 {# extra line for matching hash #}