libressl (4544B)
1 #!/usr/bin/env pthbs-build 2 #+musl-cross-make.98979eb41109d371f19d0637d51116db18c7aeef61fbf804a68094c22a302a78 3 #+gnu-make.ba8d7c64a23885182fc1c9dc0331d52adcdbc45df6000fb81e8e1dd3ee05694b 4 #+busybox.ee3440974794767b833fd3299226771f170d3f8601cf225cb884f0a513db8ab3 5 #+busybox-diffutils.c2ebcfcad050ad71b8e30322a463b5c009f254c7a42e95c627d32665e17134dc 6 #+m4.46e121f61e0af52abf876bf2688ecfe70eeb04185028d6adde0085e865fdfe75 7 #+ca-certificates-wip-donotuse.e7c06ef51889ab1d52117ccfd5f2aa2354c62f5caf265dc68c3203e4cc3d0f8b 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=/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() { 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/'/home/ccx/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=/home/ccx/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 '/home/ccx/versions/ca-certificates-wip-donotuse.e7c06ef51889ab1d52117ccfd5f2aa2354c62f5caf265dc68c3203e4cc3d0f8b/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/home/ccx/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