at 23.05-pre 123 lines 3.1 kB view raw
1{ lib 2, stdenv 3, fetchurl 4, fetchpatch 5, boost 6, zlib 7, libevent 8, openssl 9, python3 10, cmake 11, pkg-config 12, bison 13, flex 14, static ? stdenv.hostPlatform.isStatic 15}: 16 17stdenv.mkDerivation rec { 18 pname = "thrift"; 19 version = "0.17.0"; 20 21 src = fetchurl { 22 url = "https://archive.apache.org/dist/thrift/${version}/${pname}-${version}.tar.gz"; 23 hash = "sha256-snLBeIuxZdmVIaJZmzG5f6aeWTHQmQFdka4QegsMxY8="; 24 }; 25 26 # Workaround to make the Python wrapper not drop this package: 27 # pythonFull.buildEnv.override { extraLibs = [ thrift ]; } 28 pythonPath = []; 29 30 nativeBuildInputs = [ 31 bison 32 cmake 33 flex 34 pkg-config 35 ]; 36 37 buildInputs = [ 38 boost 39 libevent 40 openssl 41 zlib 42 ] ++ lib.optionals (!static) [ 43 (python3.withPackages (ps: [ps.twisted])) 44 ]; 45 46 postPatch = '' 47 # Python 3.10 related failures: 48 # SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats 49 # AttributeError: module 'collections' has no attribute 'Hashable' 50 substituteInPlace test/py/RunClientServer.py \ 51 --replace "'FastbinaryTest.py'," "" \ 52 --replace "'TestEof.py'," "" \ 53 --replace "'TestFrozen.py'," "" 54 ''; 55 56 preConfigure = '' 57 export PY_PREFIX=$out 58 ''; 59 60 patches = [ 61 # ToStringTest.cpp is failing from some reason due to locale issue, this 62 # doesn't disable all UnitTests as in Darwin. 63 ./disable-failing-test.patch 64 (fetchpatch { 65 name = "setuptools-gte-62.1.0.patch"; # https://github.com/apache/thrift/pull/2635 66 url = "https://github.com/apache/thrift/commit/c41ad9d5119e9bdae1746167e77e224f390f2c42.diff"; 67 hash = "sha256-FkErrg/6vXTomS4AsCsld7t+Iccc55ZiDaNjJ3W1km0="; 68 }) 69 ]; 70 71 cmakeFlags = [ 72 "-DBUILD_JAVASCRIPT:BOOL=OFF" 73 "-DBUILD_NODEJS:BOOL=OFF" 74 75 # FIXME: Fails to link in static mode with undefined reference to 76 # `boost::unit_test::unit_test_main(bool (*)(), int, char**)' 77 "-DBUILD_TESTING:BOOL=${if static then "OFF" else "ON"}" 78 ] ++ lib.optionals static [ 79 "-DWITH_STATIC_LIB:BOOL=ON" 80 "-DOPENSSL_USE_STATIC_LIBS=ON" 81 ]; 82 83 disabledTests = [ 84 "PythonTestSSLSocket" 85 ] ++ lib.optionals stdenv.isDarwin [ 86 # Tests that hang up in the Darwin sandbox 87 "SecurityTest" 88 "SecurityFromBufferTest" 89 "python_test" 90 91 # Tests that fail in the Darwin sandbox when trying to use network 92 "UnitTests" 93 "TInterruptTest" 94 "TServerIntegrationTest" 95 "processor" 96 "TNonblockingServerTest" 97 "TNonblockingSSLServerTest" 98 "StressTest" 99 "StressTestConcurrent" 100 "StressTestNonBlocking" 101 "PythonThriftTNonblockingServer" 102 ]; 103 104 doCheck = !static; 105 106 checkPhase = '' 107 runHook preCheck 108 109 ${lib.optionalString stdenv.isDarwin "DY"}LD_LIBRARY_PATH=$PWD/lib ctest -E "($(echo "$disabledTests" | tr " " "|"))" 110 111 runHook postCheck 112 ''; 113 114 enableParallelChecking = false; 115 116 meta = with lib; { 117 description = "Library for scalable cross-language services"; 118 homepage = "https://thrift.apache.org/"; 119 license = licenses.asl20; 120 platforms = platforms.linux ++ platforms.darwin; 121 maintainers = with maintainers; [ bjornfor ]; 122 }; 123}