mrrl

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

xbps (6833B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.7f0e4d86f69de7624b0468018b9933c3e3c1757c8ff73938746c292196f916dd
      3 #+busybox-bzip2.52d2053dff44277d3c6f700eec6807d2c64c226e0f1bf589372ff5ff625be40e
      4 #+busybox-gzip.085fc42ce36be284c89a9dec6889cca59dedd07b9ba93a21d3198c4adcac5840
      5 #+busybox-lzop.bccd8f86de85a74d466d34f802ab1ea355f0a9d9886bdfa4d7bb4a785d695be6
      6 #+busybox-unzip.237a4ec36283b7fbdb85df583c7c77c0aaf70d335b1cbae09a40a9bb4b6c82bb
      7 #+busybox-xz.db25ed2ffbfc91e7b5cff54faf2e80de59ab5b15167c2c5bb338fa1ee62de122
      8 #+busybox-cpio.307e9495bcd9b79fd9559882115d55d22c5b687e08886e696f1e53d8db7eebcd
      9 #+busybox-dpkg.3aec8347093bb5b774a0c25795cdf9e624268a3b04cc48e867d74e4e06461db7
     10 #+busybox-rpm.8435251ea7058aea0cbcd41478b144b1a15c5aa121509af887847c0ef45bf5aa
     11 #+busybox-tar.c77139157bce13db8820740b756572c22e29cfbd8bb8c2a3b22b465b70e2eae9
     12 #+busybox-ed.4ac872215d7b9c8096c4cfd508434fbd2e825aebd9a9ea8589a0033b8e50aac2
     13 #+busybox-sed.14269a860b3706f7122b827818365fecaa0e62ce5bc3273e89948685c0953f2d
     14 #+busybox-vi.7e41b306c9c47aaaa281aa8347b9fa6dca260788fd73f53a7ba9260b315627ee
     15 #+busybox-xxd.9df3407fd75b89cb640d65870298eaba77327d6e387d25d8ce1ebab01cb47857
     16 #+busybox-process-extra.65afeaded3cb8fdeea327262f28f08e50f18d51a2b456ea97b293d200c7f558e
     17 #+busybox-procps.e5dc609521d29d8aec8253147269314439131c088a6beeacc172fc07594c4a37
     18 #+busybox-psmisc.7d760b69f45bb1b8d458f2f408b9cb3a42e919e8022f0508c440a5fd20ebb66f
     19 #+busybox-ash.fd5d266905d40248735e0e2e1ae22165b6f0d42c0bacb652660f69f39c1ee71e
     20 #+busybox-bc.6f2fe17efab2237c3036eba1c37d432d696d1b5dba130e21365016ceae0a3184
     21 #+busybox-coreutils.7e581faa6901f832a2a022d72b2858c3091f47afc80a4a463adb2f2a68f1843d
     22 #+busybox-coreutils-extra.5ab183b839676b0780a9a83d75cc345a06221fa34627c44aa3732c4a5a47f9b9
     23 #+busybox-daemontools.bcea69c867a61fe1d49d2f6a27e406959c484ed20d54fd7c0341828d3cdbd428
     24 #+busybox-grep.ac20e6a4295eb7fb0a09d700e10e5fe55e2009d2858e0a1525e461d4914e820b
     25 #+busybox-misc.7f0588b97809fac8061c489b686424de1a7dd17d8eb3431aae56513c7288f1e7
     26 #+busybox-sh.288f0583edc783a176bbbc59a3e854b186258ba2605291377a545cc3191c3d52
     27 #+busybox-util-linux-unpriv.5a286246aa7204f7fa8c9a247f1c93c751979690a65200030f29e255645c1eae
     28 #+busybox-findutils.207f73a9f41a8f9e279072e920cbf0c38ba6516734fa3cf2c1faf55565613487
     29 #+nawk.84c186be0a6d09a951a8c6a5377d16b0ba0a9e476e6b554c0c832d6407ebb5b2
     30 #+musl-cross-make.19d51dec5328ccacd41d47d7f24e33bac084aebefb839cb3fecb6573577b831a
     31 #+gnu-make.17b0037e8a3f24180cb7bb9ddb488039d540ba905aecca0315de313adfbae81c
     32 #+libarchive.435003e9c9168d640fac019e612241c543d183f5638d39f89a8e0f948223e311
     33 #+libressl.254ad2e06940ca82a891a4c5c8e4e84cbab28dbb9790e958ade5f3be4d463dc6
     34 #+pkgconf-pkg-config.c656966f2889c43d4e39921cc583813e6b7894db3754ea7af30d3361c7c40c63
     35 #@untar:-z:sha256:f51d528fa680873914aa8367707726dd777fccc6e5c95cfad90fdb3562375c04:.
     36 
     37 
     38 # - build script start -
     39 
     40 build_env_static() {
     41 	export CFLAGS="-ffile-prefix-map=${pthbs_workdir}=builddir $CFLAGS"
     42 	export CXXFLAGS="-ffile-prefix-map=${pthbs_workdir}=builddir $CXXFLAGS"
     43 	export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS"
     44 }
     45 
     46 check_static() {
     47 	local exe || true
     48 	exe=$pthbs_destdir'/versions'/$pthbs_package/$1
     49 	if ! test -f $exe; then
     50 		printf '%s\n' "Error: file '$1' doesn't exist!"
     51 		exit 1
     52 	fi
     53 	local interp_info || true
     54 	interp_info=$(readelf --string-dump=.interp "$exe") || exit $?
     55 	if test x '!=' "x$interp_info"; then
     56 		printf '%s\n' "Error: '$1' is a dynamic binary!"
     57 		exit 1
     58 	fi
     59 }
     60 
     61 prefix=/versions/$pthbs_package
     62 dest=${pthbs_destdir%/}${prefix}
     63 cd 'xbps-0.60.6'
     64 
     65 
     66 export LDFLAGS=--static
     67 export CPPFLAGS="-D_GNU_SOURCE -DSTDC_HEADERS"
     68 export CFLAGS="-Wno-error=cast-qual -Wno-error=parentheses -Wno-error=redundant-decls $CFLAGS"
     69 build_env_static
     70 
     71 find lib bin -name '*.c' -exec sed -iEe '/^[\t ]*#[\t ]*define[\t ]+_GNU_SOURCE/d' '{}' \;
     72 find lib bin -name '*.c' -exec sed -iEe '/#.*_GNU_SOURCE/d' '{}' \;
     73 
     74 ./configure --verbose \
     75 	--prefix="$prefix" \
     76 	--build="$(${CC:-gcc} -dumpmachine)" \
     77 	--datadir="$prefix" \
     78 	--bindir="$prefix/command" \
     79 	--infodir="$prefix/info" \
     80 	--mandir="$prefix/man" \
     81 	--libdir="$prefix/library" \
     82 	--localstatedir=/var \
     83 	--enable-static
     84 
     85 
     86 make -j${JOBS:-1} -l$((1+${JOBS:-1})) -C include
     87 make -j${JOBS:-1} -l$((1+${JOBS:-1})) -C lib libxbps.a
     88 
     89 install -d "$dest/library"
     90 install -m 644 lib/libxbps.a "$dest/library"
     91 install -d "$dest/command"
     92 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
     93 	make -j${JOBS:-1} -l$((1+${JOBS:-1})) -C "bin/$cmd" "$cmd.static"
     94 	install -m 755 "bin/$cmd/$cmd.static" "$pthbs_destdir/$prefix/command"
     95 done
     96 make -j${JOBS:-1} -l$((1+${JOBS:-1})) -C data
     97 make -j${JOBS:-1} -l$((1+${JOBS:-1})) -C data install DESTDIR="$pthbs_destdir"
     98 	
     99 
    100 
    101 check_static command/xbps-install.static
    102 mkdir -p "$dest/keys"
    103 mv -v "$pthbs_destdir/var/db/xbps/keys" "$dest/keys/void"
    104 
    105 
    106 
    107 cd "$pthbs_destdir/versions/$pthbs_package"
    108 find -type d -o -print | awk -F/ '
    109 BEGIN {
    110 	x["./command/xbps-install.static"]=1
    111 }
    112 
    113 function r1(s) {
    114 	sub("^[.]/[^/]*", ".", s)
    115 	return s
    116 }
    117 function s1(repl, s) {
    118 	sub("^[.]/[^/]*", "./"repl, s)
    119 	return s
    120 }
    121 function link(src) {
    122 	x[$0]=0
    123 	printf "%s\t%s\n", $0, src
    124 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
    125 }
    126 $1!="."{exit 1}
    127 $2 == "keys" { link($0); next }
    128 
    129 $2 == "env" { link($0); next }
    130 $2 == ".env-template" { link($0); next }
    131 
    132 $2 == "command" { link($0); next }
    133 $2 == "command" { link($0); next }
    134 $2 == "bin" { link(s1("command", $0)); next }
    135 $2 == "sbin" { link(s1("command", $0)); next }
    136 
    137 $2 == "library.so" { link($0); next }
    138 $2 == "library" { link($0); next }
    139 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
    140 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next }
    141 
    142 $2 == "share" && $3 == "info" { link(s1("info", r1($0))); next }
    143 $2 == "share" && $3 == "man" { link(s1("man", r1($0))); next }
    144 $2 == "share" && $3 == "doc" { link(s1("doc", r1($0))); next }
    145 
    146 $2 == "config" { link($0); next }
    147 $2 == "man" { link($0); next }
    148 $2 == "info" { link($0); next }
    149 $2 == "doc" { link($0); next }
    150 $2 == "data" { link($0); next }
    151 $2 == "include" { link($0); next }
    152 
    153 $2 == "share" && $3 ~ /^(icons|terminfo)$/ { link(r1($0)); next }
    154 
    155 $2 == "library.ocaml" { link($0); next }
    156 
    157 $2 == "keys" { link($0); next }
    158 $2 == "zsh" { link($0); next }
    159 $2 == "vimfiles" { link($0); next }
    160 $2 == "icons" { link($0); next }
    161 $2 == "terminfo" { link($0); next }
    162 
    163 
    164 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    165 
    166 END {
    167 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    168 	retcode = 0
    169 	for(fname in x) {
    170 		if(x[fname]) {
    171 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    172 			retcode = 3
    173 		}
    174 	}
    175 	exit retcode
    176 }' >.install-links.new
    177 mv .install-links.new .install-links
    178