mrrl

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

m4:bootstrap (3452B)


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