pthbs

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

libressl (3296B)


      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 #@untar:-z:sha256:6d4b8d5bbb25a1f8336639e56ec5088052d43a95256697a85c4ce91323c25954:.
      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/libressl" \
     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 export LDFLAGS="--static"
     61 autotools_static libressl-3.8.2 --sysconfdir=/etc
     62 check_static command/openssl
     63 check_static command/ocspcheck
     64 
     65 
     66 
     67 cd "$pthbs_destdir/versions/$pthbs_package"
     68 find -type d -o -print | awk -F/ '
     69 BEGIN {
     70 	x["./command/openssl"]=1
     71 	x["./command/ocspcheck"]=1
     72 	x["./man/man1/openssl.1"]=1
     73 	x["./library/libssl.a"]=1
     74 	x["./include/tls.h"]=1
     75 }
     76 
     77 function r1(s) {
     78 	sub("^[.]/[^/]*", ".", s)
     79 	return s
     80 }
     81 function s1(repl, s) {
     82 	sub("^[.]/[^/]*", "./"repl, s)
     83 	return s
     84 }
     85 function link(src) {
     86 	x[$0]=0
     87 	printf "%s\t%s\n", $0, src
     88 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     89 }
     90 $1!="."{exit 1}
     91 
     92 
     93 $2 == "command" { link($0); next }
     94 $2 == "bin" { link(s1("command", $0)); next }
     95 
     96 $2 == "library.so" { link($0); next }
     97 $2 == "library" { link($0); next }
     98 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
     99 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next }
    100 
    101 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
    102 
    103 $2 == "man" { link($0); next }
    104 $2 == "info" { link($0); next }
    105 $2 == "doc" { link($0); next }
    106 $2 == "icons" { link($0); next }
    107 $2 == "terminfo" { link($0); next }
    108 $2 == "data" { link($0); next }
    109 $2 == "include" { link($0); next }
    110 
    111 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    112 
    113 END {
    114 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    115 	for(fname in x) {
    116 		if(x[fname]) {
    117 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    118 			exit 3
    119 		}
    120 	}
    121 }' >.install-links.new
    122 mv .install-links.new .install-links