mrrl

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

musl-cross-make (4084B)


      1 {% extends "genlinks" %}
      2 {%- block script %}
      3 #+{{pkg_install_name("musl-cross-make:bootstrap-1")}}
      4 #+{{pkg_install_name("gnu-make:bootstrap")}}
      5 #+{{pkg_install_name("busybox:bootstrap")}}
      6 #@git:{{submodule.current["musl-cross-make"]}}:musl-cross-make
      7 #@sha256:ab66fc2d1c3ec0359b8e08843c9f33b63e8707efdff5e4cc5c200eae24722cbf:musl-cross-make/sources/binutils-2.33.1.tar.xz
      8 #@sha256:75d5d255a2a273b6e651f82eecfabf6cbcd8eaeae70e86b417384c8f4a58d8d3:musl-cross-make/sources/config.sub
      9 #@sha256:d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b:musl-cross-make/sources/gcc-11.2.0.tar.xz
     10 #@sha256:5275bb04f4863a13516b2f39392ac5e272f5e1bb8057b18aec1c9b79d73d8fb2:musl-cross-make/sources/gmp-6.1.2.tar.bz2
     11 #@sha256:bdf76c15229b241e578046b8486106f09534d754ea4cbf105e0660e551fb1669:musl-cross-make/sources/linux-6.5.4.tar.xz
     12 #@sha256:6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e:musl-cross-make/sources/mpc-1.1.0.tar.gz
     13 #@sha256:c05e3f02d09e0e9019384cdd58e0f19c64e6db1fd6f5ecf77b4b1c61ca253acc:musl-cross-make/sources/mpfr-4.0.2.tar.bz2
     14 #@sha256:a9a118bbe84d8764da0ea0d28b3ab3fae8477fc7e4085d90102b8596fc7c75e4:musl-cross-make/sources/musl-1.2.5.tar.gz
     15 #@sha256:4213e75809588e3f32ae0fde8fb11df2dfd6e0e013762ff5ee951c3aadb7ffc0:musl-cross-make/patches/linux-6.5.4/0001-no-rsync-headers.diff
     16 #@sha256:{{files["zpipe.c"]}}:zpipe.c
     17 
     18 : ${JOBS:=1}
     19 
     20 # For validating the compiler
     21 printf '%s\n' 'int main(void) { return 0; }' >true.c
     22 
     23 printf '%s\n' >musl-cross-make/config.mak \
     24 	"OUTPUT=${pthbs_destdir%/}{{versions}}/$pthbs_package" \
     25 	"TARGET={{triplet}}" \
     26 	'GCC_VER=11.2.0' \
     27 	'LINUX_VER=6.5.4' \
     28 	'st=-static --static' \
     29 	'fl=-g0 -O2' \
     30 	'COMMON_CONFIG += CFLAGS="${fl} ${st}" CXXFLAGS="${fl} ${st}" FFLAGS="${fl}" LDFLAGS="-s ${st}"' \
     31 	'COMMON_CONFIG += CC="{{triplet}}-gcc ${st}" CXX="{{triplet}}-g++ ${st}"'
     32 
     33 printf '%s  %s\n' >musl-cross-make/hashes/linux-6.5.4.tar.xz.sha1 \
     34 	24ffca128d47b6c8e5c15efaa2b1c9ebe546c13c  linux-6.5.4.tar.xz
     35 
     36 touch musl-cross-make/sources/*
     37 
     38 # Patch linker path for dynamic executables
     39 make -C musl-cross-make gcc-11.2.0
     40 sed -i -e 's|/lib/ld-musl-|{{versions}}/'"$pthbs_package"'/{{triplet}}/lib/ld-musl-|' musl-cross-make/gcc-11.2.0/gcc/config/*/linux*.h
     41 
     42 
     43 {{make}} -C musl-cross-make || exit $?
     44 make -C musl-cross-make install || exit $?
     45 
     46 dd=$pthbs_destdir/{{versions}}/$pthbs_package
     47 
     48 # Override linker symlink
     49 for linkname in "$dd"'/{{triplet}}/lib/'ld-musl-*so*; do
     50 	ln -s -f libc.so "$linkname"
     51 done
     52 
     53 # Validate the compiler
     54 "$dd"'/bin/{{triplet}}-gcc' --version
     55 "$dd"'/bin/{{triplet}}-gcc' -o true true.c
     56 "$dd"'/bin/{{triplet}}-readelf' --string-dump=.interp true >true.linker
     57 grep -F "$pthbs_package" true.linker
     58 
     59 pkgs="gmp intl mpc mpfr zlib"
     60 #pkgs="$pkgs libbacktrace libcc1 libcpp libdecnumber libiberty lto-plugin"
     61 
     62 for pkg in $pkgs; do
     63 	make -C musl-cross-make/build/local/x86_64-linux-musl/obj_gcc/$pkg prefix=/ DESTDIR="$dd" install
     64 done
     65 cp -va musl-cross-make/gcc-*.orig/zlib/zconf.h musl-cross-make/gcc-*.orig/zlib/zlib.h "$dd/include/"
     66 mkdir -p "$dd/library/pkgconfig"
     67 printf '%s\n' > "$dd/library/pkgconfig/zlib.pc" \
     68 	"prefix={{versions}}/$pthbs_package" \
     69 	'exec_prefix=${prefix}' \
     70 	'includedir=${prefix}/include' \
     71 	'libdir=${exec_prefix}/library' \
     72 	'' \
     73 	'Name: zlib' \
     74 	'Description: zlib compression library' \
     75 	'Version: 1.2.11' \
     76 	'' \
     77 	'Requires:' \
     78 	'Libs: -L${libdir} -lz' \
     79 	'Cflags: -I${includedir}'
     80 
     81 # validate zlib
     82 "$dd"'/bin/{{triplet}}-gcc' -I"$dd/include" -L"$dd/lib" -static -o zpipe zpipe.c -lz
     83 ./zpipe <true.c >true.c.gz
     84 ./zpipe -d <true.c.gz >true.c.2
     85 cmp -s true.c true.c.2
     86 
     87 {% endblock %}
     88 {% block genlinks_begin %}
     89 	x["./bin/{{triplet}}-g++"]=1
     90 	x["./bin/{{triplet}}-gcc"]=1
     91 	x["./lib/libgmp.a"]=1
     92 	x["./lib/libmpc.a"]=1
     93 	x["./lib/libmpfr.a"]=1
     94 	x["./lib/libz.a"]=1
     95 
     96 	x["./include/gmp.h"]=1
     97 	x["./include/mpc.h"]=1
     98 	x["./include/mpf2mpfr.h"]=1
     99 	x["./include/mpfr.h"]=1
    100 	x["./include/zlib.h"]=1
    101 	x["./include/zconf.h"]=1
    102 
    103 {% endblock %}
    104 {% block rules %}
    105 $2 == "bin" && $3 ~ /^{{triplet}}-/ { target=$3; sub("{{triplet}}-", "", target); link("./command/" target) }
    106 {% endblock -%}