From c1d553388d7ef1ba387bc01747e7da23f6b7ccc6 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Sun, 12 Aug 2018 17:46:34 -0400 Subject: Initial commit --- build_openssl.sh | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 build_openssl.sh (limited to 'build_openssl.sh') diff --git a/build_openssl.sh b/build_openssl.sh new file mode 100755 index 0000000..ab951f2 --- /dev/null +++ b/build_openssl.sh @@ -0,0 +1,68 @@ +#!/bin/bash +set -e +set -x +tarball="openssl-1.1.0h.tar.gz" +dest="${tarball%%.tar.gz}" +url="https://www.openssl.org/source/${tarball}" +prefix="/opt/openssl" + + +function pre() +{ + curl -LO "${url}" + tar xf "${tarball}" + export KERNEL_BITS=64 +} + + +function get_system_cacert() { + local paths=( + /etc/ssl/cert.pem + /etc/ssl/cacert.pem + /etc/ssl/certs/cacert.pem + /etc/ssl/certs/ca-bundle.crt + ) + for bundle in "${paths[@]}" + do + if [[ -f $bundle ]]; then + echo "$bundle" + break + fi + done +} + + +function build() +{ + pre + pushd "${dest}" + target="linux-x86_64" + export PATH="$prefix/bin:$PATH" + export LDFLAGS="-Wl,-rpath=$prefix/lib" + + ./Configure \ + --prefix="$prefix" \ + --openssldir="ssl" \ + --libdir="lib" \ + ${LDFLAGS} \ + ${target} \ + enable-ec_nistp_64_gcc_128 \ + zlib-dynamic \ + shared \ + no-ssl3-method + make + make install MANDIR="$prefix/share/man" MANSUFFIX=ssl + popd + post +} + +function post() +{ + bundle=$(get_system_cacert) + install -D -m644 "$bundle" "$prefix/ssl/cert.pem" + find $prefix + echo "All done." +} + +# Main +build -- cgit