pthbs

Packaging Through Hashed Build Scripts
git clone https://ccx.te2000.cz/git/pthbs
Log | Files | Refs | Submodules | README

rsync (3451B)


      1 #!/usr/bin/env pthbs-build
      2 #+musl-cross-make.65f98305f5666435bf0c6b9ccedffae2179ff1b3286752756886f760cf7771d2
      3 #+gnu-make.782c9e6625fd7420e2cd38b847afed19db3b3844cae8a0426a0dbf73e10d78e5
      4 #+busybox.e60885fe93ee85c01831673bb29f0e62a64903f4ce3094e3dc35bc8ec8887ad9
      5 #+busybox-diffutils.4f5a07b29246414b77a7d71b103263af8f1249d75ddcbd9864e00def3d6feded
      6 #+m4.d61a4ef6e5ca207e24ed8bbbd9931e1e0ac2359ed5aae4e384b49d71401b4840
      7 #+popt.d994682732499125f79227d5e9ca96af0cc3023a2b7df3c1ee10f904d6c76278
      8 #+libressl.712d293b92e9b1beb4a8b5905c45ea20cab64e3ddd9796f9c2781577f04771ab
      9 #+zstd.ab99ab40fa027a935e6012884c3988d7161dc0c6ff10c06566c0a92c694bca07
     10 #@untar:-z:sha256:4e7d9d3f6ed10878c58c5fb724a67dacf4b6aac7340b13e488fb2dc41346f2bb:.
     11 
     12 build_env_static() {
     13 	export LD_LIBRARY_PATH="$pthbs_build_environment/library"
     14 	export CPATH="$pthbs_build_environment/include"
     15 	export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS"
     16 }
     17 autotools_config() {
     18 	prefix=/versions/$pthbs_package
     19 	./configure -C \
     20 		--prefix="$prefix" \
     21 		--build="$(${CC:-gcc} -dumpmachine)" \
     22 		--bindir="$prefix/command" \
     23 		--sbindir="$prefix/command" \
     24 		--infodir="$prefix/info" \
     25 		--localedir="$prefix/locale" \
     26 		--mandir="$prefix/man" \
     27 		--libdir="$prefix/library" \
     28 		--docdir="$prefix/doc/rsync" \
     29 		--datadir="$prefix/data" \
     30 		--datarootdir="$prefix/data" \
     31 		--localstatedir='/var/pthbs' \
     32 		"$@"
     33 
     34 }
     35 
     36 autotools() {
     37 	cd "$1"
     38 	shift
     39 	autotools_config "$@"
     40 	make -j${JOBS:-1} -l$((1+${JOBS:-1}))
     41 	make DESTDIR="$pthbs_destdir" install
     42 }
     43 
     44 autotools_static() {
     45 	build_env_static
     46 	autotools "$@" --enable-static --disable-shared
     47 }
     48 check_static() {
     49 	local exe || true
     50 	exe=$pthbs_destdir/'/versions'/$pthbs_package/$1
     51 	if ! test -f $exe; then
     52 		printf '%s\n' "Error: file '$1' doesn't exist!"
     53 		exit 1
     54 	fi
     55 	interp_info=$(readelf --string-dump=.interp "$exe") || exit $?
     56 	if test x '!=' "x$interp_info"; then
     57 		printf '%s\n' "Error: '$1' is a dynamic binary!"
     58 		exit 1
     59 	fi
     60 }
     61 
     62 
     63 autotools_static rsync-3.2.7 \
     64 	--without-included-popt \
     65 	--enable-openssl \
     66 	--enable-zstd \
     67 	--disable-xxhash \
     68 	--disable-lz4
     69 check_static command/rsync
     70 
     71 
     72 
     73 cd "$pthbs_destdir/versions/$pthbs_package"
     74 find -type d -o -print | awk -F/ '
     75 BEGIN {
     76 	x["./command/rsync"]=1
     77 	x["./man/man1/rsync.1"]=1
     78 }
     79 
     80 function r1(s) {
     81 	sub("^[.]/[^/]*", ".", s)
     82 	return s
     83 }
     84 function s1(repl, s) {
     85 	sub("^[.]/[^/]*", "./"repl, s)
     86 	return s
     87 }
     88 function link(src) {
     89 	x[$0]=0
     90 	printf "%s\t%s\n", $0, src
     91 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     92 }
     93 $1!="."{exit 1}
     94 
     95 
     96 $2 == "command" { link($0); next }
     97 $2 == "bin" { link(s1("command", $0)); next }
     98 
     99 $2 == "library.so" { link($0); next }
    100 $2 == "library" { link($0); next }
    101 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
    102 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next }
    103 
    104 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
    105 
    106 $2 == "man" { link($0); next }
    107 $2 == "info" { link($0); next }
    108 $2 == "doc" { link($0); next }
    109 $2 == "icons" { link($0); next }
    110 $2 == "terminfo" { link($0); next }
    111 $2 == "data" { link($0); next }
    112 $2 == "include" { link($0); next }
    113 
    114 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    115 
    116 END {
    117 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    118 	for(fname in x) {
    119 		if(x[fname]) {
    120 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    121 			exit 3
    122 		}
    123 	}
    124 }' >.install-links.new
    125 mv .install-links.new .install-links