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