mrrl

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

abduco (3210B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.d2d7aa00eac6ec561a10d126b1866f22e226a1276307466251e80fd8a4a1ebc7
      3 #+busybox-findutils.85b2328981df683d1ae7597eebdf3a332aa4241b936c0030fe3618cec1f4841a
      4 #+busybox-awk.4c3f8cc249ba35f1206fcaf2979bcfd66d09b117eeea4e6a939024825a542496
      5 #+musl-cross-make.e4735d8572f9b6654a7381ebdfbd62e665d1d1da5e06a56923e89274cc6a510f
      6 #+gnu-make.75a726f6c19f7bc10b95a84da3ce72fb785ebdf587504430c6b74cfb6610b728
      7 #+busybox-diffutils.24775f761d337796ffe81623350e4bf2f039067f593411146bfeb9c80567d182
      8 #@git:8c32909a159aaa9484c82b71f05b7a73321eb491:abduco
      9 
     10 
     11 # - build script start -
     12 
     13 build_env_static() {
     14 	export LD_LIBRARY_PATH="$pthbs_build_environment/library"
     15 	export CPATH="$pthbs_build_environment/include"
     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 prefix=/home/ccx/versions/$pthbs_package
     35 dest=${pthbs_destdir%/}${prefix}
     36 cd 'abduco'
     37 
     38 build_env_static
     39 cat >config.mk <<EOF
     40 # Any changes made here will be lost if configure is re-run
     41 SRCDIR = .
     42 PREFIX = ${prefix}
     43 EXEC_PREFIX = \$(PREFIX)
     44 BINDIR = ${prefix}/command
     45 MANPREFIX = ${prefix}/man
     46 CC = cc
     47 CFLAGS = -pipe -Os
     48 LDFLAGS = -static
     49 EOF
     50 sed 's/^/> /' config.mk
     51 
     52 
     53 make -j${JOBS:-1} -l$((1+${JOBS:-1}))
     54 
     55 make DESTDIR="$pthbs_destdir" install
     56 
     57 # the Makefile hardcodes 'bin' despite configure undersanding BINDIR
     58 mv "${dest}/bin" "${dest}/command"
     59 
     60 
     61 
     62 check_static command/abduco
     63 
     64 
     65 
     66 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package"
     67 find -type d -o -print | awk -F/ '
     68 BEGIN {
     69 	x["./command/abduco"]=1
     70 }
     71 
     72 function r1(s) {
     73 	sub("^[.]/[^/]*", ".", s)
     74 	return s
     75 }
     76 function s1(repl, s) {
     77 	sub("^[.]/[^/]*", "./"repl, s)
     78 	return s
     79 }
     80 function link(src) {
     81 	x[$0]=0
     82 	printf "%s\t%s\n", $0, src
     83 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     84 }
     85 $1!="."{exit 1}
     86 
     87 
     88 $2 == "config" { link($0); next }
     89 $2 == "keys" { link($0); next }
     90 $2 == "zsh" { link($0); next }
     91 $2 == "env" { link($0); next }
     92 $2 == "command" { link($0); next }
     93 $2 == "bin" { link(s1("command", $0)); next }
     94 
     95 $2 == "library.so" { link($0); next }
     96 $2 == "library" { link($0); next }
     97 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
     98 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next }
     99 
    100 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
    101 
    102 $2 == "man" { link($0); next }
    103 $2 == "info" { link($0); next }
    104 $2 == "doc" { link($0); next }
    105 $2 == "icons" { link($0); next }
    106 $2 == "terminfo" { link($0); next }
    107 $2 == "data" { link($0); next }
    108 $2 == "include" { link($0); next }
    109 
    110 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    111 
    112 END {
    113 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    114 	for(fname in x) {
    115 		if(x[fname]) {
    116 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    117 			exit 3
    118 		}
    119 	}
    120 }' >.install-links.new
    121 mv .install-links.new .install-links
    122