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