forked from curl/curl-for-win
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gsasl.sh
executable file
·90 lines (69 loc) · 2.58 KB
/
gsasl.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/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}"
# Fix this bizarre error when executing 'make':
# configure.ac:39: error: version mismatch. This is Automake 1.16.4,
# configure.ac:39: but the definition used by this AM_INIT_AUTOMAKE
# configure.ac:39: comes from Automake 1.16.3. You should recreate
# configure.ac:39: aclocal.m4 with aclocal and run automake again.
# [...]
# Requires: autopoint (sometimes offered by the gettext package)
[ -f 'configure' ] || autoreconf --force --install
options="${_CONFIGURE_GLOBAL}"
export CC="${_CC_GLOBAL}"
export CFLAGS="${_CFLAGS_GLOBAL} -O3"
export CPPFLAGS="${_CPPFLAGS_GLOBAL}"
export LDFLAGS="${_LDFLAGS_GLOBAL}"
export LIBS="${_LIBS_GLOBAL}"
if [ -n "${_OPENSSL}" ]; then
options="${options} --with-openssl=yes"
CPPFLAGS="${CPPFLAGS} -I${_TOP}/${_OPENSSL}/${_PP}/include"
LDFLAGS="${LDFLAGS} -L${_TOP}/${_OPENSSL}/${_PP}/lib"
if [ "${_OPENSSL}" = 'boringssl' ]; then
LIBS="${LIBS} -lpthread"
fi
fi
(
mkdir "${_BLDDIR}"; cd "${_BLDDIR}"
# shellcheck disable=SC2086
../configure ${options} \
--disable-rpath \
--enable-static \
--disable-shared \
--disable-server \
--enable-scram-sha1 \
--enable-scram-sha256 \
--disable-gtk-doc-html \
--disable-valgrind-tests --silent
)
make --directory="${_BLDDIR}" --jobs="${_JOBS}" install "DESTDIR=$(pwd)/${_PKGDIR}" # >/dev/null # V=1
# Delete .pc and .la files
rm -r -f "${_PP}"/lib/pkgconfig
rm -f "${_PP}"/lib/*.la
# Make steps for determinism
readonly _ref='NEWS'
"${_STRIP}" --enable-deterministic-archives --strip-debug "${_PP}"/lib/*.a
touch -c -r "${_ref}" "${_PP}"/include/*.h
touch -c -r "${_ref}" "${_PP}"/lib/*.a
# Create package
_OUT="${_NAM}-${_VER}${_REVSUFFIX}${_PKGSUFFIX}"
_BAS="${_NAM}-${_VER}${_PKGSUFFIX}"
_DST="$(realpath _pkg)"; rm -r -f "${_DST}"
mkdir -p "${_DST}/include"
mkdir -p "${_DST}/lib"
cp -f -p "${_PP}"/include/*.h "${_DST}/include/"
cp -f -p "${_PP}"/lib/*.a "${_DST}/lib/"
cp -f -p NEWS "${_DST}/NEWS.txt"
cp -f -p AUTHORS "${_DST}/AUTHORS.txt"
cp -f -p COPYING "${_DST}/COPYING.txt"
cp -f -p README "${_DST}/README.txt"
../_pkg.sh "$(pwd)/${_ref}"
)