mrrl

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

libressl (6825B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.68f74170e6a13d2e0e3d99d29d2f02cd614667a68afec5007308ea1ece55ad64
      3 #+busybox-bzip2.9d87ac159c5af2abf932204167d7dd79a5e2854ec5603817b258b68b5584c07c
      4 #+busybox-gzip.1c4e6759f305d884692ed4260879ddf1ca5b722a4b2b8995fd7ac2ff244c1318
      5 #+busybox-lzop.f4feb74da70e7c871444211871d0fc78da65a9e8ebb6b2d09716cda043d9559f
      6 #+busybox-unzip.3525f1554aa628809b2af9b084dd93fe2a37c8f14dbd514faf0e888c25426073
      7 #+busybox-xz.ead5b695755cbb0c379db6ee22b83de1da44c6d75a5295889ae4536de2a22e58
      8 #+busybox-cpio.aae9207efa7aa6f41519f502d53ce4eabb45a70d339a22bf65d89f1aaf7a39de
      9 #+busybox-dpkg.4f8487d22d56efdc91cb2d6263149840ae08d3ff07047357b04d4437f0321f2d
     10 #+busybox-rpm.173468d54d79d9e5630360360e4479f04190c411b81fd1b1ad0139f618dd6b49
     11 #+busybox-tar.794822cecad4eba7d3977210cc3b83b2dc8011cc18c77d9e0ce5205098cffae8
     12 #+busybox-ed.afab42d8bf2060655b013c6225efcb43715780ef058e718d6a697e25de0dfa16
     13 #+busybox-sed.13120e3643a859180c04f69bc441a554327a643b8a8301ec412d412d3ae9e263
     14 #+busybox-vi.76239b7b2102b4489b0e8a0e86f19030f01d6149fa7310d00504580711d0b0f1
     15 #+busybox-xxd.f3350b2e6c2d9463bc4d0ac5761b2a3ca4d5b811e651c2c705d6143667656c76
     16 #+busybox-process-extra.4718339ba96e00c8091bf1348aef03c41cb830463fb26a943788db2c07d43509
     17 #+busybox-procps.d618aac5f7c813d68a26afdddd97c7989c1ccb671cfa2628642e15573944b541
     18 #+busybox-psmisc.8e915b0be8aa34811699584be98d8d1532c6fe91b44de921e0cbf527402859ad
     19 #+busybox-ash.ec7c45db8ddc5ce15e4890ac76b9058759c93db13f5a7d7af554888e3c5c593f
     20 #+busybox-bc.3e9cce6408b94240c76671a4d11bcade40182fcb5bcc1cfd1828208bef65a085
     21 #+busybox-coreutils.9bf9b030f85f1e2273dcd70b660827388694be93e5dbd86e8c812031195508cb
     22 #+busybox-coreutils-extra.8eb2d3d7aee3f89bc564e0da7e1dcf67071e7e49c1ea9b9dcbdba00069d4e247
     23 #+busybox-daemontools.ff774454c0914cb16b18b038863c4a5a8b7c267eb2a308a9c13b740089ea5727
     24 #+busybox-grep.acdcecd4d05a4d1c250b30ae8925ee38ed1f787276a99b9e3514b9850159d301
     25 #+busybox-misc.125f4e5526de9635e0e04ddc5b6ba8c98a9a0e9e817c423b55241a0f0571e0d4
     26 #+busybox-sh.991f989805551e1b6bb35424114e9339163a4e7c90bb03a946ae71b980936e97
     27 #+busybox-util-linux-unpriv.1f8b2c8640b56685a72666365d8aece78e21f1ebc8a83b4355bb4111536b7caa
     28 #+busybox-findutils.337e3980f5b5d2a07c3850d24ce41c9cbf70e54a3b8d3b4ed7b258756df0014e
     29 #+busybox-awk.9b2a1cd1da22c09390e41d4448e90c4bde9610143c3d9443ca7665d5d8c42153
     30 #+busybox-diffutils.9b52fd5ef8d705039558ba31d05f7933c588d7fe6f2a223a2ffece523ae679a3
     31 #+musl-cross-make.4e31ccacab5cc8de22091926201823288206e2471d5991c3fa8db8b8f5c1b22b
     32 #+gnu-make.f9c645bf2cec787c1273cfa3ca4f2ad9a50bf2749bc7b290c97880642c6775af
     33 #+m4.3859e8735c004546c9033814f8f303398337ac9d15a3028a6046d7648992120f
     34 #+ca-certificates-wip-donotuse.b8e221544b8990916fb6b813d57928d788383aabae4fee344851dbfdd148c99f
     35 #@sha256:a68fedc0edd976b9f35ecfdcb252d80dc12084b1bc4e945be7dc42c437d8b540:c_rehash.c
     36 #@untar:-z:sha256:6d4b8d5bbb25a1f8336639e56ec5088052d43a95256697a85c4ce91323c25954:.
     37 
     38 
     39 # - build script start -
     40 
     41 autotools_config() {
     42 	prefix=/versions/$pthbs_package
     43 	./configure -C \
     44 		--prefix="$prefix" \
     45 		--build="$(${CC:-gcc} -dumpmachine)" \
     46 		--bindir="$prefix/command" \
     47 		--sbindir="$prefix/command" \
     48 		--infodir="$prefix/info" \
     49 		--localedir="$prefix/locale" \
     50 		--mandir="$prefix/man" \
     51 		--libdir="$prefix/library" \
     52 		--docdir="$prefix/doc/libressl" \
     53 		--datadir="$prefix/data" \
     54 		--datarootdir="$prefix/data" \
     55 		--localstatedir='/var/pthbs' \
     56 		"$@"
     57 
     58 }
     59 
     60 autotools_config_static() {
     61 	build_env_static
     62 	autotools_config "$@" --enable-static --disable-shared
     63 }
     64 
     65 build_env_static() {
     66 	export LD_LIBRARY_PATH="$pthbs_build_environment/library"
     67 	export CPATH="$pthbs_build_environment/include"
     68 	export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS"
     69 }
     70 
     71 check_static() {
     72 	local exe || true
     73 	exe=$pthbs_destdir'/versions'/$pthbs_package/$1
     74 	if ! test -f $exe; then
     75 		printf '%s\n' "Error: file '$1' doesn't exist!"
     76 		exit 1
     77 	fi
     78 	local interp_info || true
     79 	interp_info=$(readelf --string-dump=.interp "$exe") || exit $?
     80 	if test x '!=' "x$interp_info"; then
     81 		printf '%s\n' "Error: '$1' is a dynamic binary!"
     82 		exit 1
     83 	fi
     84 }
     85 
     86 prefix=/versions/$pthbs_package
     87 dest=${pthbs_destdir%/}${prefix}
     88 cd 'libressl-3.8.2'
     89 
     90 export LDFLAGS="--static"
     91 
     92 autotools_config_static --with-openssldir="$prefix/config/ssl"
     93 
     94 
     95 make -j${JOBS:-1} -l$((1+${JOBS:-1}))
     96 
     97 make DESTDIR="$pthbs_destdir" install
     98 
     99 
    100 cd ..
    101 gcc ./c_rehash.c -o c_rehash --static -static -I"$pthbs_destdir/$prefix/include" -L"$pthbs_destdir/$prefix/library" -lssl -lcrypto
    102 cp -vs '/versions/ca-certificates-wip-donotuse.b8e221544b8990916fb6b813d57928d788383aabae4fee344851dbfdd148c99f/config/ssl/certs'/*.crt "$pthbs_destdir/$prefix/config/ssl/certs/"
    103 ./c_rehash  "$pthbs_destdir/$prefix/config/ssl/certs/"
    104 cd  "$pthbs_destdir/$prefix/config/ssl/"
    105 mv cert.pem libressl-cert.pem
    106 cp -a certs/ca-certificates.crt cert.pem
    107 
    108 cd  "$pthbs_destdir/$prefix/"
    109 mkdir -p env
    110 # for s6-networking
    111 printf >env/CADIR '%s\n' "$prefix/config/ssl/certs"
    112 # for curl
    113 printf >env/SSL_CERT_DIR '%s\n' "$prefix/config/ssl/certs"
    114 # for git
    115 printf >env/GIT_SSL_CAPATH '%s\n' "$prefix/config/ssl/certs"
    116 
    117 
    118 check_static command/openssl
    119 check_static command/ocspcheck
    120 
    121 
    122 cd "$pthbs_destdir/versions/$pthbs_package"
    123 find -type d -o -print | awk -F/ '
    124 BEGIN {
    125 	x["./command/openssl"]=1
    126 	x["./command/ocspcheck"]=1
    127 	x["./man/man1/openssl.1"]=1
    128 	x["./library/libssl.a"]=1
    129 	x["./include/tls.h"]=1
    130 	x["./config/ssl/certs/0b9bc432.0"]=1  # ISRG_Root_X2.crt
    131 	x["./config/ssl/certs/4042bcee.0"]=1  # ISRG_Root_X1.crt
    132 	x["./config/ssl/cert.pem"]=1  # merged bundle
    133 }
    134 
    135 function r1(s) {
    136 	sub("^[.]/[^/]*", ".", s)
    137 	return s
    138 }
    139 function s1(repl, s) {
    140 	sub("^[.]/[^/]*", "./"repl, s)
    141 	return s
    142 }
    143 function link(src) {
    144 	x[$0]=0
    145 	printf "%s\t%s\n", $0, src
    146 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
    147 }
    148 $1!="."{exit 1}
    149 
    150 
    151 $2 == "config" { link($0); next }
    152 $2 == "keys" { link($0); next }
    153 $2 == "zsh" { link($0); next }
    154 $2 == "env" { link($0); next }
    155 $2 == "command" { link($0); next }
    156 $2 == "bin" { link(s1("command", $0)); next }
    157 
    158 $2 == "library.so" { link($0); next }
    159 $2 == "library" { link($0); next }
    160 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
    161 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next }
    162 
    163 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
    164 
    165 $2 == "man" { link($0); next }
    166 $2 == "info" { link($0); next }
    167 $2 == "doc" { link($0); next }
    168 $2 == "icons" { link($0); next }
    169 $2 == "terminfo" { link($0); next }
    170 $2 == "data" { link($0); next }
    171 $2 == "include" { link($0); next }
    172 
    173 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    174 
    175 END {
    176 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    177 	for(fname in x) {
    178 		if(x[fname]) {
    179 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    180 			exit 3
    181 		}
    182 	}
    183 }' >.install-links.new
    184 mv .install-links.new .install-links
    185