mrrl

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

musl-fts (3109B)


      1 #!/usr/bin/env pthbs-build
      2 #+musl-cross-make.675bc960d97b88b341ba4c64ea1b10f6afd9c9f0394ed84ca848768c5e1b646c
      3 #+gnu-make.152d99fd58e3130b4bd4d23833643ca418555a0560e88962cd8a28ffcd9a9ab7
      4 #+busybox.7818e9d6df97d97317c8fcdf404811731aa0c5c3ab7eb6aec00c9652b6da511c
      5 #+busybox-diffutils.3579038707d7520c09339ee4fc3b67ef03caeeaf8fff3b6f93c51ace141a4393
      6 #+m4.9943b16e3463f08c59487393409dc10df95173d9d015f907948a44a96e7fd8ee
      7 #@untar:-z:sha256:49ae567a96dbab22823d045ffebe0d6b14b9b799925e9ca9274d47d26ff482a6:.
      8 
      9 build_env_static() {
     10 	export LD_LIBRARY_PATH="$pthbs_build_environment/library"
     11 	export CPATH="$pthbs_build_environment/include"
     12 	export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS"
     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/musl-fts" \
     26 		--datadir="$prefix/data" \
     27 		--datarootdir="$prefix/data" \
     28 		--localstatedir='/var/pthbs' \
     29 		"$@"
     30 
     31 }
     32 
     33 autotools() {
     34 	cd "$1"
     35 	shift
     36 	autotools_config "$@"
     37 	make -j${JOBS:-1} -l$((1+${JOBS:-1}))
     38 	make DESTDIR="$pthbs_destdir" install
     39 }
     40 
     41 autotools_static() {
     42 	build_env_static
     43 	autotools "$@" --enable-static --disable-shared
     44 }
     45 check_static() {
     46 	local exe || true
     47 	exe=$pthbs_destdir/'/versions'/$pthbs_package/$1
     48 	if ! test -f $exe; then
     49 		printf '%s\n' "Error: file '$1' doesn't exist!"
     50 		exit 1
     51 	fi
     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 
     60 autotools_static musl-fts-1.2.7
     61 
     62 
     63 
     64 cd "$pthbs_destdir/versions/$pthbs_package"
     65 find -type d -o -print | awk -F/ '
     66 BEGIN {
     67 	x["./library/libfts.a"]=1
     68 	x["./include/fts.h"]=1
     69 }
     70 
     71 function r1(s) {
     72 	sub("^[.]/[^/]*", ".", s)
     73 	return s
     74 }
     75 function s1(repl, s) {
     76 	sub("^[.]/[^/]*", "./"repl, s)
     77 	return s
     78 }
     79 function link(src) {
     80 	x[$0]=0
     81 	printf "%s\t%s\n", $0, src
     82 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     83 }
     84 $1!="."{exit 1}
     85 
     86 
     87 $2 == "command" { link($0); next }
     88 $2 == "bin" { link(s1("command", $0)); next }
     89 
     90 $2 == "library.so" { link($0); next }
     91 $2 == "library" { link($0); next }
     92 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
     93 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next }
     94 
     95 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
     96 
     97 $2 == "man" { link($0); next }
     98 $2 == "info" { link($0); next }
     99 $2 == "doc" { link($0); next }
    100 $2 == "icons" { link($0); next }
    101 $2 == "terminfo" { link($0); next }
    102 $2 == "data" { link($0); next }
    103 $2 == "include" { link($0); next }
    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 	for(fname in x) {
    110 		if(x[fname]) {
    111 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    112 			exit 3
    113 		}
    114 	}
    115 }' >.install-links.new
    116 mv .install-links.new .install-links