mrrl

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

findutils (3847B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.539513a18a06a21e4660004fea30f3658959c5c7f54488b66b5fee7120b0c27c
      3 #+busybox-findutils.3ba95afbbde5f39d6a3c0b17d82ff2e5350904cf19dd40acdf1c60ed126d3bda
      4 #+busybox-awk.4ac003d165540d0084cd08c1386f136343851ef344ac5ff844769b058049d859
      5 #+busybox-diffutils.b820ef7a40bea977a2bf740425ae15b2d9a21097bcf3a2f5ec77c21782b9deb8
      6 #+musl-cross-make.ef7f483eefcad5b8f2d6c8329e61a0acaca7864b88e9521cb839392c62f45676
      7 #+gnu-make.6c204d453a2d9b4e29dd7b9f93fc7c5a928284402b8646493cf72004f748753c
      8 #+m4.24db011b72096e07a0a7df3d38942fd5ea0bb7d245ea0408aec9d8e5c4091cc7
      9 #@untar:-J:sha256:1387e0b67ff247d2abde998f90dfbf70c1491391a59ddfecb8ae698789f0a4f5:.
     10 
     11 
     12 # - build script start -
     13 
     14 autotools_config() {
     15 	prefix=/versions/$pthbs_package
     16 	./configure -C \
     17 		--prefix="$prefix" \
     18 		--build="$(${CC:-gcc} -dumpmachine)" \
     19 		--bindir="$prefix/command" \
     20 		--sbindir="$prefix/command" \
     21 		--infodir="$prefix/info" \
     22 		--localedir="$prefix/locale" \
     23 		--mandir="$prefix/man" \
     24 		--libdir="$prefix/library" \
     25 		--docdir="$prefix/doc/findutils" \
     26 		--datadir="$prefix/data" \
     27 		--datarootdir="$prefix/data" \
     28 		--localstatedir='/var/pthbs' \
     29 		"$@"
     30 
     31 }
     32 
     33 autotools_config_static() {
     34 	build_env_static
     35 	autotools_config "$@" --enable-static --disable-shared
     36 }
     37 
     38 build_env_static() {
     39 	export LD_LIBRARY_PATH="$pthbs_build_environment/library"
     40 	export CPATH="$pthbs_build_environment/include"
     41 	export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS"
     42 }
     43 
     44 check_static() {
     45 	local exe || true
     46 	exe=$pthbs_destdir'/versions'/$pthbs_package/$1
     47 	if ! test -f $exe; then
     48 		printf '%s\n' "Error: file '$1' doesn't exist!"
     49 		exit 1
     50 	fi
     51 	local interp_info || true
     52 	interp_info=$(readelf --string-dump=.interp "$exe") || exit $?
     53 	if test x '!=' "x$interp_info"; then
     54 		printf '%s\n' "Error: '$1' is a dynamic binary!"
     55 		exit 1
     56 	fi
     57 }
     58 
     59 prefix=/versions/$pthbs_package
     60 dest=${pthbs_destdir%/}${prefix}
     61 cd 'findutils-4.10.0'
     62 
     63 
     64 autotools_config_static --disable-nls
     65 
     66 
     67 make -j${JOBS:-1} -l$((1+${JOBS:-1}))
     68 
     69 make DESTDIR="$pthbs_destdir" install
     70 
     71 
     72 
     73 check_static command/find
     74 check_static command/xargs
     75 # TODO: fix shebang in check_static command/locate
     76 # TODO: fix shebang in command/updatedb
     77 
     78 
     79 
     80 cd "$pthbs_destdir/versions/$pthbs_package"
     81 find -type d -o -print | awk -F/ '
     82 BEGIN {
     83 	x["./command/find"]=1
     84 	x["./command/xargs"]=1
     85 	x["./command/locate"]=1
     86 	x["./command/updatedb"]=1
     87 	x["./man/man1/find.1"]=1
     88 	x["./man/man1/xargs.1"]=1
     89 	x["./man/man1/locate.1"]=1
     90 	x["./man/man1/updatedb.1"]=1
     91 	x["./man/man5/locatedb.5"]=1
     92 }
     93 
     94 function r1(s) {
     95 	sub("^[.]/[^/]*", ".", s)
     96 	return s
     97 }
     98 function s1(repl, s) {
     99 	sub("^[.]/[^/]*", "./"repl, s)
    100 	return s
    101 }
    102 function link(src) {
    103 	x[$0]=0
    104 	printf "%s\t%s\n", $0, src
    105 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
    106 }
    107 $1!="."{exit 1}
    108 
    109 
    110 $2 == "config" { link($0); next }
    111 $2 == "keys" { link($0); next }
    112 $2 == "zsh" { link($0); next }
    113 $2 == "env" { link($0); next }
    114 $2 == "command" { link($0); next }
    115 $2 == "bin" { link(s1("command", $0)); next }
    116 
    117 $2 == "library.so" { link($0); next }
    118 $2 == "library" { link($0); next }
    119 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
    120 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next }
    121 
    122 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
    123 
    124 $2 == "man" { link($0); next }
    125 $2 == "info" { link($0); next }
    126 $2 == "doc" { link($0); next }
    127 $2 == "icons" { link($0); next }
    128 $2 == "terminfo" { link($0); next }
    129 $2 == "data" { link($0); next }
    130 $2 == "include" { link($0); next }
    131 
    132 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    133 
    134 END {
    135 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    136 	for(fname in x) {
    137 		if(x[fname]) {
    138 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    139 			exit 3
    140 		}
    141 	}
    142 }' >.install-links.new
    143 mv .install-links.new .install-links
    144