libseccomp (3381B)
1 #!/usr/bin/env pthbs-build 2 #+musl-cross-make.98979eb41109d371f19d0637d51116db18c7aeef61fbf804a68094c22a302a78 3 #+gnu-make.ba8d7c64a23885182fc1c9dc0331d52adcdbc45df6000fb81e8e1dd3ee05694b 4 #+busybox.ee3440974794767b833fd3299226771f170d3f8601cf225cb884f0a513db8ab3 5 #+busybox-diffutils.c2ebcfcad050ad71b8e30322a463b5c009f254c7a42e95c627d32665e17134dc 6 #+m4.46e121f61e0af52abf876bf2688ecfe70eeb04185028d6adde0085e865fdfe75 7 #+pkgconf-pkg-config.86f9c193f6ccc64cc2ac696a7e3a258f01b8d0c539312ae37c08ea2354332e90 8 #+gperf.e28c47e99256012f77eda6c66889b6f894f19527c4a0380e63e4f76bece02b16 9 #@untar:-z:sha256:83b6085232d1588c379dc9b9cae47bb37407cf262e6e74993c61ba72d2a784dc:. 10 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=/home/ccx/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/libseccomp" \ 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/'/home/ccx/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 export LDFLAGS="--static" 64 autotools_static libseccomp-2.6.0 65 check_static command/scmp_sys_resolver 66 67 68 69 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package" 70 find -type d -o -print | awk -F/ ' 71 BEGIN { 72 x["./command/scmp_sys_resolver"]=1 73 x["./library/libseccomp.a"]=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