libseccomp (2676B)
1 #!/usr/bin/env pthbs-build 2 #+musl-cross-make.675bc960d97b88b341ba4c64ea1b10f6afd9c9f0394ed84ca848768c5e1b646c 3 #+gnu-make.152d99fd58e3130b4bd4d23833643ca418555a0560e88962cd8a28ffcd9a9ab7 4 #+busybox.7818e9d6df97d97317c8fcdf404811731aa0c5c3ab7eb6aec00c9652b6da511c 5 #+busybox-diffutils.3579038707d7520c09339ee4fc3b67ef03caeeaf8fff3b6f93c51ace141a4393 6 #+pkgconf-pkg-config.4c1feadf205ba11eec4f487eee4e6b0bdc8601f0975f332c70272cc56e2e3c42 7 #@untar:-z:sha256:248a2c8a4d9b9858aa6baf52712c34afefcf9c9e94b76dce02c1c9aa25fb3375:. 8 9 check_static() { 10 local exe || true 11 exe=$pthbs_destdir/'/versions'/$pthbs_package/$1 12 if ! test -f $exe; then 13 printf '%s\n' "Error: file '$1' doesn't exist!" 14 exit 1 15 fi 16 interp_info=$(readelf --string-dump=.interp "$exe") || exit $? 17 if test x '!=' "x$interp_info"; then 18 printf '%s\n' "Error: '$1' is a dynamic binary!" 19 exit 1 20 fi 21 } 22 build_env_static() { 23 export LD_LIBRARY_PATH="$pthbs_build_environment/library" 24 export CPATH="$pthbs_build_environment/include" 25 export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS" 26 } 27 def_prefix() { 28 prefix=/versions/$pthbs_package 29 } 30 def_dest() { 31 dest=${pthbs_destdir%/}//versions/$pthbs_package 32 } 33 def_prefix 34 LDFLAGS=--static 35 build_env_static 36 37 cd libseccomp-2.5.5 38 autotools_static libseccomp-2.5.5 39 40 check_static command/scmp_sys_resolver 41 42 43 cd "$pthbs_destdir/versions/$pthbs_package" 44 find -type d -o -print | awk -F/ ' 45 BEGIN { 46 x["./command/scmp_sys_resolver"]=1 47 x["./library/libseccomp.a"]=1 48 } 49 50 function r1(s) { 51 sub("^[.]/[^/]*", ".", s) 52 return s 53 } 54 function s1(repl, s) { 55 sub("^[.]/[^/]*", "./"repl, s) 56 return s 57 } 58 function link(src) { 59 x[$0]=0 60 printf "%s\t%s\n", $0, src 61 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 62 } 63 $1!="."{exit 1} 64 65 66 $2 == "command" { link($0); next } 67 $2 == "bin" { link(s1("command", $0)); next } 68 69 $2 == "library.so" { link($0); next } 70 $2 == "library" { link($0); next } 71 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 72 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next } 73 74 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } 75 76 $2 == "man" { link($0); next } 77 $2 == "info" { link($0); next } 78 $2 == "doc" { link($0); next } 79 $2 == "icons" { link($0); next } 80 $2 == "terminfo" { link($0); next } 81 $2 == "data" { link($0); next } 82 $2 == "include" { link($0); next } 83 84 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 85 86 END { 87 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 88 for(fname in x) { 89 if(x[fname]) { 90 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 91 exit 3 92 } 93 } 94 }' >.install-links.new 95 mv .install-links.new .install-links