mrrl

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

xbps (4289B)


      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 #+libarchive.0bbd05d3199bcadefa622e7084598424a6f587f7f9721e27efd8ed0605aa3fd4
      8 #+libressl.de7444026279c2cb27262bce64bc243cdfaab374282b63ad354f78cb0f04b311
      9 #+pkgconf-pkg-config.2af12027cd145d8e8d3961bf73608011ba873a8f7ee9646708ac87d0fcb055c9
     10 #@untar:-z:sha256:a6607e83fcd654a0ae846d729e43fefd8da9a61323e91430f884caf895b4f59b:.
     11 
     12 
     13 # - build script start -
     14 
     15 build_env_static() {
     16 	export LD_LIBRARY_PATH="$pthbs_build_environment/library"
     17 	export CPATH="$pthbs_build_environment/include"
     18 	export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS"
     19 }
     20 
     21 check_static() {
     22 	local exe || true
     23 	exe=$pthbs_destdir'/home/ccx/versions'/$pthbs_package/$1
     24 	if ! test -f $exe; then
     25 		printf '%s\n' "Error: file '$1' doesn't exist!"
     26 		exit 1
     27 	fi
     28 	local interp_info || true
     29 	interp_info=$(readelf --string-dump=.interp "$exe") || exit $?
     30 	if test x '!=' "x$interp_info"; then
     31 		printf '%s\n' "Error: '$1' is a dynamic binary!"
     32 		exit 1
     33 	fi
     34 }
     35 
     36 prefix=/home/ccx/versions/$pthbs_package
     37 dest=${pthbs_destdir%/}${prefix}
     38 cd 'xbps-0.59.2'
     39 
     40 
     41 export LDFLAGS=--static
     42 export CPPFLAGS="-D_GNU_SOURCE -DSTDC_HEADERS"
     43 build_env_static
     44 
     45 find lib bin -name '*.c' -exec sed -iEe '/^[\t ]*#[\t ]*define[\t ]+_GNU_SOURCE/d' '{}' \;
     46 find lib bin -name '*.c' -exec sed -iEe '/#.*_GNU_SOURCE/d' '{}' \;
     47 
     48 ./configure --verbose \
     49 	--prefix="$prefix" \
     50 	--build="$(${CC:-gcc} -dumpmachine)" \
     51 	--datadir="$prefix" \
     52 	--bindir="$prefix/command" \
     53 	--infodir="$prefix/info" \
     54 	--mandir="$prefix/man" \
     55 	--libdir="$prefix/library" \
     56 	--localstatedir=/var \
     57 	--enable-static
     58 
     59 
     60 make -j${JOBS:-1} -l$((1+${JOBS:-1})) -C include
     61 make -j${JOBS:-1} -l$((1+${JOBS:-1})) -C lib libxbps.a
     62 
     63 install -d "$dest/library"
     64 install -m 644 lib/libxbps.a "$dest/library"
     65 install -d "$dest/command"
     66 for cmd in xbps-alternatives xbps-create xbps-dgraph xbps-install xbps-pkgdb xbps-query xbps-reconfigure xbps-remove xbps-rindex xbps-uhelper xbps-checkvers xbps-fbulk xbps-digest xbps-fetch xbps-uchroot xbps-uunshare; do
     67 	make -j${JOBS:-1} -l$((1+${JOBS:-1})) -C "bin/$cmd" "$cmd.static"
     68 	install -m 755 "bin/$cmd/$cmd.static" "$pthbs_destdir/$prefix/command"
     69 done
     70 make -j${JOBS:-1} -l$((1+${JOBS:-1})) -C data
     71 make -j${JOBS:-1} -l$((1+${JOBS:-1})) -C data install DESTDIR="$pthbs_destdir"
     72 	
     73 
     74 
     75 check_static command/xbps-install.static
     76 mkdir -p "$dest/keys"
     77 mv -v "$pthbs_destdir/var/db/xbps/keys" "$dest/keys/void"
     78 
     79 
     80 
     81 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package"
     82 find -type d -o -print | awk -F/ '
     83 BEGIN {
     84 	x["./command/xbps-install.static"]=1
     85 }
     86 
     87 function r1(s) {
     88 	sub("^[.]/[^/]*", ".", s)
     89 	return s
     90 }
     91 function s1(repl, s) {
     92 	sub("^[.]/[^/]*", "./"repl, s)
     93 	return s
     94 }
     95 function link(src) {
     96 	x[$0]=0
     97 	printf "%s\t%s\n", $0, src
     98 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     99 }
    100 $1!="."{exit 1}
    101 
    102 
    103 $2 == "keys" { link($0); next }
    104 
    105 $2 == "config" { link($0); next }
    106 $2 == "keys" { link($0); next }
    107 $2 == "zsh" { link($0); next }
    108 $2 == "env" { link($0); next }
    109 $2 == "command" { link($0); next }
    110 $2 == "bin" { link(s1("command", $0)); next }
    111 
    112 $2 == "library.so" { link($0); next }
    113 $2 == "library" { link($0); next }
    114 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
    115 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next }
    116 
    117 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
    118 
    119 $2 == "man" { link($0); next }
    120 $2 == "info" { link($0); next }
    121 $2 == "doc" { link($0); next }
    122 $2 == "icons" { link($0); next }
    123 $2 == "terminfo" { link($0); next }
    124 $2 == "data" { link($0); next }
    125 $2 == "include" { link($0); next }
    126 
    127 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    128 
    129 END {
    130 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    131 	for(fname in x) {
    132 		if(x[fname]) {
    133 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    134 			exit 3
    135 		}
    136 	}
    137 }' >.install-links.new
    138 mv .install-links.new .install-links
    139