pthbs

Packaging Through Hashed Build Scripts
git clone https://ccx.te2000.cz/git/pthbs
Log | Files | Refs | Submodules | README

libelf-compat (2183B)


      1 #!/usr/bin/env pthbs-build
      2 #+musl-cross-make.65f98305f5666435bf0c6b9ccedffae2179ff1b3286752756886f760cf7771d2
      3 #+gnu-make.782c9e6625fd7420e2cd38b847afed19db3b3844cae8a0426a0dbf73e10d78e5
      4 #+busybox.e60885fe93ee85c01831673bb29f0e62a64903f4ce3094e3dc35bc8ec8887ad9
      5 #@git:9bf94d170fd0d5540be8c6337f53ed71dbca268a:s6
      6 #@sha256:627d1273036dc35239ba9dd1da45132e3bfce1ab8171dd27dc7952cdf09b698e:s6_clone3_newpid.patch
      7 #@untar:-j:sha256:4496d6cec9644cda8006ead15e17e500629ce30fe85ab2f2052a77ba43a1358d:.
      8 
      9 : ${JOBS:=1}
     10 cd libelf-compat-0.152c001
     11 
     12 sed -i 's@HEADERS = src/libelf.h@HEADERS = src/libelf.h src/gelf.h@' Makefile
     13 prefix=/versions/$pthbs_package
     14 make -j${JOBS:-1} -l$((1+${JOBS:-1})) prefix="$prefix" bindir="$prefix/command" includedir="$prefix/include" libdir="$prefix/library" DESTDIR="$pthbs_destdir" install
     15 
     16 cd "$pthbs_destdir/versions/$pthbs_package"
     17 find -type d -o -print | awk -F/ '
     18 BEGIN {
     19 	x["./library/libelf.a"]=1
     20 	x["./include/libelf.h"]=1
     21 	x["./include/gelf.h"]=1
     22 }
     23 
     24 function r1(s) {
     25 	sub("^[.]/[^/]*", ".", s)
     26 	return s
     27 }
     28 function s1(repl, s) {
     29 	sub("^[.]/[^/]*", "./"repl, s)
     30 	return s
     31 }
     32 function link(src) {
     33 	x[$0]=0
     34 	printf "%s\t%s\n", $0, src
     35 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     36 }
     37 $1!="."{exit 1}
     38 
     39 
     40 $2 == "command" { link($0); next }
     41 $2 == "bin" { link(s1("command", $0)); next }
     42 
     43 $2 == "library.so" { link($0); next }
     44 $2 == "library" { link($0); next }
     45 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
     46 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next }
     47 
     48 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
     49 
     50 $2 == "man" { link($0); next }
     51 $2 == "info" { link($0); next }
     52 $2 == "doc" { link($0); next }
     53 $2 == "icons" { link($0); next }
     54 $2 == "terminfo" { link($0); next }
     55 $2 == "data" { link($0); next }
     56 $2 == "include" { link($0); next }
     57 
     58 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
     59 
     60 END {
     61 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
     62 	for(fname in x) {
     63 		if(x[fname]) {
     64 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
     65 			exit 3
     66 		}
     67 	}
     68 }' >.install-links.new
     69 mv .install-links.new .install-links