mrrl

Minimal Reliable Reproducible Linux
git clone https://ccx.te2000.cz/git/mrrl
Log | Files | Refs | Submodules | README

libelf-compat (2183B)


      1 #!/usr/bin/env pthbs-build
      2 #+musl-cross-make.757bcca6771cad3395ae302e0fdc835ebf5b4a965c08e30d758e6149b0bacbcd
      3 #+gnu-make.529116171fecc2bdac7c70e109d28270d765379c8a52cf7c3ea7453195bbf42b
      4 #+busybox.3664b94c09ea6d35ce73985026762c142829e53fed4a38541af3afb00c37dd4a
      5 #@git:96341b540a2d19cb3c12abe8789e5701cb4817bd: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