mrrl

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

nawk:bootstrap (3558B)


      1 #!/usr/bin/env pthbs-build
      2 #@pragma:nosandbox
      3 #@pragma:nopath
      4 #+musl-cross-make.a6dd1a5bb85d66548633e88b73189e4b778d12d25a02e2ea1558067729467f51
      5 #@untar:-z:sha256:e031b1e1d2b230f276f975bffb923f0ea15f798c839d15a3f26a1a39448e32d7:.
      6 #@sha256:e91027b085cc83c7724fd6b624641a74256288b16e9f48a37d3ceeab6e498f3f:awk-20250116/proctab.c
      7 #@sha256:76d4c84d3d40ba15f8ddb9c0b1e32b62b218831626f1e329af932ee1bc9a0db5:awk-20250116/awkgram.tab.c
      8 #@sha256:91732af116433bba51f17f94adaece736a0ce59327d8a94a3c6291f733053152:awk-20250116/awkgram.tab.h
      9 
     10 
     11 # - build script start -
     12 
     13 build_env_static() {
     14 	export CFLAGS="-ffile-prefix-map=${pthbs_workdir}=builddir $CFLAGS"
     15 	export CXXFLAGS="-ffile-prefix-map=${pthbs_workdir}=builddir $CXXFLAGS"
     16 	export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS"
     17 }
     18 
     19 check_static() {
     20 	local exe || true
     21 	exe=$pthbs_destdir'/home/ccx/versions'/$pthbs_package/$1
     22 	if ! test -f $exe; then
     23 		printf '%s\n' "Error: file '$1' doesn't exist!"
     24 		exit 1
     25 	fi
     26 	local interp_info || true
     27 	interp_info=$(readelf --string-dump=.interp "$exe") || exit $?
     28 	if test x '!=' "x$interp_info"; then
     29 		printf '%s\n' "Error: '$1' is a dynamic binary!"
     30 		exit 1
     31 	fi
     32 }
     33 
     34 PATH="$pthbs_build_environment/command:$PATH"
     35 prefix=/home/ccx/versions/$pthbs_package
     36 dest=${pthbs_destdir%/}${prefix}
     37 cd 'awk-20250116'
     38 
     39 
     40 mcm=/home/ccx/versions/musl-cross-make.a6dd1a5bb85d66548633e88b73189e4b778d12d25a02e2ea1558067729467f51
     41 "$mcm/bin/x86_64-linux-musl-gcc" --version
     42 
     43 build_env_static
     44 
     45 # no clue why we need to spell out implicit rule
     46 printf '%s\n' >>makefile \
     47  	'' '.SUFFIXES: .c .o' '.c.o:' '	$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<'
     48 make -j${JOBS:-1} -l$((1+${JOBS:-1})) "CC=$mcm/bin/x86_64-linux-musl-gcc -static" "CXX=$mcm/bin/x86_64-linux-musl-g++ -static"
     49 
     50 install -Dm755 a.out "${dest}"/command/awk
     51 install -Dm644 awk.1 "${dest}"/man/man1/awk.1
     52 install -Dm644 LICENSE FIXES FIXES.1e README.md TODO -t "${dest}"/doc/
     53 
     54 
     55 
     56 check_static 'command'/awk
     57 
     58 
     59 
     60 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package"
     61 find -type d -o -print | awk -F/ '
     62 BEGIN {x["./command/awk"]=1
     63 	x["./man/man1/awk.1"]=1
     64 }
     65 
     66 function r1(s) {
     67 	sub("^[.]/[^/]*", ".", s)
     68 	return s
     69 }
     70 function s1(repl, s) {
     71 	sub("^[.]/[^/]*", "./"repl, s)
     72 	return s
     73 }
     74 function link(src) {
     75 	x[$0]=0
     76 	printf "%s\t%s\n", $0, src
     77 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     78 }
     79 $1!="."{exit 1}
     80 $2 == "env" { link($0); next }
     81 $2 == ".env-template" { link($0); next }
     82 
     83 $2 == "command" { link($0); next }
     84 $2 == "command" { link($0); next }
     85 $2 == "bin" { link(s1("command", $0)); next }
     86 $2 == "sbin" { link(s1("command", $0)); next }
     87 
     88 $2 == "library.so" { link($0); next }
     89 $2 == "library" { link($0); next }
     90 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
     91 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next }
     92 
     93 $2 == "share" && $3 == "info" { link(s1("info", r1($0))); next }
     94 $2 == "share" && $3 == "man" { link(s1("man", r1($0))); next }
     95 $2 == "share" && $3 == "doc" { link(s1("doc", r1($0))); next }
     96 
     97 $2 == "config" { link($0); next }
     98 $2 == "man" { link($0); next }
     99 $2 == "info" { link($0); next }
    100 $2 == "doc" { link($0); next }
    101 $2 == "data" { link($0); next }
    102 $2 == "include" { link($0); next }
    103 
    104 
    105 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    106 
    107 END {
    108 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    109 	retcode = 0
    110 	for(fname in x) {
    111 		if(x[fname]) {
    112 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    113 			retcode = 3
    114 		}
    115 	}
    116 	exit retcode
    117 }' >.install-links.new
    118 mv .install-links.new .install-links
    119