mrrl

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

gnu-make (3212B)


      1 #!/usr/bin/env pthbs-build
      2 #+musl-cross-make.ef7f483eefcad5b8f2d6c8329e61a0acaca7864b88e9521cb839392c62f45676
      3 #+gnu-make.47af7543e52e6b72ac25e13223e2ce78703c58993166ba25c56cba245e48dbfa
      4 #+busybox.cac0b85e179203f44ac2f1b50281f7cbe992094d779d6a2fc326b02d4a8461b5
      5 #@untar:-z:sha256:dd16fb1d67bfab79a72f5e8390735c49e3e8e70b4945a15ab1f81ddb78658fb3:.
      6 
      7 
      8 # - build script start -
      9 
     10 autotools_config() {
     11 	prefix=/versions/$pthbs_package
     12 	./configure -C \
     13 		--prefix="$prefix" \
     14 		--build="$(${CC:-gcc} -dumpmachine)" \
     15 		--bindir="$prefix/command" \
     16 		--sbindir="$prefix/command" \
     17 		--infodir="$prefix/info" \
     18 		--localedir="$prefix/locale" \
     19 		--mandir="$prefix/man" \
     20 		--libdir="$prefix/library" \
     21 		--docdir="$prefix/doc/gnu-make" \
     22 		--datadir="$prefix/data" \
     23 		--datarootdir="$prefix/data" \
     24 		--localstatedir='/var/pthbs' \
     25 		"$@"
     26 
     27 }
     28 
     29 autotools_config_static() {
     30 	build_env_static
     31 	autotools_config "$@" --enable-static --disable-shared
     32 }
     33 
     34 build_env_static() {
     35 	export LD_LIBRARY_PATH="$pthbs_build_environment/library"
     36 	export CPATH="$pthbs_build_environment/include"
     37 	export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS"
     38 }
     39 
     40 check_static() {
     41 	local exe || true
     42 	exe=$pthbs_destdir'/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=/versions/$pthbs_package
     56 dest=${pthbs_destdir%/}${prefix}
     57 cd 'make-4.4.1'
     58 
     59 
     60 autotools_config_static --disable-nls
     61 
     62 
     63 make -j${JOBS:-1} -l$((1+${JOBS:-1}))
     64 
     65 make DESTDIR="$pthbs_destdir" install
     66 
     67 
     68 
     69 check_static command/make
     70 
     71 
     72 
     73 cd "$pthbs_destdir/versions/$pthbs_package"
     74 find -type d -o -print | awk -F/ '
     75 BEGIN {
     76 	x["./command/make"]=1
     77 	x["./man/man1/make.1"]=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 
     95 
     96 $2 == "config" { link($0); next }
     97 $2 == "keys" { link($0); next }
     98 $2 == "zsh" { link($0); next }
     99 $2 == "env" { link($0); next }
    100 $2 == "command" { link($0); next }
    101 $2 == "bin" { link(s1("command", $0)); next }
    102 
    103 $2 == "library.so" { link($0); next }
    104 $2 == "library" { link($0); next }
    105 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
    106 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next }
    107 
    108 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
    109 
    110 $2 == "man" { link($0); next }
    111 $2 == "info" { link($0); next }
    112 $2 == "doc" { link($0); next }
    113 $2 == "icons" { link($0); next }
    114 $2 == "terminfo" { link($0); next }
    115 $2 == "data" { link($0); next }
    116 $2 == "include" { link($0); next }
    117 
    118 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    119 
    120 END {
    121 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    122 	for(fname in x) {
    123 		if(x[fname]) {
    124 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    125 			exit 3
    126 		}
    127 	}
    128 }' >.install-links.new
    129 mv .install-links.new .install-links
    130