mrrl

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

apk-tools (3598B)


      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 #+patch.f68185f5f766e7ba981276f806b05c1b549d908db89557d83873e53100c3a74f
      9 #+libressl.de7444026279c2cb27262bce64bc243cdfaab374282b63ad354f78cb0f04b311
     10 #+zstd.9736e321b1b8e6549f338d427549f01301473de674823230efeaeb274d899796
     11 #+pkgconf-pkg-config.2af12027cd145d8e8d3961bf73608011ba873a8f7ee9646708ac87d0fcb055c9
     12 #@sha256:4b32a05f12c3d29befb210c88c415f7c7affd7e351b9e96b0cfde50773d22dbd:apk-tools.patch
     13 #@git:9d074efdc12bc41b5d24190595a5269a770e852a:apk-tools
     14 
     15 
     16 # - build script start -
     17 
     18 build_env_static() {
     19 	export LD_LIBRARY_PATH="$pthbs_build_environment/library"
     20 	export CPATH="$pthbs_build_environment/include"
     21 	export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS"
     22 }
     23 
     24 check_static() {
     25 	local exe || true
     26 	exe=$pthbs_destdir'/home/ccx/versions'/$pthbs_package/$1
     27 	if ! test -f $exe; then
     28 		printf '%s\n' "Error: file '$1' doesn't exist!"
     29 		exit 1
     30 	fi
     31 	local interp_info || true
     32 	interp_info=$(readelf --string-dump=.interp "$exe") || exit $?
     33 	if test x '!=' "x$interp_info"; then
     34 		printf '%s\n' "Error: '$1' is a dynamic binary!"
     35 		exit 1
     36 	fi
     37 }
     38 
     39 prefix=/home/ccx/versions/$pthbs_package
     40 dest=${pthbs_destdir%/}${prefix}
     41 cd 'apk-tools'
     42 patch -p1 <../apk-tools.patch
     43 
     44 
     45 build_env_static
     46 
     47 make -j${JOBS:-1} -l$((1+${JOBS:-1})) STATIC=y LUA=no V=1 \
     48 	CFLAGS=-O2 \
     49 	DESTDIR="$pthbs_destdir" \
     50 	SBINDIR="$prefix/command" \
     51 	CONFDIR="$prefix/etc/apk" \
     52 	MANDIR="$prefix/man" \
     53 	DOCDIR="$prefix/doc/apk" \
     54 	INCLUDEDIR="$prefix/include" \
     55 	LIBDIR="$prefix/library" \
     56 	PKGCONFIGDIR="$prefix/library/pkgconfig" \
     57 	install-static
     58 
     59 check_static command/apk.static
     60 
     61 
     62 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package"
     63 find -type d -o -print | awk -F/ '
     64 BEGIN {
     65 	x["./command/apk.static"]=1
     66 	x["./library/libapk.a"]=1
     67 	x["./library/pkgconfig/apk.pc"]=1
     68 }
     69 
     70 function r1(s) {
     71 	sub("^[.]/[^/]*", ".", s)
     72 	return s
     73 }
     74 function s1(repl, s) {
     75 	sub("^[.]/[^/]*", "./"repl, s)
     76 	return s
     77 }
     78 function link(src) {
     79 	x[$0]=0
     80 	printf "%s\t%s\n", $0, src
     81 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     82 }
     83 $1!="."{exit 1}
     84 
     85 
     86 $2 == "config" { link($0); next }
     87 $2 == "keys" { link($0); next }
     88 $2 == "zsh" { link($0); next }
     89 $2 == "env" { link($0); next }
     90 $2 == "command" { link($0); next }
     91 $2 == "bin" { link(s1("command", $0)); next }
     92 
     93 $2 == "library.so" { link($0); next }
     94 $2 == "library" { link($0); next }
     95 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
     96 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next }
     97 
     98 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
     99 
    100 $2 == "man" { link($0); next }
    101 $2 == "info" { link($0); next }
    102 $2 == "doc" { link($0); next }
    103 $2 == "icons" { link($0); next }
    104 $2 == "terminfo" { link($0); next }
    105 $2 == "data" { link($0); next }
    106 $2 == "include" { link($0); next }
    107 
    108 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    109 
    110 END {
    111 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    112 	for(fname in x) {
    113 		if(x[fname]) {
    114 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    115 			exit 3
    116 		}
    117 	}
    118 }' >.install-links.new
    119 mv .install-links.new .install-links
    120