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