blob: 569422a6824daa3aa08c577e2174c5003542a861 (
plain)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
#!/usr/bin/env bash
#############################################################################
#
# This script tests the Autotools gear.
#
# Written and placed in public domain by Jeffrey Walton.
#
# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2)
# licensed under the Boost Software License 1.0, while the individual files
# in the compilation are all public domain.
#
# See https://www.cryptopp.com/wiki/Autotools for more details
#
#############################################################################
if ! command -v wget >/dev/null 2>&1; then
if ! command -v curl >/dev/null 2>&1; then
echo "wget and curl not found. Things will fail"
exit 1
fi
fi
#############################################################################
# Default tools
GREP=grep
SED=sed
AWK=awk
MAKE=make
# Fixup, Solaris and friends
if [ -d /usr/xpg4/bin ]; then
SED=/usr/xpg4/bin/sed
AWK=/usr/xpg4/bin/awk
GREP=/usr/xpg4/bin/grep
elif [ -d /usr/bin/posix ]; then
SED=/usr/bin/posix/sed
AWK=/usr/bin/posix/awk
GREP=/usr/bin/posix/grep
fi
if command -v wget >/dev/null 2>&1; then
FETCH_CMD="wget -q -O"
elif command -v curl >/dev/null 2>&1; then
FETCH_CMD="curl -L -s -o"
else
FETCH_CMD="curl-and-wget-not-found"
fi
# Fixup for sed and "illegal byte sequence"
IS_DARWIN=`uname -s 2>&1 | "$GREP" -i -c darwin`
if [ "$IS_DARWIN" -ne 0 ]; then
LC_ALL=C; export LC_ALL
fi
# Fixup for Solaris and BSDs
if [ command -v gmake >/dev/null 2>&1 ]; then
MAKE=gmake
fi
#############################################################################
files=(bootstrap.sh configure.ac Makefile.am libcryptopp.pc.in)
for file in "${files[@]}"; do
echo "Downloading $file"
if ! ${FETCH_CMD} "$file" "https://raw.githubusercontent.com/noloader/cryptopp-autotools/master/$file"; then
echo "$file download failed"
exit 1
fi
if file "$file" | $GREP -q 'executable'; then
chmod +x "$file"
fi
# Throttle
sleep 1
done
if [ "$IS_DARWIN" -ne 0 ] && [ command -v xattr >/dev/null 2>&1 ]; then
echo "Removing bootstrap.sh quarantine"
xattr -d "com.apple.quarantine" bootstrap.sh >/dev/null 2>&1
fi
#############################################################################
echo "Running bootstrap"
echo ""
if ! ./bootstrap.sh; then
echo "bootstrap failed."
exit 1
fi
#############################################################################
echo "Running configure"
echo ""
if ! ./configure; then
echo "configure failed."
exit 1
fi
#############################################################################
echo ""
echo "Building test artifacts"
echo ""
${MAKE} clean >/dev/null 2>&1
if ! ${MAKE} -j2 -f Makefile; then
echo "make failed."
exit 1
fi
#############################################################################
echo ""
echo "Testing library"
echo ""
if ! ./cryptest v; then
echo "cryptest v failed."
exit 1
fi
if ! ./cryptest tv all; then
echo "cryptest tv all failed."
exit 1
fi
#############################################################################
echo ""
echo "Building tarball"
echo ""
if ! make dist; then
echo "make dist failed."
exit 1
fi
# Return success
exit 0
|