2018-06-29 21:04:22 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2018-09-10 13:00:25 +00:00
|
|
|
PWD_DIR=$(pwd)
|
|
|
|
function cleanup {
|
2019-07-04 20:06:51 +00:00
|
|
|
cd "$PWD_DIR"
|
2018-09-10 13:00:25 +00:00
|
|
|
}
|
|
|
|
trap cleanup EXIT
|
|
|
|
|
2019-05-23 01:03:19 +00:00
|
|
|
#############################################################################
|
|
|
|
|
2018-07-15 13:35:26 +00:00
|
|
|
GREP=grep
|
|
|
|
SED=sed
|
|
|
|
AWK=awk
|
|
|
|
MAKE=make
|
|
|
|
|
|
|
|
# Fixup, Solaris and friends
|
2020-07-09 23:50:38 +00:00
|
|
|
if [[ -d /usr/xpg4/bin ]]; then
|
2018-07-15 13:35:26 +00:00
|
|
|
SED=/usr/xpg4/bin/sed
|
|
|
|
AWK=/usr/xpg4/bin/awk
|
|
|
|
GREP=/usr/xpg4/bin/grep
|
2020-07-09 23:50:38 +00:00
|
|
|
elif [[ -d /usr/bin/posix ]]; then
|
2018-07-15 13:35:26 +00:00
|
|
|
SED=/usr/bin/posix/sed
|
|
|
|
AWK=/usr/bin/posix/awk
|
|
|
|
GREP=/usr/bin/posix/grep
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Fixup for sed and "illegal byte sequence"
|
2020-07-09 23:50:38 +00:00
|
|
|
IS_DARWIN=$(uname -s 2>/dev/null | "$GREP" -i -c darwin)
|
2018-07-15 13:35:26 +00:00
|
|
|
if [[ "$IS_DARWIN" -ne 0 ]]; then
|
|
|
|
export LC_ALL=C
|
|
|
|
fi
|
|
|
|
|
2018-07-16 14:53:11 +00:00
|
|
|
# Fixup for Solaris and BSDs
|
2020-07-09 23:50:38 +00:00
|
|
|
if [[ ! -z $(command -v gmake 2>/dev/null) ]]; then
|
2018-07-16 14:53:11 +00:00
|
|
|
MAKE=gmake
|
2018-09-26 20:22:19 +00:00
|
|
|
else
|
|
|
|
MAKE=make
|
2018-07-16 14:53:11 +00:00
|
|
|
fi
|
|
|
|
|
2018-08-03 03:21:59 +00:00
|
|
|
# Fixup for missing libtool
|
2020-07-09 23:50:38 +00:00
|
|
|
if [[ ! -z $(command -v glibtoolize 2>/dev/null) ]]; then
|
2020-07-07 20:08:14 +00:00
|
|
|
export LIBTOOLIZE=$(command -v glibtoolize)
|
2020-07-09 23:50:38 +00:00
|
|
|
elif [[ ! -z $(command -v libtoolize 2>/dev/null) ]]; then
|
|
|
|
export LIBTOOLIZE=$(command -v libtoolize)
|
|
|
|
elif [[ ! -z $(command -v glibtool 2>/dev/null) ]]; then
|
2020-07-07 20:08:14 +00:00
|
|
|
export LIBTOOLIZE=$(command -v glibtool)
|
2020-07-09 23:50:38 +00:00
|
|
|
elif [[ ! -z $(command -v libtool 2>/dev/null) ]]; then
|
|
|
|
export LIBTOOLIZE=$(command -v libtool)
|
2018-08-03 03:21:59 +00:00
|
|
|
fi
|
|
|
|
|
2019-05-23 01:03:19 +00:00
|
|
|
#############################################################################
|
|
|
|
|
2020-07-09 23:50:38 +00:00
|
|
|
if [[ -z $(command -v autoupdate 2>/dev/null) ]]; then
|
2018-08-01 17:57:35 +00:00
|
|
|
echo "Cannot find autoupdate. Things may fail."
|
2018-07-31 22:21:44 +00:00
|
|
|
fi
|
|
|
|
|
2018-08-03 03:21:59 +00:00
|
|
|
if [[ -z "$LIBTOOLIZE" ]]; then
|
2018-08-01 17:57:35 +00:00
|
|
|
echo "Cannot find libtoolize. Things may fail."
|
2018-07-31 22:21:44 +00:00
|
|
|
fi
|
|
|
|
|
2020-07-09 23:50:38 +00:00
|
|
|
if [[ -z $(command -v automake 2>/dev/null) ]]; then
|
2019-05-20 01:46:36 +00:00
|
|
|
echo "Cannot find automake. Things may fail."
|
|
|
|
fi
|
|
|
|
|
2020-07-09 23:50:38 +00:00
|
|
|
if [[ -z $(command -v autoreconf 2>/dev/null) ]]; then
|
2018-08-01 17:57:35 +00:00
|
|
|
echo "Cannot find autoreconf. Things may fail."
|
2018-07-31 22:21:44 +00:00
|
|
|
fi
|
|
|
|
|
2020-07-09 23:50:38 +00:00
|
|
|
if [[ -z $(command -v curl 2>/dev/null) ]]; then
|
2019-10-15 02:31:58 +00:00
|
|
|
echo "Cannot find cURL. Things may fail."
|
|
|
|
fi
|
|
|
|
|
|
|
|
#############################################################################
|
|
|
|
|
|
|
|
files=(configure.ac Makefile.am libcryptopp.pc.in)
|
|
|
|
|
|
|
|
for file in "${files[@]}"; do
|
|
|
|
echo "Downloading $file"
|
|
|
|
if ! curl -o "$file" --silent --insecure "https://raw.githubusercontent.com/noloader/cryptopp-autotools/master/$file"; then
|
|
|
|
echo "$file download failed"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
mkdir -p m4/
|
|
|
|
|
|
|
|
#############################################################################
|
|
|
|
|
2018-09-09 18:28:52 +00:00
|
|
|
echo "Running autoupdate"
|
2019-05-23 01:03:19 +00:00
|
|
|
if ! autoupdate &>/dev/null; then
|
2018-07-31 22:21:44 +00:00
|
|
|
echo "autoupdate failed."
|
2019-10-15 02:20:47 +00:00
|
|
|
exit 1
|
2018-07-31 22:21:44 +00:00
|
|
|
fi
|
|
|
|
|
2018-08-03 03:21:59 +00:00
|
|
|
# Run autoreconf twice on failure. Also see
|
|
|
|
# https://github.com/tracebox/tracebox/issues/57
|
2018-09-09 18:28:52 +00:00
|
|
|
echo "Running autoreconf"
|
2019-05-23 01:03:19 +00:00
|
|
|
if ! autoreconf --force --install &>/dev/null; then
|
2018-08-03 03:21:59 +00:00
|
|
|
echo "autoreconf failed, running again."
|
2019-05-23 01:03:19 +00:00
|
|
|
if ! autoreconf --force --install; then
|
2018-08-01 17:57:35 +00:00
|
|
|
echo "autoreconf failed, again."
|
2019-10-15 02:20:47 +00:00
|
|
|
exit 1
|
2018-07-27 20:51:32 +00:00
|
|
|
fi
|
2018-06-29 21:04:22 +00:00
|
|
|
fi
|
|
|
|
|
2019-05-23 01:03:19 +00:00
|
|
|
#############################################################################
|
|
|
|
|
2018-08-28 19:19:28 +00:00
|
|
|
# Update config.sub config.guess. GNU recommends using the latest for all projects.
|
|
|
|
echo "Updating config.sub"
|
2019-10-15 02:31:58 +00:00
|
|
|
curl -o config.sub.new --silent --insecure 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub'
|
2018-08-28 19:19:28 +00:00
|
|
|
|
2019-05-20 07:48:02 +00:00
|
|
|
# Solaris removes +w, can't overwrite
|
2020-07-07 19:54:56 +00:00
|
|
|
chmod +w build-aux/config.sub
|
|
|
|
mv config.sub.new build-aux/config.sub
|
|
|
|
chmod +x build-aux/config.sub
|
2018-09-09 16:00:54 +00:00
|
|
|
|
2020-07-09 23:50:38 +00:00
|
|
|
if [[ "$IS_DARWIN" -ne 0 ]] && [[ -n $(command -v xattr 2>/dev/null) ]]; then
|
2019-07-04 20:06:51 +00:00
|
|
|
echo "Removing config.sub quarantine"
|
2020-07-07 19:54:56 +00:00
|
|
|
xattr -d "com.apple.quarantine" build-aux/config.sub &>/dev/null
|
2019-07-04 19:36:17 +00:00
|
|
|
fi
|
|
|
|
|
2018-08-28 19:19:28 +00:00
|
|
|
echo "Updating config.guess"
|
2019-10-15 02:31:58 +00:00
|
|
|
curl -o config.guess.new --silent --insecure 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess'
|
2018-08-28 19:19:28 +00:00
|
|
|
|
2019-05-20 07:48:02 +00:00
|
|
|
# Solaris removes +w, can't overwrite
|
2020-07-07 19:54:56 +00:00
|
|
|
chmod +w build-aux/config.guess
|
|
|
|
mv config.guess.new build-aux/config.guess
|
|
|
|
chmod +x build-aux/config.guess
|
2018-09-09 16:00:54 +00:00
|
|
|
|
2020-07-09 23:50:38 +00:00
|
|
|
if [[ "$IS_DARWIN" -ne 0 ]] && [[ -n $(command -v xattr 2>/dev/null) ]]; then
|
2019-07-04 20:06:51 +00:00
|
|
|
echo "Removing config.guess quarantine"
|
2020-07-07 19:54:56 +00:00
|
|
|
xattr -d "com.apple.quarantine" build-aux/config.guess &>/dev/null
|
2019-07-04 19:36:17 +00:00
|
|
|
fi
|
|
|
|
|
2019-05-23 01:03:19 +00:00
|
|
|
#############################################################################
|
|
|
|
|
|
|
|
echo "Running configure"
|
|
|
|
echo ""
|
|
|
|
|
2018-06-29 21:04:22 +00:00
|
|
|
if ! ./configure; then
|
2018-08-01 17:57:35 +00:00
|
|
|
echo "configure failed."
|
2019-10-15 02:20:47 +00:00
|
|
|
exit 1
|
2018-06-29 21:04:22 +00:00
|
|
|
fi
|
|
|
|
|
2019-10-15 02:34:32 +00:00
|
|
|
#############################################################################
|
|
|
|
|
2019-10-15 02:39:38 +00:00
|
|
|
echo ""
|
2019-10-15 02:34:32 +00:00
|
|
|
echo "Building test artifacts"
|
|
|
|
echo ""
|
2019-05-23 01:03:19 +00:00
|
|
|
|
2019-10-15 02:39:38 +00:00
|
|
|
"$MAKE" clean &>/dev/null
|
|
|
|
|
2018-07-15 13:35:26 +00:00
|
|
|
if ! "$MAKE" -j2 -f Makefile; then
|
2018-08-01 17:57:35 +00:00
|
|
|
echo "make failed."
|
2019-10-15 02:20:47 +00:00
|
|
|
exit 1
|
2018-06-29 21:04:22 +00:00
|
|
|
fi
|
|
|
|
|
2020-07-10 04:01:12 +00:00
|
|
|
#############################################################################
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "Testing library"
|
|
|
|
echo ""
|
|
|
|
|
2019-02-01 14:51:37 +00:00
|
|
|
if ! ./cryptest v; then
|
|
|
|
echo "cryptest v failed."
|
2019-10-15 02:20:47 +00:00
|
|
|
exit 1
|
2018-06-29 21:04:22 +00:00
|
|
|
fi
|
|
|
|
|
2019-02-01 14:51:37 +00:00
|
|
|
if ! ./cryptest tv all; then
|
|
|
|
echo "cryptest tv all failed."
|
2019-10-15 02:20:47 +00:00
|
|
|
exit 1
|
2018-06-29 21:04:22 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Return success
|
|
|
|
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 0 || return 0
|