mrrl

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

m4 (3424B)


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