ccx-utils (3612B)
1 #!/usr/bin/env pthbs-build 2 #+busybox.d2d7aa00eac6ec561a10d126b1866f22e226a1276307466251e80fd8a4a1ebc7 3 #+busybox-findutils.85b2328981df683d1ae7597eebdf3a332aa4241b936c0030fe3618cec1f4841a 4 #+busybox-awk.4c3f8cc249ba35f1206fcaf2979bcfd66d09b117eeea4e6a939024825a542496 5 #+musl-cross-make.e4735d8572f9b6654a7381ebdfbd62e665d1d1da5e06a56923e89274cc6a510f 6 #+gnu-make.75a726f6c19f7bc10b95a84da3ce72fb785ebdf587504430c6b74cfb6610b728 7 #+skalibs.d3e22646f4396d3d4a8a4c95b19356b3590bcbf747a89cb9733aa3826e0612a0 8 #+s6.b2888ce412a12e54f60be31ae842d7405491fff647b8ee55c00b521bfa1dd4cc 9 #@git:fae441e25a1ac266742ba6446b37ae56c8e57076:ccx-utils 10 11 12 # - build script start - 13 14 build_env_static() { 15 export LD_LIBRARY_PATH="$pthbs_build_environment/library" 16 export CPATH="$pthbs_build_environment/include" 17 export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS" 18 } 19 20 check_static() { 21 local exe || true 22 exe=$pthbs_destdir'/home/ccx/versions'/$pthbs_package/$1 23 if ! test -f $exe; then 24 printf '%s\n' "Error: file '$1' doesn't exist!" 25 exit 1 26 fi 27 local interp_info || true 28 interp_info=$(readelf --string-dump=.interp "$exe") || exit $? 29 if test x '!=' "x$interp_info"; then 30 printf '%s\n' "Error: '$1' is a dynamic binary!" 31 exit 1 32 fi 33 } 34 35 prefix=/home/ccx/versions/$pthbs_package 36 dest=${pthbs_destdir%/}${prefix} 37 cd 'ccx-utils' 38 39 40 build_env_static 41 42 ./link.configure $LDFLAGS 43 cd src 44 for name in \ 45 argv0exec \ 46 nosuid \ 47 pidns_run \ 48 safelink \ 49 spawn-pty \ 50 fdsend \ 51 fdrecv \ 52 fdrecvto \ 53 socketpair \ 54 ptsname \ 55 mtime_to_uuidv7 \ 56 ucspi-socksserver \ 57 ucspi-socksserver-connected \ 58 ucspi-socksserver-access 59 do 60 make $name 61 install -d "${dest}/command" 62 install -m 755 $name "${dest}/command" 63 check_static command/$name 64 done 65 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/spawn-pty"]=1 73 x["./command/argv0exec"]=1 74 x["./command/nosuid"]=1 75 x["./command/pidns_run"]=1 76 x["./command/safelink"]=1 77 x["./command/spawn-pty"]=1 78 x["./command/fdsend"]=1 79 x["./command/fdrecv"]=1 80 x["./command/fdrecvto"]=1 81 x["./command/socketpair"]=1 82 x["./command/ptsname"]=1 83 x["./command/mtime_to_uuidv7"]=1 84 x["./command/ucspi-socksserver"]=1 85 x["./command/ucspi-socksserver-connected"]=1 86 x["./command/ucspi-socksserver-access"]=1 87 } 88 89 function r1(s) { 90 sub("^[.]/[^/]*", ".", s) 91 return s 92 } 93 function s1(repl, s) { 94 sub("^[.]/[^/]*", "./"repl, s) 95 return s 96 } 97 function link(src) { 98 x[$0]=0 99 printf "%s\t%s\n", $0, src 100 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 101 } 102 $1!="."{exit 1} 103 104 105 $2 == "config" { link($0); next } 106 $2 == "keys" { link($0); next } 107 $2 == "zsh" { link($0); next } 108 $2 == "env" { link($0); next } 109 $2 == "command" { link($0); next } 110 $2 == "bin" { link(s1("command", $0)); next } 111 112 $2 == "library.so" { link($0); next } 113 $2 == "library" { link($0); next } 114 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 115 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next } 116 117 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } 118 119 $2 == "man" { link($0); next } 120 $2 == "info" { link($0); next } 121 $2 == "doc" { link($0); next } 122 $2 == "icons" { link($0); next } 123 $2 == "terminfo" { link($0); next } 124 $2 == "data" { link($0); next } 125 $2 == "include" { link($0); next } 126 127 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 128 129 END { 130 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 131 for(fname in x) { 132 if(x[fname]) { 133 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 134 exit 3 135 } 136 } 137 }' >.install-links.new 138 mv .install-links.new .install-links 139