Skip to content

Commit eaaa0a0

Browse files
committed
Prepare for Crypto++ 8.1 release
* Bump version to Crypto++ 8.1 * Remove Android restrictions * Add use of AC_CANONICAL_BUILD * Use $build instead of $host * Use $CXXFLAGS when determining $COMPILER_TARGET * Do not use $ac_srcdir because it is broke Cross-compiles like Android are still broke, but it is an Autotool problem. I wish those assholes would fix their broken shit.
1 parent 5ca9614 commit eaaa0a0

File tree

3 files changed

+51
-30
lines changed

3 files changed

+51
-30
lines changed

Makefile.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ endif
194194
libcryptopp_la_DEPENDENCIES += $(libothers_la_OBJECTS)
195195

196196
## Very important... Version number of the library
197-
libcryptopp_la_LDFLAGS = $(AM_LDFLAGS) -version-info 8:0:0
197+
libcryptopp_la_LDFLAGS = $(AM_LDFLAGS) -version-info 8:1:0
198198

199199
## Source files with special needs
200200
libcryptlib_la_SOURCES = cryptlib.cpp

README.md

+26-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ You may also need `libltdl-dev` on Debian and Ubuntu; and may need `libtool-ltdl
7676
If working on the GCC Compile Farm then you may need exta steps for systems like AIX. AIX offers updated Autoconf and Automake in `/opt/freeware/bin/`; and offers Libtool in `/opt/cfarm/libtool-2.4.2/bin/`. Both `bin/` need to be on path. When running `autoreconf` you must `autoreconf --force --install --include=/opt/cfarm/libtool-2.4.2/share/aclocal/`.
7777

7878
# Integration
79-
The Autotools submodule integrates with the Crypto++ library. The submodule removes the library's `GNUmakefile` and `GNUmakefile-cross`. In the future we plan to overwrite the library's `config.h` and produce a n installation specific `config.h`.
79+
The Autotools submodule integrates with the Crypto++ library. The submodule removes the library's `GNUmakefile` and `GNUmakefile-cross`. In the future we plan to overwrite the library's `config.h` and produce an installation specific `config.h`.
8080

8181
The library's `GNUmakefile` and `GNUmakefile-cross` were modified to clean the artifacts produced by Autotools. To clean the directory after running Autotools perform a `git checkout GNUmakefile` followed by a `make -f GNUmakefile distclean`.
8282

@@ -89,6 +89,31 @@ If you want to use `cryptest-autotools.sh` to drive things then perform the foll
8989
cp TestScripts/cryptest-autotools.sh .
9090
./cryptest-autotools.sh
9191

92+
# Cross-compiles
93+
94+
Cross-compiles are mostly broken due to Autotools. The biggest problem seems to be Autotools inability to honor a C++ project settings. Using Android as an example:
95+
96+
* `configure.ac` sets `AC_PROG_CXX`
97+
* `configure.ac` sets `AC_LANG([C++])`
98+
* User sets `CXX=/opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++`
99+
* User sets `LD=/opt/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++`
100+
* User sets `CXXFLAGS="-target armv7-none-linux-androideabi21 ...`
101+
* User sets `LDFLAGS="-Wl,-target=armv7-none-linux-androideabi21 ...`
102+
* User invokes `./configure --host=$(config.guess) --build=armv7-none-linux-androideabi21`
103+
104+
Autotools will perform a test using the host's gcc and fail with:
105+
106+
```
107+
configure:3481: checking whether the C compiler works
108+
configure:3503: gcc -Wl,-target=armv7-none-linux-androideabi21 ... conftest.c >&5
109+
/usr/bin/ld: unrecognised emulation mode: thumb
110+
Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu i386linux elf_l1om
111+
elf_k1om i386pep i386pe
112+
collect2: error: ld returned 1 exit status
113+
```
114+
115+
Autotools absolutely sucks. The maintainers have had 30 years to get it right and their shit is still broken.
116+
92117
# Collaboration
93118
We would like all distro maintainers to be collaborators on this repo. If you are a distro maintainer then please contact us so we can send you an invite.
94119

configure.ac

+24-28
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191

9292
#############################################################################
9393

94-
AC_INIT([Crypto++], [8.0], [http://www.cryptopp.com/wiki/Bug_Report], [cryptopp], [http://www.cryptopp.com])
94+
AC_INIT([Crypto++], [8.1], [http://www.cryptopp.com/wiki/Bug_Report], [cryptopp], [http://www.cryptopp.com])
9595
AM_INIT_AUTOMAKE
9696

9797
AC_CONFIG_MACRO_DIR([m4])
@@ -117,24 +117,25 @@ AC_LANG_ASSERT([C++])
117117
## Most people call this the target machine, but not Autotools.
118118

119119
AC_CANONICAL_HOST
120+
AC_CANONICAL_BUILD
120121

121122
## These are some variables that help us track platform and compiler.
122123
## It speeds up configuration by adding some intelligence to the
123124
## test selection process. It also avoids failed configurations by
124125
## avoiding some tests that fail but Autotools reports as success.
125126

126-
IS_AIX_OS=`echo $host | $EGREP -i -c 'aix'`
127+
IS_AIX_OS=`echo $build | $EGREP -i -c 'aix'`
127128
IS_SUN_OS=`uname -s | $EGREP -i -c 'SunOS'`
128-
IS_APPLE_OS=`echo "$host" | $EGREP -i -c -E 'apple|darwin'`
129-
IS_ANDROID_OS=`echo $host | $EGREP -i -c 'android'`
130-
IS_CYGWIN_OS=`echo $host | $EGREP -i -c 'cygwin'`
131-
IS_MINGW_OS=`echo $host | $EGREP -i -c 'mingw'`
129+
IS_APPLE_OS=`echo "$build" | $EGREP -i -c -E 'apple|darwin'`
130+
IS_ANDROID_OS=`echo $build | $EGREP -i -c 'android'`
131+
IS_CYGWIN_OS=`echo $build | $EGREP -i -c 'cygwin'`
132+
IS_MINGW_OS=`echo $build | $EGREP -i -c 'mingw'`
132133

133-
IS_IA32=`echo $host | $EGREP -i -c -E 'i.86|x86_64|amd64'`
134-
IS_ARM32=`echo $host | $EGREP -i -c -E 'arm|armhf|arm7l|eabihf'`
135-
IS_ARMV8=`echo $host | $EGREP -i -c -E 'aarch32|aarch64'`
136-
IS_PPC=`echo $host | $EGREP -i -c -E 'ppc|powerpc|powermac'`
137-
IS_SPARC=`echo $host | $EGREP -i -c -E 'sparc|sparcv8|sparcv9|sparc64'`
134+
IS_IA32=`echo $build | $EGREP -i -c -E 'i.86|x86_64|amd64'`
135+
IS_ARM32=`echo $build | $EGREP -i -c -E 'arm|armhf|arm7l|eabihf'`
136+
IS_ARMV8=`echo $build | $EGREP -i -c -E 'aarch32|aarch64'`
137+
IS_PPC=`echo $build | $EGREP -i -c -E 'ppc|powerpc|powermac'`
138+
IS_SPARC=`echo $build | $EGREP -i -c -E 'sparc|sparcv8|sparcv9|sparc64'`
138139

139140
## Debug builds add more goodies to help break things. I like breaking things.
140141
IS_DEBUG=`echo $CPPFLAGS $CXXFLAGS | $EGREP -i -c '\-DDEBUG'`
@@ -149,18 +150,18 @@ IS_DEBUG=`echo $CPPFLAGS $CXXFLAGS | $EGREP -i -c '\-DDEBUG'`
149150
## See if CXX is valid. Autotools just trucks on with an invalid one.
150151

151152
if test x"$CXX" != "x"; then
152-
COMPILER_TARGET=`command -v "$CXX"`
153-
if test x"$COMPILER_TARGET" = "x"; then
153+
COMPILER_VALID=`command -v "$CXX"`
154+
if test x"$COMPILER_VALID" = "x"; then
154155
AC_MSG_FAILURE(["$CXX" is not a valid compiler or is not on-path])
155156
fi
156157
fi
157158

158159
## Compiler is valid. Try to detect the target and vendor.
159-
## SunCC is empty, so we just use $host
160+
## SunCC is empty, so we just use $build
160161

161-
COMPILER_TARGET=`"$CXX" -dumpmachine 2>/dev/null`
162+
COMPILER_TARGET=`"$CXX" "$CXXFLAGS" -dumpmachine 2>/dev/null`
162163
if test x"$COMPILER_TARGET" = "x"; then
163-
COMPILER_TARGET="$host"
164+
COMPILER_TARGET="$build"
164165
fi
165166

166167
## Determine the compiler's vendor. We need to work around some Autoconf bugs.
@@ -221,8 +222,6 @@ if test "$IS_ANDROID_OS" != "0"; then
221222
AC_MSG_RESULT([no])
222223
AC_MSG_ERROR([ANDROID_NDK_ROOT is not set. Please set ANDROID_NDK_ROOT])
223224
fi
224-
225-
AC_MSG_ERROR(["Android is not ready. Ping noloader, gmail to move it along."])
226225
fi
227226

228227
#############################################################################
@@ -1431,15 +1430,10 @@ fi
14311430
#############################################################################
14321431
## ARM A-32, including NEON, soft floats and hard floats
14331432

1434-
if test "$IS_ARM32" != "0" && test "$IS_ANDROID_OS" != "0"; then
1435-
1436-
AC_MSG_ERROR(["Android is not ready. Ping noloader, gmail to move it along."])
1437-
fi
1438-
14391433
if test "$IS_ARM32" != "0" && test "$IS_ANDROID_OS" = "0"; then
14401434

14411435
## Most Linux are hard-float systems.
1442-
IS_ARMHF=`echo $host | $EGREP -i -c -E 'armhf|arm7l|gnueabihf'`
1436+
IS_ARMHF=`echo $build | $EGREP -i -c -E 'armhf|arm7l|gnueabihf'`
14431437
if test "$IS_ARMHF" != "0"; then
14441438
#AC_MSG_NOTICE([ARM hard-floats detected, using -mfloat-abi=hard.])
14451439
FP_FLAG="hard"
@@ -2234,18 +2228,20 @@ fi
22342228

22352229
if test "$IS_ANDROID_OS" != "0"; then
22362230

2231+
# ac_srcdir does not work. Autotools blows...
2232+
22372233
THIS_FILE="$ANDROID_NDK_ROOT/sources/android/cpufeatures/cpu-features.h"
22382234
AC_CHECK_FILE([$THIS_FILE],
2239-
[cp "$THIS_FILE" "$ac_srcdir"]
2235+
[cp "$THIS_FILE" "./"]
22402236
)
22412237

22422238
THIS_FILE="$ANDROID_NDK_ROOT/sources/android/cpufeatures/cpu-features.c"
22432239
AC_CHECK_FILE([$THIS_FILE],
2244-
[cp "$THIS_FILE" "$ac_srcdir"]
2240+
[cp "$THIS_FILE" "./"]
22452241
)
22462242

22472243
# And set the flag so Makefile adds the recipes
2248-
THIS_FILE="$ac_srcdir/cpu-features.c"
2244+
THIS_FILE="./cpu-features.c"
22492245
AC_CHECK_FILE([$THIS_FILE],
22502246
[AM_CONDITIONAL([ANDROID_CPU_FEATURES], [true])],
22512247
[AM_CONDITIONAL([ANDROID_CPU_FEATURES], [false])]
@@ -2319,7 +2315,7 @@ echo "something looks wrong then please modify config.h and please report"
23192315
echo "it at http://github.com/noloader/cryptopp-autotools."
23202316
echo ""
23212317

2322-
echo " Build triplet: $host"
2318+
echo " Build triplet: $build"
23232319
echo " Compiler target: $COMPILER_TARGET"
23242320
echo "Compiler version: $COMPILER_VERSION"
23252321
echo ""

0 commit comments

Comments
 (0)