mrrl

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

libelf (2786B)


      1 #!/usr/bin/env pthbs-build
      2 #+musl-cross-make.98979eb41109d371f19d0637d51116db18c7aeef61fbf804a68094c22a302a78
      3 #+gnu-make.ba8d7c64a23885182fc1c9dc0331d52adcdbc45df6000fb81e8e1dd3ee05694b
      4 #+busybox.ee3440974794767b833fd3299226771f170d3f8601cf225cb884f0a513db8ab3
      5 #+busybox-diffutils.c2ebcfcad050ad71b8e30322a463b5c009f254c7a42e95c627d32665e17134dc
      6 #+zstd.8b11bd81c450d61aa6a44ffd019654c590439df68ebd8987db4cdbbcf182d67c
      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=/home/ccx/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=/home/ccx/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/home/ccx/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