mrrl

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

libelf (3108B)


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