mrrl

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

argp-standalone (3575B)


      1 #!/usr/bin/env pthbs-build
      2 #+musl-cross-make.d0431fc0def788be03da43136972361827de52c8e6f0a6f3890dc57fe32e8ecc
      3 #+gnu-make.444e811a68f4f16724e21354b710fad3592e53a2dbf7c0c78658f3d4e7c8e465
      4 #+busybox.f4ef3d511c029095beda8d21dd48f7730bec63fb09792ca951402d6620338089
      5 #+busybox-diffutils.4a0933977737282afcd82b39d435b50946a700fe13472d24e4580a41fa852123
      6 #+m4.3cffaef6909a65493ddc9aba4c53f77dc594ff5ab8b58c57acaa34c654b09ff3
      7 #@untar:-z:sha256:c29eae929dfebd575c38174f2c8c315766092cec99a8f987569d0cad3c6d64f6:.
      8 #@untar::sha256:a4facc0856b512ad8ab5aed7b07e14a9629aaf042b1e92377ba22fcfc4c4205b:argp-standalone-1.5.0
      9 
     10 build_env_static() {
     11 	export LD_LIBRARY_PATH="$pthbs_build_environment/library"
     12 	export CPATH="$pthbs_build_environment/include"
     13 	export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS"
     14 }
     15 autotools_config() {
     16 	prefix=/versions/$pthbs_package
     17 	./configure -C \
     18 		--prefix="$prefix" \
     19 		--build="$(${CC:-gcc} -dumpmachine)" \
     20 		--bindir="$prefix/command" \
     21 		--sbindir="$prefix/command" \
     22 		--infodir="$prefix/info" \
     23 		--localedir="$prefix/locale" \
     24 		--mandir="$prefix/man" \
     25 		--libdir="$prefix/library" \
     26 		--docdir="$prefix/doc/argp-standalone" \
     27 		--datadir="$prefix/data" \
     28 		--datarootdir="$prefix/data" \
     29 		--localstatedir='/var/pthbs' \
     30 		"$@"
     31 
     32 }
     33 
     34 autotools() {
     35 	cd "$1"
     36 	shift
     37 	autotools_config "$@"
     38 	make -j${JOBS:-1} -l$((1+${JOBS:-1}))
     39 	make DESTDIR="$pthbs_destdir" install
     40 }
     41 
     42 autotools_static() {
     43 	build_env_static
     44 	autotools "$@" --enable-static --disable-shared
     45 }
     46 check_static() {
     47 	local exe || true
     48 	exe=$pthbs_destdir/'/versions'/$pthbs_package/$1
     49 	if ! test -f $exe; then
     50 		printf '%s\n' "Error: file '$1' doesn't exist!"
     51 		exit 1
     52 	fi
     53 	interp_info=$(readelf --string-dump=.interp "$exe") || exit $?
     54 	if test x '!=' "x$interp_info"; then
     55 		printf '%s\n' "Error: '$1' is a dynamic binary!"
     56 		exit 1
     57 	fi
     58 }
     59 
     60 
     61 cd argp-standalone-1.5.0
     62 autotools_config
     63 def_prefix() {
     64 	prefix=/versions/$pthbs_package
     65 }
     66 def_dest() {
     67 	dest=${pthbs_destdir%/}//versions/$pthbs_package
     68 }
     69 def_prefix
     70 make libargp.a
     71 
     72 install -d "$pthbs_destdir/$prefix/library"
     73 install -m 644 libargp.a "$pthbs_destdir/$prefix/library"
     74 
     75 install -d "$pthbs_destdir/$prefix/include"
     76 install -m 644 argp.h "$pthbs_destdir/$prefix/include"
     77 
     78 
     79 
     80 cd "$pthbs_destdir/versions/$pthbs_package"
     81 find -type d -o -print | awk -F/ '
     82 BEGIN {
     83 	x["./library/libargp.a"]=1
     84 	x["./include/argp.h"]=1
     85 }
     86 
     87 function r1(s) {
     88 	sub("^[.]/[^/]*", ".", s)
     89 	return s
     90 }
     91 function s1(repl, s) {
     92 	sub("^[.]/[^/]*", "./"repl, s)
     93 	return s
     94 }
     95 function link(src) {
     96 	x[$0]=0
     97 	printf "%s\t%s\n", $0, src
     98 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     99 }
    100 $1!="."{exit 1}
    101 
    102 
    103 $2 == "command" { link($0); next }
    104 $2 == "bin" { link(s1("command", $0)); next }
    105 
    106 $2 == "library.so" { link($0); next }
    107 $2 == "library" { link($0); next }
    108 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
    109 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next }
    110 
    111 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
    112 
    113 $2 == "man" { link($0); next }
    114 $2 == "info" { link($0); next }
    115 $2 == "doc" { link($0); next }
    116 $2 == "icons" { link($0); next }
    117 $2 == "terminfo" { link($0); next }
    118 $2 == "data" { link($0); next }
    119 $2 == "include" { link($0); next }
    120 
    121 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    122 
    123 END {
    124 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    125 	for(fname in x) {
    126 		if(x[fname]) {
    127 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    128 			exit 3
    129 		}
    130 	}
    131 }' >.install-links.new
    132 mv .install-links.new .install-links