mrrl

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

gnu-make (2988B)


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