forked from curl/curl-for-win
-
Notifications
You must be signed in to change notification settings - Fork 0
/
libressl.sh
executable file
·73 lines (56 loc) · 1.85 KB
/
libressl.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
# Copyright (C) Viktor Szakats. See LICENSE.md
# SPDX-License-Identifier: MIT
# shellcheck disable=SC3040
set -o xtrace -o errexit -o nounset; [ -n "${BASH:-}${ZSH_NAME:-}" ] && set -o pipefail
export _NAM _VER _OUT _BAS _DST
_NAM="$(basename "$0" | cut -f 1 -d '.')"
_VER="$1"
(
cd "${_NAM}" || exit 0
rm -r -f "${_PKGDIR}" "${_BLDDIR}"
options="${_CONFIGURE_GLOBAL}"
export CC="${_CC_GLOBAL}"
export CFLAGS="${_CFLAGS_GLOBAL} -O3 -Wa,--noexecstack"
export CPPFLAGS="${_CPPFLAGS_GLOBAL}"
export LDFLAGS="${_LDFLAGS_GLOBAL}"
export LIBS="${_LIBS_GLOBAL}"
if [ "${_CC}" = 'llvm' ]; then
CFLAGS="${CFLAGS} -Wno-inconsistent-dllimport"
else
CFLAGS="${CFLAGS} -Wno-attributes"
fi
_win_prefix='C:/Windows/libressl'
_ssldir="ssl"
(
mkdir "${_BLDDIR}"; cd "${_BLDDIR}"
# shellcheck disable=SC2086
../configure ${options} \
--enable-static \
--disable-shared \
--disable-tests \
"--prefix=${_win_prefix}" \
"--with-openssldir=${_win_prefix}/${_ssldir}" --silent
)
# Ending slash required.
make --directory="${_BLDDIR}" --jobs="${_JOBS}" install "DESTDIR=$(pwd)/${_PKGDIR}/" >/dev/null # 2>&1
# LibreSSL does not strip the drive letter
# ./libressl/${_PKGDIR}/C:/Windows/libressl
# Some tools (e.g CMake) become weird when colons appear in
# a filename, so move results to a sane, standard path:
mkdir -p "./${_PP}"
mv "${_PKGDIR}/${_win_prefix}"/* "${_PP}"
# Delete .pc and .la files
rm -r -f "${_PP}"/lib/pkgconfig
rm -f "${_PP}"/lib/*.la
# Tests
# shellcheck disable=SC2043
for bin in \
"${_PP}"/bin/openssl.exe \
; do
file "${bin}"
# Produce 'openssl version -a'-like output without executing the build:
strings "${bin}" | grep -a -E '^(LibreSSL [0-9]|built on: |compiler: |platform: |[A-Z]+DIR: )' || true
done
. ../libressl-pkg.sh
)