mrrl

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

acl (3281B)


      1 #!/usr/bin/env pthbs-build
      2 #+musl-cross-make.757bcca6771cad3395ae302e0fdc835ebf5b4a965c08e30d758e6149b0bacbcd
      3 #+gnu-make.529116171fecc2bdac7c70e109d28270d765379c8a52cf7c3ea7453195bbf42b
      4 #+busybox.3664b94c09ea6d35ce73985026762c142829e53fed4a38541af3afb00c37dd4a
      5 #+busybox-diffutils.a22698424a7618572314d3da6953bf6652138ec492d3a0d01c37072f74adefc4
      6 #+m4.b78d93922dc9dbf43dd31037c98271490db5d6d1919b69b12122cf55fa1fb515
      7 #+attr.2872f4c03dbcff28ab017927b57c01b3bcd7c745e61167fcbf62c9b7c0d77c4c
      8 #@untar:-z:sha256:5f2bdbad629707aa7d85c623f994aa8a1d2dec55a73de5205bac0bf6058a2f7c:.
      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/acl" \
     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 autotools_static acl-2.3.2
     62 check_static command/chacl
     63 
     64 
     65 
     66 cd "$pthbs_destdir/versions/$pthbs_package"
     67 find -type d -o -print | awk -F/ '
     68 BEGIN {
     69 	x["./command/chacl"]=1
     70 	x["./command/setfacl"]=1
     71 	x["./command/getfacl"]=1
     72 	x["./library/libacl.a"]=1
     73 	x["./include/acl/libacl.h"]=1
     74 }
     75 
     76 function r1(s) {
     77 	sub("^[.]/[^/]*", ".", s)
     78 	return s
     79 }
     80 function s1(repl, s) {
     81 	sub("^[.]/[^/]*", "./"repl, s)
     82 	return s
     83 }
     84 function link(src) {
     85 	x[$0]=0
     86 	printf "%s\t%s\n", $0, src
     87 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     88 }
     89 $1!="."{exit 1}
     90 
     91 
     92 $2 == "command" { link($0); next }
     93 $2 == "bin" { link(s1("command", $0)); next }
     94 
     95 $2 == "library.so" { link($0); next }
     96 $2 == "library" { link($0); next }
     97 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
     98 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next }
     99 
    100 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
    101 
    102 $2 == "man" { link($0); next }
    103 $2 == "info" { link($0); next }
    104 $2 == "doc" { link($0); next }
    105 $2 == "icons" { link($0); next }
    106 $2 == "terminfo" { link($0); next }
    107 $2 == "data" { link($0); next }
    108 $2 == "include" { link($0); next }
    109 
    110 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    111 
    112 END {
    113 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    114 	for(fname in x) {
    115 		if(x[fname]) {
    116 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    117 			exit 3
    118 		}
    119 	}
    120 }' >.install-links.new
    121 mv .install-links.new .install-links