strace (3549B)
1 #!/usr/bin/env pthbs-build 2 #+musl-cross-make.d0431fc0def788be03da43136972361827de52c8e6f0a6f3890dc57fe32e8ecc 3 #+gnu-make.444e811a68f4f16724e21354b710fad3592e53a2dbf7c0c78658f3d4e7c8e465 4 #+busybox.f4ef3d511c029095beda8d21dd48f7730bec63fb09792ca951402d6620338089 5 #+busybox-diffutils.4a0933977737282afcd82b39d435b50946a700fe13472d24e4580a41fa852123 6 #+m4.3cffaef6909a65493ddc9aba4c53f77dc594ff5ab8b58c57acaa34c654b09ff3 7 #+patch.9d8b2c370a0ccf6e5ad48c27070ff1da2d30d41327fd5711a76cf570b34ae523 8 #+libunwind.b5dbb4a90e53593d6531d86de48d16560e66c0ff43dbab3d616530f99f41bafd 9 #@untar:-J:sha256:e209daf0ee038ca5adcc4c277e9273b4d51f46a2ff86da575d36742ac3508a17:. 10 #@sha256:37d93db7135d47852dbe763f1b18b3aeab142431a6f5268a17fc700387a326e4:strace-6.5-static.patch 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/strace" \ 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 cd strace-6.13 64 patch -p1 <../strace-6.5-static.patch 65 autotools_static . --with-unwind --without-libdw --enable-mpers=check 66 check_static command/strace 67 68 69 70 cd "$pthbs_destdir/versions/$pthbs_package" 71 find -type d -o -print | awk -F/ ' 72 BEGIN { 73 x["./command/strace"]=1 74 x["./command/strace-log-merge"]=1 75 x["./man/man1/strace.1"]=1 76 x["./man/man1/strace-log-merge.1"]=1 77 } 78 79 function r1(s) { 80 sub("^[.]/[^/]*", ".", s) 81 return s 82 } 83 function s1(repl, s) { 84 sub("^[.]/[^/]*", "./"repl, s) 85 return s 86 } 87 function link(src) { 88 x[$0]=0 89 printf "%s\t%s\n", $0, src 90 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 91 } 92 $1!="."{exit 1} 93 94 95 $2 == "command" { link($0); next } 96 $2 == "bin" { link(s1("command", $0)); next } 97 98 $2 == "library.so" { link($0); next } 99 $2 == "library" { link($0); next } 100 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 101 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next } 102 103 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } 104 105 $2 == "man" { link($0); next } 106 $2 == "info" { link($0); next } 107 $2 == "doc" { link($0); next } 108 $2 == "icons" { link($0); next } 109 $2 == "terminfo" { link($0); next } 110 $2 == "data" { link($0); next } 111 $2 == "include" { link($0); next } 112 113 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 114 115 END { 116 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 117 for(fname in x) { 118 if(x[fname]) { 119 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 120 exit 3 121 } 122 } 123 }' >.install-links.new 124 mv .install-links.new .install-links