nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 boost,
6 zlib,
7 libevent,
8 openssl,
9 python3,
10 cmake,
11 pkg-config,
12 bison,
13 flex,
14 ctestCheckHook,
15 static ? stdenv.hostPlatform.isStatic,
16}:
17
18stdenv.mkDerivation (finalAttrs: {
19 pname = "thrift";
20 version = "0.22.0";
21
22 src = fetchFromGitHub {
23 owner = "apache";
24 repo = "thrift";
25 tag = "v${finalAttrs.version}";
26 hash = "sha256-gGAO+D0A/hEoHMm6OvRBc1Mks9y52kfd0q/Sg96pdW4=";
27 };
28
29 # Workaround to make the Python wrapper not drop this package:
30 # pythonFull.buildEnv.override { extraLibs = [ thrift ]; }
31 pythonPath = [ ];
32
33 nativeBuildInputs = [
34 bison
35 cmake
36 flex
37 pkg-config
38 (python3.withPackages (
39 ps:
40 with ps;
41 [
42 setuptools
43 six
44 ]
45 ++ lib.optionals (!static) [
46 twisted
47 ]
48 ))
49 ];
50
51 buildInputs = [
52 boost
53 ];
54
55 strictDeps = true;
56
57 propagatedBuildInputs = [
58 libevent
59 openssl
60 zlib
61 ];
62
63 nativeCheckInputs = [ ctestCheckHook ];
64
65 preConfigure = ''
66 export PY_PREFIX=$out
67 '';
68
69 cmakeFlags = [
70 (lib.cmakeBool "BUILD_JAVASCRIPT" false)
71 (lib.cmakeBool "BUILD_NODEJS" false)
72 (lib.cmakeBool "BUILD_SHARED_LIBS" (!static))
73 (lib.cmakeBool "OPENSSL_USE_STATIC_LIBS" static)
74
75 # FIXME: Fails to link in static mode with undefined reference to
76 # `boost::unit_test::unit_test_main(bool (*)(), int, char**)'
77 (lib.cmakeBool "BUILD_TESTING" (!static))
78 ];
79
80 disabledTests = [
81 "UnitTests" # getaddrinfo() -> -3; Temporary failure in name resolution
82 "python_test" # many failures about python 2 or network things
83 ]
84 ++ lib.optionals stdenv.hostPlatform.isDarwin [
85 # Tests that hang up in the Darwin sandbox
86 "SecurityTest"
87 "SecurityFromBufferTest"
88 "PythonThriftTNonblockingServer"
89
90 # fails on hydra, passes locally
91 "concurrency_test"
92
93 # Tests that fail in the Darwin sandbox when trying to use network
94 "UnitTests"
95 "TInterruptTest"
96 "TServerIntegrationTest"
97 "processor"
98 "processor_test"
99 "TNonblockingServerTest"
100 "TNonblockingSSLServerTest"
101 "StressTest"
102 "StressTestConcurrent"
103 "StressTestNonBlocking"
104 ];
105
106 doCheck = !static;
107
108 enableParallelChecking = false;
109
110 meta = {
111 description = "Library for scalable cross-language services";
112 mainProgram = "thrift";
113 homepage = "https://thrift.apache.org/";
114 license = lib.licenses.asl20;
115 platforms = lib.platforms.linux ++ lib.platforms.darwin;
116 maintainers = with lib.maintainers; [ bjornfor ];
117 };
118})