mrrl

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

gnu-make:bootstrap (2965B)


      1 #!/usr/bin/env pthbs-build
      2 #@pragma:nosandbox
      3 #@pragma:nopath
      4 #+musl-cross-make.de554c172179c402cf921f506a2369385ea83330a5bb4ab6bb6a253db9aac258
      5 #+nawk.596c1948e96cbcabfe3954a70deb947de0c73be1ddde41fafe8291bfec04bdd4
      6 #@untar:-z:sha256:dd16fb1d67bfab79a72f5e8390735c49e3e8e70b4945a15ab1f81ddb78658fb3:.
      7 
      8 
      9 # - build script start -
     10 
     11 autotools_config() {
     12 	prefix=/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/gnu-make" \
     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 PATH="$pthbs_build_environment/command:$PATH"
     35 prefix=/versions/$pthbs_package
     36 dest=${pthbs_destdir%/}${prefix}
     37 cd 'make-4.4.1'
     38 
     39 
     40 mcm=/versions/musl-cross-make.de554c172179c402cf921f506a2369385ea83330a5bb4ab6bb6a253db9aac258
     41 
     42 export CC="$mcm/bin/x86_64-linux-musl-gcc"
     43 export CXX="$mcm/bin/x86_64-linux-musl-g++"
     44 export CFLAGS="-D_GNU_SOURCE"
     45 export LDFLAGS="-static"
     46 
     47 autotools_config --disable-nls
     48 
     49 
     50 make -j${JOBS:-1} -l$((1+${JOBS:-1}))
     51 
     52 make DESTDIR="$pthbs_destdir" install
     53 
     54 
     55 
     56 
     57 
     58 cd "$pthbs_destdir/versions/$pthbs_package"
     59 find -type d -o -print | awk -F/ '
     60 BEGIN {
     61 	x["./command/make"]=1
     62 	x["./man/man1/make.1"]=1
     63 }
     64 
     65 function r1(s) {
     66 	sub("^[.]/[^/]*", ".", s)
     67 	return s
     68 }
     69 function s1(repl, s) {
     70 	sub("^[.]/[^/]*", "./"repl, s)
     71 	return s
     72 }
     73 function link(src) {
     74 	x[$0]=0
     75 	printf "%s\t%s\n", $0, src
     76 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     77 }
     78 $1!="."{exit 1}
     79 $2 == "env" { link($0); next }
     80 $2 == ".env-template" { link($0); next }
     81 
     82 $2 == "command" { link($0); next }
     83 $2 == "command" { link($0); next }
     84 $2 == "bin" { link(s1("command", $0)); next }
     85 $2 == "sbin" { link(s1("command", $0)); next }
     86 
     87 $2 == "library.so" { link($0); next }
     88 $2 == "library" { link($0); next }
     89 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
     90 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next }
     91 
     92 $2 == "share" && $3 == "info" { link(s1("info", r1($0))); next }
     93 $2 == "share" && $3 == "man" { link(s1("man", r1($0))); next }
     94 $2 == "share" && $3 == "doc" { link(s1("doc", r1($0))); next }
     95 
     96 $2 == "config" { link($0); next }
     97 $2 == "man" { link($0); next }
     98 $2 == "info" { link($0); next }
     99 $2 == "doc" { link($0); next }
    100 $2 == "data" { link($0); next }
    101 $2 == "include" { link($0); next }
    102 
    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 	retcode = 0
    109 	for(fname in x) {
    110 		if(x[fname]) {
    111 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    112 			retcode = 3
    113 		}
    114 	}
    115 	exit retcode
    116 }' >.install-links.new
    117 mv .install-links.new .install-links
    118