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