libcap (3603B)
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 #+busybox-diffutils.24775f761d337796ffe81623350e4bf2f039067f593411146bfeb9c80567d182 8 #+pkgconf-pkg-config.2af12027cd145d8e8d3961bf73608011ba873a8f7ee9646708ac87d0fcb055c9 9 #@untar:-J:sha256:f311f8f3dad84699d0566d1d6f7ec943a9298b28f714cae3c931dfd57492d7eb:. 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 'libcap-2.69' 38 sed -i '1 s|^#!/bin/bash|#!/bin/sh|' progs/*.sh 39 40 41 LDFLAGS=--static 42 build_env_static 43 44 45 make -j1 \ 46 DESTDIR="$pthbs_destdir" \ 47 SHARED=no DYNAMIC=no LIBCSTATIC=yes \ 48 prefix="$prefix" \ 49 exec_prefix="$prefix" \ 50 lib_prefix="$prefix" \ 51 inc_prefix="$prefix" \ 52 man_prefix="$prefix/share" \ 53 MANDIR="$prefix/man" \ 54 sbin=command \ 55 SBINDIR="$prefix/command" \ 56 INCDIR="$prefix/include" \ 57 lib=library \ 58 LIBDIR="$prefix/library" \ 59 PKGCONFIGDIR="$prefix/library/pkgconfig" \ 60 CAPSH_SHELL="'-DSHELL=\"$(which sh)\"'" \ 61 LDFLAGS="$LDFLAGS" \ 62 all install 63 64 check_static command/capsh 65 check_static command/getcap 66 check_static command/setcap 67 check_static command/getpcaps 68 69 70 71 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package" 72 find -type d -o -print | awk -F/ ' 73 BEGIN { 74 x["./command/capsh"]=1 75 x["./command/getcap"]=1 76 x["./command/setcap"]=1 77 x["./command/getpcaps"]=1 78 x["./library/libcap.a"]=1 79 } 80 81 function r1(s) { 82 sub("^[.]/[^/]*", ".", s) 83 return s 84 } 85 function s1(repl, s) { 86 sub("^[.]/[^/]*", "./"repl, s) 87 return s 88 } 89 function link(src) { 90 x[$0]=0 91 printf "%s\t%s\n", $0, src 92 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 93 } 94 $1!="."{exit 1} 95 96 97 $2 == "config" { link($0); next } 98 $2 == "keys" { link($0); next } 99 $2 == "zsh" { link($0); next } 100 $2 == "env" { link($0); next } 101 $2 == "command" { link($0); next } 102 $2 == "bin" { link(s1("command", $0)); next } 103 104 $2 == "library.so" { link($0); next } 105 $2 == "library" { link($0); next } 106 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 107 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next } 108 109 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } 110 111 $2 == "man" { link($0); next } 112 $2 == "info" { link($0); next } 113 $2 == "doc" { link($0); next } 114 $2 == "icons" { link($0); next } 115 $2 == "terminfo" { link($0); next } 116 $2 == "data" { link($0); next } 117 $2 == "include" { link($0); next } 118 119 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 120 121 END { 122 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 123 for(fname in x) { 124 if(x[fname]) { 125 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 126 exit 3 127 } 128 } 129 }' >.install-links.new 130 mv .install-links.new .install-links 131