lnstools:bootstrap (3055B)
1 #!/usr/bin/env pthbs-build 2 #@pragma:nosandbox 3 #+musl-cross-make.de554c172179c402cf921f506a2369385ea83330a5bb4ab6bb6a253db9aac258 4 #+gnu-make.6236d2c236f658167aece4d10bc59fa913f7fac60938f31bb5ef4a34bad42a94 5 #+busybox.119bbc99a86bd999b052ed79095bc38c05f6280924ec718a0eb13f1a8d3410c1 6 #+nawk.596c1948e96cbcabfe3954a70deb947de0c73be1ddde41fafe8291bfec04bdd4 7 #+skalibs.4c3cedd3c18d6de9434e80675ec95825ec0a44a420a31be408e11da7bbaed05a 8 #+execline.0e0d5947c43e21848d853596848544a7a1870cdcd6344410641ac5282a31eb60 9 #+libcap.20e3204fda10db5d1cb3d7376786c8794db4d578cc5df31d6427011090174f52 10 #@git:836121d089beff79891389448ee14af3de8c7915:lnstools 11 12 13 # - build script start - 14 15 prefix=/versions/$pthbs_package 16 dest=${pthbs_destdir%/}${prefix} 17 cd 'lnstools' 18 19 export CC="$pthbs_build_environment/command/x86_64-linux-musl-gcc" 20 export CPATH="$pthbs_build_environment/include" 21 export LIBRARY_PATH="$pthbs_build_environment/library" 22 export LDFLAGS="-L$pthbs_build_environment/library" 23 export CFLAGS="-D_GNU_SOURCE -Werror -pipe -std=c11 -fno-exceptions -Og -g" 24 25 sh ./configure --enable-absolute-paths \ 26 --prefix="$prefix" \ 27 --bindir="${prefix}/command" \ 28 --includedir="${prefix}/include" \ 29 --libdir="${prefix}/library" \ 30 --dynlibdir="${prefix}/library.so" 31 32 33 make -j${JOBS:-1} -l$((1+${JOBS:-1})) 34 35 make DESTDIR="$pthbs_destdir" install 36 37 cp build/bin-static/lns-lockdown "$dest"/'command'/ 38 39 40 41 42 cd "$pthbs_destdir/versions/$pthbs_package" 43 find -type d -o -print | awk -F/ ' 44 BEGIN { 45 x["./command/lns-lockdown"]=1 46 x["./command/lns-envuidgid"]=1 47 x["./command/lns-applyuidgid"]=1 48 x["./command/lns-pidns"]=1 49 } 50 51 function r1(s) { 52 sub("^[.]/[^/]*", ".", s) 53 return s 54 } 55 function s1(repl, s) { 56 sub("^[.]/[^/]*", "./"repl, s) 57 return s 58 } 59 function link(src) { 60 x[$0]=0 61 printf "%s\t%s\n", $0, src 62 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 63 } 64 $1!="."{exit 1} 65 $2 == "env" { link($0); next } 66 $2 == ".env-template" { link($0); next } 67 68 $2 == "command" { link($0); next } 69 $2 == "command" { link($0); next } 70 $2 == "bin" { link(s1("command", $0)); next } 71 $2 == "sbin" { link(s1("command", $0)); next } 72 73 $2 == "library.so" { link($0); next } 74 $2 == "library" { link($0); next } 75 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 76 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next } 77 78 $2 == "share" && $3 == "info" { link(s1("info", r1($0))); next } 79 $2 == "share" && $3 == "man" { link(s1("man", r1($0))); next } 80 $2 == "share" && $3 == "doc" { link(s1("doc", r1($0))); next } 81 82 $2 == "config" { link($0); next } 83 $2 == "man" { link($0); next } 84 $2 == "info" { link($0); next } 85 $2 == "doc" { link($0); next } 86 $2 == "data" { link($0); next } 87 $2 == "include" { link($0); next } 88 89 90 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 91 92 END { 93 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 94 retcode = 0 95 for(fname in x) { 96 if(x[fname]) { 97 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 98 retcode = 3 99 } 100 } 101 exit retcode 102 }' >.install-links.new 103 mv .install-links.new .install-links 104