musl-cross-make (4203B)
1 {%- set pkg_source="git" -%} 2 {%- set src_dir="musl-cross-make" -%} 3 {% extends "genlinks" %} 4 {%- block template_deps -%} 5 #@pragma:nofail_digest 6 {% endblock %} 7 {% block configure -%} 8 # silence unpacking of tarballs 9 sed -i -e 's|tar \([zjJ]\)xvf |tar \1xf |' ./Makefile 10 11 cat >./config.mak <<EOF 12 OUTPUT=${pthbs_destdir%/}{{versions}}/$pthbs_package 13 TARGET={{triplet}} 14 GCC_VER={{gcc_ver}} 15 EOF 16 {% endblock %} 17 {% block build_and_install -%} 18 # make sure sources are considered fresh by make 19 touch ./sources/* 20 21 ${CC:-gcc} --version 22 ${CC:-gcc} -dumpmachine 23 cat -n config.mak 24 25 # Patch linker path for dynamic executables 26 make gcc-{{gcc_ver|shesc}} 27 {#- TODO: replace /lib with /{{dynlibdir}} #} 28 sed -i -e 's|/lib/ld-musl-|{{versions}}/'"$pthbs_package"'/{{triplet}}/lib/ld-musl-|' ./gcc-{{gcc_ver|shesc}}/gcc/config/*/linux*.h 29 {{make}} || make -d || exit $? 30 make install || exit $? 31 32 # Override linker symlink 33 for linkname in "$dest"'/{{triplet}}/lib/'ld-musl-*so*; do 34 ln -s -f libc.so "$linkname" 35 done 36 37 # Validate the C compiler 38 "$dest"/bin/{{triplet}}-gcc --version 39 printf '%s\n' 'int main(void) { return 0; }' >true.c 40 "$dest"/bin/{{triplet}}-gcc -o true-dl true.c 41 "$dest"/bin/{{triplet}}-readelf --string-dump=.interp true-dl >true.linker 42 grep -F "$pthbs_package" true.linker 43 {#- dynamic linker is not yet installed, 44 would have to patchelf to test dynamic executables, 45 test static one instead #} 46 "$dest"/bin/{{triplet}}-gcc -static -o true-sl true.c 47 ./true-sl 48 49 # Validate the C++ compiler 50 "$dest"/bin/{{triplet}}-g++ --version 51 printf '%s\n' >sort.cpp ' 52 #include <iostream> 53 #include <vector> 54 #include <algorithm> 55 #include <iterator> 56 int main() { 57 using namespace std; 58 istream_iterator<int> first(cin); 59 istream_iterator<int> last; 60 vector<int> vec(first, last); 61 sort(vec.begin(), vec.end()); 62 cout << "Sorted:" << endl; 63 copy(vec.begin(), vec.end(), ostream_iterator<int>(cout, "\n")); 64 return 0; 65 } 66 ' 67 "$dest"/bin/{{triplet}}-g++ -o sort-dl sort.cpp 68 "$dest"/bin/{{triplet}}-readelf --string-dump=.interp sort-dl >sort.linker 69 grep -F "$pthbs_package" sort.linker 70 "$dest"/bin/{{triplet}}-g++ -static -o sort-sl sort.cpp 71 ./sort-sl >sort.out <<EOF 72 5 73 3 74 1 75 2 76 4 77 EOF 78 printf '%s\n' >sort.expected Sorted: 1 2 3 4 5 79 cmp sort.out sort.expected 80 81 if which dejagnu 2>/dev/null; then 82 {{make}} -C build/local/x86_64-linux-musl/obj_gcc -k check-gcc 83 mkdir "$dest/test-results" 84 find build/local/x86_64-linux-musl/obj_gcc \ 85 -name '*.sum' -exec mv -v '{}' "$dest/test-results/" \; 86 fi 87 88 {% endblock build_and_install %} 89 {% block genlinks_begin %} 90 x["./bin/{{triplet}}-g++"]=1 91 x["./bin/{{triplet}}-gcc"]=1 92 {#- 93 x["./{{triplet}}/{{includedir}}/assert.h"]=1 # standard headers as per C11 94 x["./{{triplet}}/{{includedir}}/complex.h"]=1 95 x["./{{triplet}}/{{includedir}}/ctype.h"]=1 96 x["./{{triplet}}/{{includedir}}/errno.h"]=1 97 x["./{{triplet}}/{{includedir}}/fenv.h"]=1 98 x["./{{triplet}}/{{includedir}}/float.h"]=1 99 x["./{{triplet}}/{{includedir}}/inttypes.h"]=1 100 x["./{{triplet}}/{{includedir}}/iso646.h"]=1 101 x["./{{triplet}}/{{includedir}}/limits.h"]=1 102 x["./{{triplet}}/{{includedir}}/locale.h"]=1 103 x["./{{triplet}}/{{includedir}}/math.h"]=1 104 x["./{{triplet}}/{{includedir}}/setjmp.h"]=1 105 x["./{{triplet}}/{{includedir}}/signal.h"]=1 106 x["./{{triplet}}/{{includedir}}/stdalign.h"]=1 107 x["./{{triplet}}/{{includedir}}/stdarg.h"]=1 108 # x["./{{triplet}}/{{includedir}}/stdatomic.h"]=1 # in ./lib/gcc/... 109 x["./{{triplet}}/{{includedir}}/stdbool.h"]=1 110 x["./{{triplet}}/{{includedir}}/stddef.h"]=1 111 x["./{{triplet}}/{{includedir}}/stdint.h"]=1 112 x["./{{triplet}}/{{includedir}}/stdio.h"]=1 113 x["./{{triplet}}/{{includedir}}/stdlib.h"]=1 114 x["./{{triplet}}/{{includedir}}/stdnoreturn.h"]=1 115 x["./{{triplet}}/{{includedir}}/string.h"]=1 116 x["./{{triplet}}/{{includedir}}/tgmath.h"]=1 117 x["./{{triplet}}/{{includedir}}/threads.h"]=1 118 x["./{{triplet}}/{{includedir}}/time.h"]=1 119 x["./{{triplet}}/{{includedir}}/uchar.h"]=1 120 x["./{{triplet}}/{{includedir}}/wchar.h"]=1 121 x["./{{triplet}}/{{includedir}}/wctype.h"]=1 122 #} 123 {% endblock %} 124 {% block genlinks_rules %} 125 $2 == "bin" && $3 ~ /^{{triplet}}-/ { target=$3; sub("{{triplet}}-", "", target); link("./{{bindir}}/" target) } 126 {% endblock -%}