gnu-make:bootstrap (3149B)
1 #!/usr/bin/env pthbs-build 2 #@pragma:nosandbox 3 #@pragma:nopath 4 #+musl-cross-make.935182e555695bf1b9f401d79404e8c598026db9f8b93e0be41d176a782e932a 5 #@untar:-z:sha256:dd16fb1d67bfab79a72f5e8390735c49e3e8e70b4945a15ab1f81ddb78658fb3:. 6 7 build_env_static() { 8 export LD_LIBRARY_PATH="$pthbs_build_environment/library" 9 export CPATH="$pthbs_build_environment/include" 10 export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS" 11 } 12 autotools_config() { 13 prefix=/versions/$pthbs_package 14 ./configure -C \ 15 --prefix="$prefix" \ 16 --build="$(${CC:-gcc} -dumpmachine)" \ 17 --bindir="$prefix/command" \ 18 --sbindir="$prefix/command" \ 19 --infodir="$prefix/info" \ 20 --localedir="$prefix/locale" \ 21 --mandir="$prefix/man" \ 22 --libdir="$prefix/library" \ 23 --docdir="$prefix/doc/gnu-make:bootstrap" \ 24 --datadir="$prefix/data" \ 25 --datarootdir="$prefix/data" \ 26 --localstatedir='/var/pthbs' \ 27 "$@" 28 29 } 30 31 autotools() { 32 cd "$1" 33 shift 34 autotools_config "$@" 35 make -j${JOBS:-1} -l$((1+${JOBS:-1})) 36 make DESTDIR="$pthbs_destdir" install 37 } 38 39 autotools_static() { 40 build_env_static 41 autotools "$@" --enable-static --disable-shared 42 } 43 check_static() { 44 local exe || true 45 exe=$pthbs_destdir/'/versions'/$pthbs_package/$1 46 if ! test -f $exe; then 47 printf '%s\n' "Error: file '$1' doesn't exist!" 48 exit 1 49 fi 50 interp_info=$(readelf --string-dump=.interp "$exe") || exit $? 51 if test x '!=' "x$interp_info"; then 52 printf '%s\n' "Error: '$1' is a dynamic binary!" 53 exit 1 54 fi 55 } 56 57 58 mcm=/versions/musl-cross-make.935182e555695bf1b9f401d79404e8c598026db9f8b93e0be41d176a782e932a 59 60 export PATH="$mcm/bin:$PATH" 61 export CC="$mcm/bin/x86_64-linux-musl-gcc" 62 export CXX="$mcm/bin/x86_64-linux-musl-g++" 63 export CFLAGS="-D_GNU_SOURCE" 64 export LDFLAGS="-static" 65 66 autotools make-4.4.1 --enable-static --disable-shared --disable-nls 67 68 69 cd "$pthbs_destdir/versions/$pthbs_package" 70 find -type d -o -print | awk -F/ ' 71 BEGIN { 72 x["./command/make"]=1 73 x["./man/man1/make.1"]=1 74 } 75 76 function r1(s) { 77 sub("^[.]/[^/]*", ".", s) 78 return s 79 } 80 function s1(repl, s) { 81 sub("^[.]/[^/]*", "./"repl, s) 82 return s 83 } 84 function link(src) { 85 x[$0]=0 86 printf "%s\t%s\n", $0, src 87 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 88 } 89 $1!="."{exit 1} 90 91 92 $2 == "command" { link($0); next } 93 $2 == "bin" { link(s1("command", $0)); next } 94 95 $2 == "library.so" { link($0); next } 96 $2 == "library" { link($0); next } 97 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 98 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next } 99 100 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } 101 102 $2 == "man" { link($0); next } 103 $2 == "info" { link($0); next } 104 $2 == "doc" { link($0); next } 105 $2 == "icons" { link($0); next } 106 $2 == "terminfo" { link($0); next } 107 $2 == "data" { link($0); next } 108 $2 == "include" { link($0); next } 109 110 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 111 112 END { 113 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 114 for(fname in x) { 115 if(x[fname]) { 116 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 117 exit 3 118 } 119 } 120 }' >.install-links.new 121 mv .install-links.new .install-links