pthbs

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

musl-cross-make (4230B)


      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:fe915821b652a7fa37b34a596f47d8e20bc72338: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:7d5b0b6062521e4627e099e4c9dc8248d32a30285e959b7eecaa780cf8cfd4a4:musl-cross-make/sources/musl-1.2.3.tar.gz
     15 #@sha256:3ca74cf91b912122ba74d0bbe3faf4979c5c7ad0c5884a6000cb8cbc4e1bbcb2:musl-cross-make/patches/linux-headers-4.19.88-1/0001-asound-time64.diff
     16 #@sha256:4213e75809588e3f32ae0fde8fb11df2dfd6e0e013762ff5ee951c3aadb7ffc0:musl-cross-make/patches/linux-6.5.4/0001-no-rsync-headers.diff
     17 #@sha256:{{files["zpipe.c"]}}:zpipe.c
     18 
     19 : ${JOBS:=1}
     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={{triplet}}" \
     27 	'GCC_VER=11.2.0' \
     28 	'LINUX_VER=6.5.4' \
     29 	'st=-static --static' \
     30 	'fl=-g0 -O2' \
     31 	'COMMON_CONFIG += CFLAGS="${fl} ${st}" CXXFLAGS="${fl} ${st}" FFLAGS="${fl}" LDFLAGS="-s ${st}"' \
     32 	'COMMON_CONFIG += CC="{{triplet}}-gcc ${st}" CXX="{{triplet}}-g++ ${st}"'
     33 
     34 printf '%s  %s\n' >musl-cross-make/hashes/linux-6.5.4.tar.xz.sha1 \
     35 	24ffca128d47b6c8e5c15efaa2b1c9ebe546c13c  linux-6.5.4.tar.xz
     36 
     37 touch musl-cross-make/sources/*
     38 
     39 # Patch linker path for dynamic executables
     40 make -C musl-cross-make gcc-11.2.0
     41 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
     42 
     43 
     44 {{make}} -C musl-cross-make || exit $?
     45 make -C musl-cross-make install || exit $?
     46 
     47 dd=$pthbs_destdir/{{versions}}/$pthbs_package
     48 
     49 # Override linker symlink
     50 for linkname in "$dd"'/{{triplet}}/lib/'ld-musl-*so*; do
     51 	ln -s -f libc.so "$linkname"
     52 done
     53 
     54 # Validate the compiler
     55 "$dd"'/bin/{{triplet}}-gcc' --version
     56 "$dd"'/bin/{{triplet}}-gcc' -o true true.c
     57 "$dd"'/bin/{{triplet}}-readelf' --string-dump=.interp true >true.linker
     58 grep -F "$pthbs_package" true.linker
     59 
     60 pkgs="gmp intl mpc mpfr zlib"
     61 #pkgs="$pkgs libbacktrace libcc1 libcpp libdecnumber libiberty lto-plugin"
     62 
     63 for pkg in $pkgs; do
     64 	make -C musl-cross-make/build/local/x86_64-linux-musl/obj_gcc/$pkg prefix=/ DESTDIR="$dd" install
     65 done
     66 cp -va musl-cross-make/gcc-*.orig/zlib/zconf.h musl-cross-make/gcc-*.orig/zlib/zlib.h "$dd/include/"
     67 mkdir -p "$dd/library/pkgconfig"
     68 printf '%s\n' > "$dd/library/pkgconfig/zlib.pc" \
     69 	"prefix={{versions}}/$pthbs_package" \
     70 	'exec_prefix=${prefix}' \
     71 	'includedir=${prefix}/include' \
     72 	'libdir=${exec_prefix}/library' \
     73 	'' \
     74 	'Name: zlib' \
     75 	'Description: zlib compression library' \
     76 	'Version: 1.2.11' \
     77 	'' \
     78 	'Requires:' \
     79 	'Libs: -L${libdir} -lz' \
     80 	'Cflags: -I${includedir}'
     81 
     82 # validate zlib
     83 "$dd"'/bin/{{triplet}}-gcc' -I"$dd/include" -L"$dd/lib" -static -o zpipe zpipe.c -lz
     84 ./zpipe <true.c >true.c.gz
     85 ./zpipe -d <true.c.gz >true.c.2
     86 cmp -s true.c true.c.2
     87 
     88 {% endblock %}
     89 {% block genlinks_begin %}
     90 	x["./bin/{{triplet}}-g++"]=1
     91 	x["./bin/{{triplet}}-gcc"]=1
     92 	x["./lib/libgmp.a"]=1
     93 	x["./lib/libmpc.a"]=1
     94 	x["./lib/libmpfr.a"]=1
     95 	x["./lib/libz.a"]=1
     96 
     97 	x["./include/gmp.h"]=1
     98 	x["./include/mpc.h"]=1
     99 	x["./include/mpf2mpfr.h"]=1
    100 	x["./include/mpfr.h"]=1
    101 	x["./include/zlib.h"]=1
    102 	x["./include/zconf.h"]=1
    103 
    104 {% endblock %}
    105 {% block rules %}
    106 $2 == "bin" && $3 ~ /^{{triplet}}-/ { target=$3; sub("{{triplet}}-", "", target); link("./command/" target) }
    107 {% endblock -%}