libressl (4499B)
1 #!/usr/bin/env pthbs-build 2 #+musl-cross-make.d0431fc0def788be03da43136972361827de52c8e6f0a6f3890dc57fe32e8ecc 3 #+gnu-make.444e811a68f4f16724e21354b710fad3592e53a2dbf7c0c78658f3d4e7c8e465 4 #+busybox.f4ef3d511c029095beda8d21dd48f7730bec63fb09792ca951402d6620338089 5 #+busybox-diffutils.4a0933977737282afcd82b39d435b50946a700fe13472d24e4580a41fa852123 6 #+m4.3cffaef6909a65493ddc9aba4c53f77dc594ff5ab8b58c57acaa34c654b09ff3 7 #+ca-certificates-wip-donotuse.27bb806f3f92039cad53bf0b1ba44c38ce699dbecd9324c34ba5b5e2d99e9062 8 #@untar:-z:sha256:6d4b8d5bbb25a1f8336639e56ec5088052d43a95256697a85c4ce91323c25954:. 9 #@sha256:a68fedc0edd976b9f35ecfdcb252d80dc12084b1bc4e945be7dc42c437d8b540:c_rehash.c 10 11 build_env_static() { 12 export LD_LIBRARY_PATH="$pthbs_build_environment/library" 13 export CPATH="$pthbs_build_environment/include" 14 export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS" 15 } 16 autotools_config() { 17 prefix=/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() { 36 cd "$1" 37 shift 38 autotools_config "$@" 39 make -j${JOBS:-1} -l$((1+${JOBS:-1})) 40 make DESTDIR="$pthbs_destdir" install 41 } 42 43 autotools_static() { 44 build_env_static 45 autotools "$@" --enable-static --disable-shared 46 } 47 check_static() { 48 local exe || true 49 exe=$pthbs_destdir/'/versions'/$pthbs_package/$1 50 if ! test -f $exe; then 51 printf '%s\n' "Error: file '$1' doesn't exist!" 52 exit 1 53 fi 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 62 prefix=/versions/$pthbs_package 63 export LDFLAGS="--static" 64 autotools_static libressl-3.8.2 --with-openssldir="$prefix/config/ssl" 65 check_static command/openssl 66 check_static command/ocspcheck 67 68 cd .. 69 gcc ./c_rehash.c -o c_rehash --static -static -I"$pthbs_destdir/$prefix/include" -L"$pthbs_destdir/$prefix/library" -lssl -lcrypto 70 cp -vs '/versions/ca-certificates-wip-donotuse.27bb806f3f92039cad53bf0b1ba44c38ce699dbecd9324c34ba5b5e2d99e9062/config/ssl/certs'/*.crt "$pthbs_destdir/$prefix/config/ssl/certs/" 71 ./c_rehash "$pthbs_destdir/$prefix/config/ssl/certs/" 72 cd "$pthbs_destdir/$prefix/config/ssl/" 73 mv cert.pem libressl-cert.pem 74 cp -a certs/ca-certificates.crt cert.pem 75 76 cd "$pthbs_destdir/$prefix/" 77 mkdir -p env 78 # for s6-networking 79 printf >env/CADIR '%s\n' "$prefix/config/ssl/certs" 80 # for curl 81 printf >env/SSL_CERT_DIR '%s\n' "$prefix/config/ssl/certs" 82 # for git 83 printf >env/GIT_SSL_CAPATH '%s\n' "$prefix/config/ssl/certs" 84 85 86 87 cd "$pthbs_destdir/versions/$pthbs_package" 88 find -type d -o -print | awk -F/ ' 89 BEGIN { 90 x["./command/openssl"]=1 91 x["./command/ocspcheck"]=1 92 x["./man/man1/openssl.1"]=1 93 x["./library/libssl.a"]=1 94 x["./include/tls.h"]=1 95 x["./config/ssl/certs/0b9bc432.0"]=1 # ISRG_Root_X2.crt 96 x["./config/ssl/certs/4042bcee.0"]=1 # ISRG_Root_X1.crt 97 x["./config/ssl/cert.pem"]=1 # merged bundle 98 } 99 100 function r1(s) { 101 sub("^[.]/[^/]*", ".", s) 102 return s 103 } 104 function s1(repl, s) { 105 sub("^[.]/[^/]*", "./"repl, s) 106 return s 107 } 108 function link(src) { 109 x[$0]=0 110 printf "%s\t%s\n", $0, src 111 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 112 } 113 $1!="."{exit 1} 114 115 116 $2 == "config" { link($0); next } 117 $2 == "env" { link($0); next } 118 $2 == "command" { link($0); next } 119 $2 == "bin" { link(s1("command", $0)); next } 120 121 $2 == "library.so" { link($0); next } 122 $2 == "library" { link($0); next } 123 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 124 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next } 125 126 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } 127 128 $2 == "man" { link($0); next } 129 $2 == "info" { link($0); next } 130 $2 == "doc" { link($0); next } 131 $2 == "icons" { link($0); next } 132 $2 == "terminfo" { link($0); next } 133 $2 == "data" { link($0); next } 134 $2 == "include" { link($0); next } 135 136 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 137 138 END { 139 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 140 for(fname in x) { 141 if(x[fname]) { 142 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 143 exit 3 144 } 145 } 146 }' >.install-links.new 147 mv .install-links.new .install-links