1{ lib, stdenv
2, fetchurl
3, python3
4, pkg-config
5, cmocka
6, readline
7, talloc
8, libxslt
9, docbook-xsl-nons
10, docbook_xml_dtd_42
11, which
12, wafHook
13, buildPackages
14, libxcrypt
15}:
16
17stdenv.mkDerivation rec {
18 pname = "tevent";
19 version = "0.16.1";
20
21 src = fetchurl {
22 url = "mirror://samba/tevent/${pname}-${version}.tar.gz";
23 sha256 = "sha256-Nilx4PMtwZBfb+RzYxnEuDSMItyFqmw/aQoo7+VIAp4=";
24 };
25
26 nativeBuildInputs = [
27 pkg-config
28 which
29 python3
30 libxslt
31 docbook-xsl-nons
32 docbook_xml_dtd_42
33 wafHook
34 ];
35
36 buildInputs = [
37 python3
38 cmocka
39 readline # required to build python
40 talloc
41 libxcrypt
42 ];
43
44 # otherwise the configure script fails with
45 # PYTHONHASHSEED=1 missing! Don't use waf directly, use ./configure and make!
46 preConfigure = ''
47 export PKGCONFIG="$PKG_CONFIG"
48 export PYTHONHASHSEED=1
49 '';
50
51 wafPath = "buildtools/bin/waf";
52
53 wafConfigureFlags = [
54 "--bundled-libraries=NONE"
55 "--builtin-libraries=replace"
56 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
57 "--cross-compile"
58 "--cross-execute=${stdenv.hostPlatform.emulator buildPackages}"
59 ];
60
61 # python-config from build Python gives incorrect values when cross-compiling.
62 # If python-config is not found, the build falls back to using the sysconfig
63 # module, which works correctly in all cases.
64 PYTHON_CONFIG = "/invalid";
65
66 meta = with lib; {
67 description = "Event system based on the talloc memory management library";
68 homepage = "https://tevent.samba.org/";
69 license = licenses.lgpl3Plus;
70 platforms = platforms.all;
71 };
72}