mrrl

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

libressl (4834B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.d2d7aa00eac6ec561a10d126b1866f22e226a1276307466251e80fd8a4a1ebc7
      3 #+busybox-findutils.85b2328981df683d1ae7597eebdf3a332aa4241b936c0030fe3618cec1f4841a
      4 #+busybox-awk.4c3f8cc249ba35f1206fcaf2979bcfd66d09b117eeea4e6a939024825a542496
      5 #+busybox-diffutils.24775f761d337796ffe81623350e4bf2f039067f593411146bfeb9c80567d182
      6 #+musl-cross-make.e4735d8572f9b6654a7381ebdfbd62e665d1d1da5e06a56923e89274cc6a510f
      7 #+gnu-make.75a726f6c19f7bc10b95a84da3ce72fb785ebdf587504430c6b74cfb6610b728
      8 #+m4.478aa95758da2858007dad2c971921d7d91e7166d000285a1b91bc684a6f17a9
      9 #+ca-certificates-wip-donotuse.9e934e637fb359220dded3fc1d854a3b82c1d0fd365d7029c483c82a6ec32083
     10 #@sha256:a68fedc0edd976b9f35ecfdcb252d80dc12084b1bc4e945be7dc42c437d8b540:c_rehash.c
     11 #@untar:-z:sha256:6d4b8d5bbb25a1f8336639e56ec5088052d43a95256697a85c4ce91323c25954:.
     12 
     13 
     14 # - build script start -
     15 
     16 autotools_config() {
     17 	prefix=/home/ccx/versions/$pthbs_package
     18 	./configure -C \
     19 		--prefix="$prefix" \
     20 		--build="$(${CC:-gcc} -dumpmachine)" \
     21 		--bindir="$prefix/command" \
     22 		--sbindir="$prefix/command" \
     23 		--infodir="$prefix/info" \
     24 		--localedir="$prefix/locale" \
     25 		--mandir="$prefix/man" \
     26 		--libdir="$prefix/library" \
     27 		--docdir="$prefix/doc/libressl" \
     28 		--datadir="$prefix/data" \
     29 		--datarootdir="$prefix/data" \
     30 		--localstatedir='/var/pthbs' \
     31 		"$@"
     32 
     33 }
     34 
     35 autotools_config_static() {
     36 	build_env_static
     37 	autotools_config "$@" --enable-static --disable-shared
     38 }
     39 
     40 build_env_static() {
     41 	export LD_LIBRARY_PATH="$pthbs_build_environment/library"
     42 	export CPATH="$pthbs_build_environment/include"
     43 	export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS"
     44 }
     45 
     46 check_static() {
     47 	local exe || true
     48 	exe=$pthbs_destdir'/home/ccx/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=/home/ccx/versions/$pthbs_package
     62 dest=${pthbs_destdir%/}${prefix}
     63 cd 'libressl-3.8.2'
     64 
     65 export LDFLAGS="--static"
     66 
     67 autotools_config_static --with-openssldir="$prefix/config/ssl"
     68 
     69 
     70 make -j${JOBS:-1} -l$((1+${JOBS:-1}))
     71 
     72 make DESTDIR="$pthbs_destdir" install
     73 
     74 
     75 cd ..
     76 gcc ./c_rehash.c -o c_rehash --static -static -I"$pthbs_destdir/$prefix/include" -L"$pthbs_destdir/$prefix/library" -lssl -lcrypto
     77 cp -vs '/home/ccx/versions/ca-certificates-wip-donotuse.9e934e637fb359220dded3fc1d854a3b82c1d0fd365d7029c483c82a6ec32083/config/ssl/certs'/*.crt "$pthbs_destdir/$prefix/config/ssl/certs/"
     78 ./c_rehash  "$pthbs_destdir/$prefix/config/ssl/certs/"
     79 cd  "$pthbs_destdir/$prefix/config/ssl/"
     80 mv cert.pem libressl-cert.pem
     81 cp -a certs/ca-certificates.crt cert.pem
     82 
     83 cd  "$pthbs_destdir/$prefix/"
     84 mkdir -p env
     85 # for s6-networking
     86 printf >env/CADIR '%s\n' "$prefix/config/ssl/certs"
     87 # for curl
     88 printf >env/SSL_CERT_DIR '%s\n' "$prefix/config/ssl/certs"
     89 # for git
     90 printf >env/GIT_SSL_CAPATH '%s\n' "$prefix/config/ssl/certs"
     91 
     92 
     93 check_static command/openssl
     94 check_static command/ocspcheck
     95 
     96 
     97 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package"
     98 find -type d -o -print | awk -F/ '
     99 BEGIN {
    100 	x["./command/openssl"]=1
    101 	x["./command/ocspcheck"]=1
    102 	x["./man/man1/openssl.1"]=1
    103 	x["./library/libssl.a"]=1
    104 	x["./include/tls.h"]=1
    105 	x["./config/ssl/certs/0b9bc432.0"]=1  # ISRG_Root_X2.crt
    106 	x["./config/ssl/certs/4042bcee.0"]=1  # ISRG_Root_X1.crt
    107 	x["./config/ssl/cert.pem"]=1  # merged bundle
    108 }
    109 
    110 function r1(s) {
    111 	sub("^[.]/[^/]*", ".", s)
    112 	return s
    113 }
    114 function s1(repl, s) {
    115 	sub("^[.]/[^/]*", "./"repl, s)
    116 	return s
    117 }
    118 function link(src) {
    119 	x[$0]=0
    120 	printf "%s\t%s\n", $0, src
    121 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
    122 }
    123 $1!="."{exit 1}
    124 
    125 
    126 $2 == "config" { link($0); next }
    127 $2 == "keys" { link($0); next }
    128 $2 == "zsh" { link($0); next }
    129 $2 == "env" { link($0); next }
    130 $2 == "command" { link($0); next }
    131 $2 == "bin" { link(s1("command", $0)); next }
    132 
    133 $2 == "library.so" { link($0); next }
    134 $2 == "library" { link($0); next }
    135 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
    136 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next }
    137 
    138 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
    139 
    140 $2 == "man" { link($0); next }
    141 $2 == "info" { link($0); next }
    142 $2 == "doc" { link($0); next }
    143 $2 == "icons" { link($0); next }
    144 $2 == "terminfo" { link($0); next }
    145 $2 == "data" { link($0); next }
    146 $2 == "include" { link($0); next }
    147 
    148 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    149 
    150 END {
    151 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    152 	for(fname in x) {
    153 		if(x[fname]) {
    154 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    155 			exit 3
    156 		}
    157 	}
    158 }' >.install-links.new
    159 mv .install-links.new .install-links
    160