ccx-utils (3328B)
1 #!/usr/bin/env pthbs-build 2 #+musl-cross-make.d0431fc0def788be03da43136972361827de52c8e6f0a6f3890dc57fe32e8ecc 3 #+gnu-make.444e811a68f4f16724e21354b710fad3592e53a2dbf7c0c78658f3d4e7c8e465 4 #+busybox.f4ef3d511c029095beda8d21dd48f7730bec63fb09792ca951402d6620338089 5 #+skalibs.80095d3b5fc0b02710609d76fd585ca9556056300f83a94e4dc094ee3f53fa86 6 #+s6.43f7ad2aaeb2646da287c5bddf7c29c44d3f7b68a976beee75b60da44b54759e 7 #@git:fae441e25a1ac266742ba6446b37ae56c8e57076:ccx-utils 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 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/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