libelf (2759B)
1 #!/usr/bin/env pthbs-build 2 #+musl-cross-make.d0431fc0def788be03da43136972361827de52c8e6f0a6f3890dc57fe32e8ecc 3 #+gnu-make.444e811a68f4f16724e21354b710fad3592e53a2dbf7c0c78658f3d4e7c8e465 4 #+busybox.f4ef3d511c029095beda8d21dd48f7730bec63fb09792ca951402d6620338089 5 #+busybox-diffutils.4a0933977737282afcd82b39d435b50946a700fe13472d24e4580a41fa852123 6 #+zstd.a83f72c5953bd6b7afc171528a503710b3144bf9197961833fd27926b0a18137 7 #@git:288355d104ff9930520c0283fe82556c6cc5c16f:libelf 8 9 build_env_static() { 10 export LD_LIBRARY_PATH="$pthbs_build_environment/library" 11 export CPATH="$pthbs_build_environment/include" 12 export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS" 13 } 14 prefix=/versions/$pthbs_package 15 build_env_static 16 cd libelf 17 make -j${JOBS:-1} -l$((1+${JOBS:-1})) PREFIX="$prefix" \ 18 DESTDIR="$pthbs_destdir" \ 19 INCDIR="$prefix/include" \ 20 LIBDIR="$prefix/library" \ 21 install-static 22 23 mkdir -p "$pthbs_destdir/${prefix#/}/library/pkgconfig" 24 printf '%s\n' > "$pthbs_destdir/${prefix#/}/library/pkgconfig/libelf.pc" \ 25 "prefix=/versions/$pthbs_package" \ 26 'exec_prefix=${prefix}' \ 27 'includedir=${prefix}/include' \ 28 'libdir=${exec_prefix}/library' \ 29 '' \ 30 'Name: libelf' \ 31 'Description: standalone libelf' \ 32 'Version: 0.193' \ 33 '' \ 34 'Requires:' \ 35 'Libs: -L${libdir} -lelf -lz -lzstd' \ 36 'Cflags: -I${includedir}' 37 38 39 cd "$pthbs_destdir/versions/$pthbs_package" 40 find -type d -o -print | awk -F/ ' 41 BEGIN { 42 x["./library/libelf.a"]=1 43 x["./library/pkgconfig/libelf.pc"]=1 44 x["./include/libelf.h"]=1 45 x["./include/gelf.h"]=1 46 x["./include/nlist.h"]=1 47 } 48 49 function r1(s) { 50 sub("^[.]/[^/]*", ".", s) 51 return s 52 } 53 function s1(repl, s) { 54 sub("^[.]/[^/]*", "./"repl, s) 55 return s 56 } 57 function link(src) { 58 x[$0]=0 59 printf "%s\t%s\n", $0, src 60 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 61 } 62 $1!="."{exit 1} 63 64 65 $2 == "command" { link($0); next } 66 $2 == "bin" { link(s1("command", $0)); next } 67 68 $2 == "library.so" { link($0); next } 69 $2 == "library" { link($0); next } 70 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 71 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next } 72 73 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } 74 75 $2 == "man" { link($0); next } 76 $2 == "info" { link($0); next } 77 $2 == "doc" { link($0); next } 78 $2 == "icons" { link($0); next } 79 $2 == "terminfo" { link($0); next } 80 $2 == "data" { link($0); next } 81 $2 == "include" { link($0); next } 82 83 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 84 85 END { 86 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 87 for(fname in x) { 88 if(x[fname]) { 89 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 90 exit 3 91 } 92 } 93 }' >.install-links.new 94 mv .install-links.new .install-links