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
|
{
lib,
stdenv,
fetchurl,
python3,
docutils,
bzip2,
zlib,
darwin,
static ? stdenv.hostPlatform.isStatic, # generates static libraries *only*
}:
let
common =
{
version,
hash,
patches ? [ ],
}:
stdenv.mkDerivation (finalAttrs: {
pname = "botan";
inherit version;
__structuredAttrs = true;
enableParallelBuilding = true;
strictDeps = true;
outputs = [
"bin"
"out"
"dev"
"doc"
"man"
];
src = fetchurl {
url = "http://botan.randombit.net/releases/Botan-${finalAttrs.version}.tar.xz";
inherit hash;
};
inherit patches;
nativeBuildInputs = [
python3
docutils
];
buildInputs =
[
bzip2
zlib
]
++ lib.optionals stdenv.hostPlatform.isDarwin (
with darwin.apple_sdk.frameworks;
[
CoreServices
Security
]
);
buildTargets =
[ "cli" ]
++ lib.optionals finalAttrs.doCheck [ "tests" ]
++ lib.optionals static [ "static" ]
++ lib.optionals (!static) [ "shared" ];
botanConfigureFlags =
[
"--prefix=${placeholder "out"}"
"--bindir=${placeholder "bin"}/bin"
"--docdir=${placeholder "doc"}/share/doc"
"--mandir=${placeholder "man"}/share/man"
"--no-install-python-module"
"--build-targets=${lib.concatStringsSep "," finalAttrs.buildTargets}"
"--with-bzip2"
"--with-zlib"
"--with-rst2man"
]
++ lib.optionals stdenv.cc.isClang [
"--cc=clang"
]
++ lib.optionals stdenv.hostPlatform.isAarch64 [
"--cpu=aarch64"
];
configurePhase = ''
runHook preConfigure
python configure.py ''${botanConfigureFlags[@]}
runHook postConfigure
'';
preInstall = ''
if [ -d src/scripts ]; then
patchShebangs src/scripts
fi
'';
postInstall = ''
cd "$out"/lib/pkgconfig
ln -s botan-*.pc botan.pc || true
'';
doCheck = true;
meta = with lib; {
description = "Cryptographic algorithms library";
homepage = "https://botan.randombit.net";
mainProgram = "botan";
maintainers = with maintainers; [
raskin
thillux
];
platforms = platforms.unix;
license = licenses.bsd2;
};
});
in
{
botan3 = common {
version = "3.5.0";
hash = "sha256-Z+ja4cokaNkN5OYByH1fMf9JKzjoq4vL0C3fcQTtip8=";
# this patch fixes build errors on MacOS with SDK 10.12, recheck to remove this again
patches = lib.optionals stdenv.hostPlatform.isDarwin [ ./botan3-macos.patch ];
};
botan2 = common {
version = "2.19.5";
hash = "sha256-3+6g4KbybWckxK8B2pp7iEh62y2Bunxy/K9S21IsmtQ=";
};
}
|