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
|
#! /bin/sh
sdir=`dirname $(readlink -f $0)`
rootdir=`dirname $sdir`
bname=`basename $0 .sh`
. $rootdir/jaulib/scripts/setup-machine-arch.sh
logfile=$rootdir/$bname-$os_name-$archabi.log
rm -f $logfile
MOD_HW_COMMON=simd,chacha_simd32,chacha_avx2,simd_avx2
# Since Intel Haswell or AMD Excavator: sha2_32_bmi2,sha2_64_bmi2
#MOD_HW_AMD64=aes_ni,sha2_32_x86,$MOD_HW_COMMON
MOD_HW_AMD64=sha2_32_x86,$MOD_HW_COMMON
CFG_OPTIONS_AMD64=
#MOD_HW_ARM64=aes_armv8,sha2_32_armv8,$MOD_HW_COMMON
MOD_HW_ARM64=sha2_32_armv8,$MOD_HW_COMMON
CFG_OPTIONS_ARM64=
MOD_HW_ARM32=$MOD_HW_COMMON
CFG_OPTIONS_ARM32="--disable-neon"
MOD_RNG=system_rng
MOD_HASH=sha2_32,sha2_64,blake2,blake2mac
#MOD_CIPHER=aes,gcm,chacha,chacha20poly1305,aead,stream
MOD_CIPHER=chacha,chacha20poly1305,aead,stream
# MOD_COMPRESSION=lzma,bzip2
#MOD_BASIC=base,cryptobox,pubkey,rsa,x509,eme_oaep,eme_raw,emsa1,emsa_raw,pbes2,eme_pkcs1,emsa_pkcs1
MOD_BASIC=base,pubkey,rsa,x509,eme_oaep,eme_raw,emsa1,emsa_raw,pbes2,eme_pkcs1,emsa_pkcs1
case "$archabi" in
"armhf")
USE_CPU=armhf
MOD_HW_THIS=$MOD_HW_ARM32
CFG_OPTIONS_THIS=$CFG_OPTIONS_ARM32
;;
"arm64")
USE_CPU=aarch64
MOD_HW_THIS=$MOD_HW_ARM64
CFG_OPTIONS_THIS=$CFG_OPTIONS_ARM64
;;
"amd64")
USE_CPU=x86_64
MOD_HW_THIS=$MOD_HW_AMD64
CFG_OPTIONS_THIS=$CFG_OPTIONS_AMD64
;;
*)
echo "Unsupported archabi $archabi"
exit 1
;;
esac
# CXX_FLAGS="-fno-rtti"
# LD_FLAGS="-fno-rtti"
CXX_FLAGS=
LD_FLAGS=
buildit() {
echo rootdir $rootdir
echo logfile $logfile
echo CPU $USE_CPU
echo CFG_OPTIONS_THIS $CFG_OPTIONS_THIS
echo MOD_BASIC $MOD_BASIC
echo MOD_CIPHER $MOD_CIPHER
echo MOD_HASH $MOD_HASH
echo MOD_RNG $MOD_RNG
echo MOD_HW_THIS $MOD_HW_THIS
rm -rf $rootdir/include/amalgamation-$os_name-$archabi
mkdir -p $rootdir/include/amalgamation-$os_name-$archabi
cd $rootdir/botan
./configure.py --cpu=$USE_CPU $CFG_OPTIONS_THIS \
--prefix=`pwd`/dist-$archabi-min \
--minimized-build \
--enable-modules=$MOD_BASIC,$MOD_CIPHER,$MOD_HASH,$MOD_RNG,$MOD_HW_THIS \
--cxxflags=$CXX_FLAGS \
--ldflags=$LD_FLAGS \
--amalgamation \
# --with-lzma --with-bzip2 \
mv botan_all.cpp botan_all.h $rootdir/include/amalgamation-$os_name-$archabi/
cd $rootdir
}
buildit 2>&1 | tee $logfile
cp -av $logfile $rootdir/include/amalgamation-$os_name-$archabi/
|