mrrl

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

libbsd (3571B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.539513a18a06a21e4660004fea30f3658959c5c7f54488b66b5fee7120b0c27c
      3 #+busybox-findutils.3ba95afbbde5f39d6a3c0b17d82ff2e5350904cf19dd40acdf1c60ed126d3bda
      4 #+busybox-awk.4ac003d165540d0084cd08c1386f136343851ef344ac5ff844769b058049d859
      5 #+busybox-diffutils.b820ef7a40bea977a2bf740425ae15b2d9a21097bcf3a2f5ec77c21782b9deb8
      6 #+musl-cross-make.ef7f483eefcad5b8f2d6c8329e61a0acaca7864b88e9521cb839392c62f45676
      7 #+gnu-make.6c204d453a2d9b4e29dd7b9f93fc7c5a928284402b8646493cf72004f748753c
      8 #+m4.24db011b72096e07a0a7df3d38942fd5ea0bb7d245ea0408aec9d8e5c4091cc7
      9 #+libmd.ec1339f91be9971eba2d29e0da3813418adad32cc394c3755f8a2c32cfe6907b
     10 #@untar:-J:sha256:55fdfa2696fb4d55a592fa9ad14a9df897c7b0008ddb3b30c419914841f85f33:.
     11 
     12 
     13 # - build script start -
     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/libbsd" \
     27 		--datadir="$prefix/data" \
     28 		--datarootdir="$prefix/data" \
     29 		--localstatedir='/var/pthbs' \
     30 		"$@"
     31 
     32 }
     33 
     34 autotools_config_static() {
     35 	build_env_static
     36 	autotools_config "$@" --enable-static --disable-shared
     37 }
     38 
     39 build_env_static() {
     40 	export LD_LIBRARY_PATH="$pthbs_build_environment/library"
     41 	export CPATH="$pthbs_build_environment/include"
     42 	export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS"
     43 }
     44 
     45 check_static() {
     46 	local exe || true
     47 	exe=$pthbs_destdir'/versions'/$pthbs_package/$1
     48 	if ! test -f $exe; then
     49 		printf '%s\n' "Error: file '$1' doesn't exist!"
     50 		exit 1
     51 	fi
     52 	local interp_info || true
     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 prefix=/versions/$pthbs_package
     61 dest=${pthbs_destdir%/}${prefix}
     62 cd 'libbsd-0.11.8'
     63 
     64 
     65 autotools_config_static 
     66 
     67 
     68 make -j${JOBS:-1} -l$((1+${JOBS:-1}))
     69 
     70 make DESTDIR="$pthbs_destdir" install
     71 
     72 
     73 
     74 
     75 
     76 cd "$pthbs_destdir/versions/$pthbs_package"
     77 find -type d -o -print | awk -F/ '
     78 BEGIN {
     79 	x["./library/libbsd.a"]=1
     80 	x["./include/bsd/bsd.h"]=1
     81 }
     82 
     83 function r1(s) {
     84 	sub("^[.]/[^/]*", ".", s)
     85 	return s
     86 }
     87 function s1(repl, s) {
     88 	sub("^[.]/[^/]*", "./"repl, s)
     89 	return s
     90 }
     91 function link(src) {
     92 	x[$0]=0
     93 	printf "%s\t%s\n", $0, src
     94 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     95 }
     96 $1!="."{exit 1}
     97 
     98 
     99 $2 == "config" { link($0); next }
    100 $2 == "keys" { link($0); next }
    101 $2 == "zsh" { link($0); next }
    102 $2 == "env" { link($0); next }
    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
    133