ccx-utils (3364B)
1 #!/usr/bin/env pthbs-build 2 #+musl-cross-make.98979eb41109d371f19d0637d51116db18c7aeef61fbf804a68094c22a302a78 3 #+gnu-make.ba8d7c64a23885182fc1c9dc0331d52adcdbc45df6000fb81e8e1dd3ee05694b 4 #+busybox.ee3440974794767b833fd3299226771f170d3f8601cf225cb884f0a513db8ab3 5 #+skalibs.25eb68b4f9146b6b700c824f55528e30c9d34686368d4485ed04b66adbf34c39 6 #+s6.087ce2658d9f8b1c38f8f6999d2cfef0bf3b53afaf07f01495091883c154899e 7 #@git:fae441e25a1ac266742ba6446b37ae56c8e57076:ccx-utils 8 9 check_static() { 10 local exe || true 11 exe=$pthbs_destdir/'/home/ccx/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=/home/ccx/versions/$pthbs_package 29 } 30 def_dest() { 31 dest=${pthbs_destdir%/}//home/ccx/versions/$pthbs_package 32 } 33 build_env_static 34 def_prefix 35 36 ./ccx-utils/link.configure $LDFLAGS 37 cd ccx-utils/src 38 39 for name in \ 40 argv0exec \ 41 nosuid \ 42 pidns_run \ 43 safelink \ 44 spawn-pty \ 45 fdsend \ 46 fdrecv \ 47 fdrecvto \ 48 socketpair \ 49 ptsname \ 50 mtime_to_uuidv7 \ 51 ucspi-socksserver \ 52 ucspi-socksserver-connected \ 53 ucspi-socksserver-access 54 do 55 make $name 56 install -d "$pthbs_destdir/$prefix/command" 57 install -m 755 $name "$pthbs_destdir/$prefix/command" 58 check_static command/$name 59 done 60 61 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package" 62 find -type d -o -print | awk -F/ ' 63 BEGIN { 64 x["./command/spawn-pty"]=1 65 x["./command/argv0exec"]=1 66 x["./command/nosuid"]=1 67 x["./command/pidns_run"]=1 68 x["./command/safelink"]=1 69 x["./command/spawn-pty"]=1 70 x["./command/fdsend"]=1 71 x["./command/fdrecv"]=1 72 x["./command/fdrecvto"]=1 73 x["./command/socketpair"]=1 74 x["./command/ptsname"]=1 75 x["./command/mtime_to_uuidv7"]=1 76 x["./command/ucspi-socksserver"]=1 77 x["./command/ucspi-socksserver-connected"]=1 78 x["./command/ucspi-socksserver-access"]=1} 79 80 function r1(s) { 81 sub("^[.]/[^/]*", ".", s) 82 return s 83 } 84 function s1(repl, s) { 85 sub("^[.]/[^/]*", "./"repl, s) 86 return s 87 } 88 function link(src) { 89 x[$0]=0 90 printf "%s\t%s\n", $0, src 91 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 92 } 93 $1!="."{exit 1} 94 95 96 $2 == "command" { link($0); next } 97 $2 == "bin" { link(s1("command", $0)); next } 98 99 $2 == "library.so" { link($0); next } 100 $2 == "library" { link($0); next } 101 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 102 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next } 103 104 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } 105 106 $2 == "man" { link($0); next } 107 $2 == "info" { link($0); next } 108 $2 == "doc" { link($0); next } 109 $2 == "icons" { link($0); next } 110 $2 == "terminfo" { link($0); next } 111 $2 == "data" { link($0); next } 112 $2 == "include" { link($0); next } 113 114 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 115 116 END { 117 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 118 for(fname in x) { 119 if(x[fname]) { 120 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 121 exit 3 122 } 123 } 124 }' >.install-links.new 125 mv .install-links.new .install-links