2021-04-05 15:23:46 +00:00
|
|
|
{ lib, stdenv, fetchurl, boost, zlib, libevent, openssl, python, cmake, pkg-config
|
2021-01-05 17:05:55 +00:00
|
|
|
, bison, flex, twisted
|
|
|
|
, static ? stdenv.hostPlatform.isStatic
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "thrift";
|
2021-06-28 23:13:55 +00:00
|
|
|
version = "0.14.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://archive.apache.org/dist/thrift/${version}/${pname}-${version}.tar.gz";
|
2021-06-28 23:13:55 +00:00
|
|
|
sha256 = "sha256-QZG/wLdJDiDMafn03G6ZH7thLUVRqp7vHb9/TEfOVU0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# Workaround to make the python wrapper not drop this package:
|
|
|
|
# pythonFull.buildEnv.override { extraLibs = [ thrift ]; }
|
|
|
|
pythonPath = [];
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ cmake pkg-config bison flex ];
|
|
|
|
buildInputs = [ boost zlib libevent openssl ]
|
|
|
|
++ lib.optionals (!static) [ python twisted ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
preConfigure = "export PY_PREFIX=$out";
|
|
|
|
|
|
|
|
cmakeFlags = [
|
2021-04-05 15:23:46 +00:00
|
|
|
"-DBUILD_JAVASCRIPT:BOOL=OFF"
|
|
|
|
"-DBUILD_NODEJS:BOOL=OFF"
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# FIXME: Fails to link in static mode with undefined reference to
|
|
|
|
# `boost::unit_test::unit_test_main(bool (*)(), int, char**)'
|
|
|
|
"-DBUILD_TESTING:BOOL=${if static then "OFF" else "ON"}"
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals static [
|
2020-04-24 23:36:52 +00:00
|
|
|
"-DWITH_STATIC_LIB:BOOL=ON"
|
|
|
|
"-DOPENSSL_USE_STATIC_LIBS=ON"
|
|
|
|
];
|
|
|
|
|
2021-04-05 15:23:46 +00:00
|
|
|
disabledTests = [
|
|
|
|
"PythonTestSSLSocket"
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
# tests that hang up in the darwin sandbox
|
|
|
|
"SecurityTest"
|
|
|
|
"SecurityFromBufferTest"
|
|
|
|
"python_test"
|
|
|
|
|
|
|
|
# tests that fail in the darwin sandbox when trying to use network
|
|
|
|
"UnitTests"
|
|
|
|
"TInterruptTest"
|
|
|
|
"TServerIntegrationTest"
|
|
|
|
"processor"
|
|
|
|
"TNonblockingServerTest"
|
|
|
|
"TNonblockingSSLServerTest"
|
|
|
|
"StressTest"
|
|
|
|
"StressTestConcurrent"
|
|
|
|
"StressTestNonBlocking"
|
|
|
|
"PythonThriftTNonblockingServer"
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
doCheck = !static;
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
2021-04-05 15:23:46 +00:00
|
|
|
${lib.optionalString stdenv.isDarwin "DY"}LD_LIBRARY_PATH=$PWD/lib ctest -E "($(echo "$disabledTests" | tr " " "|"))"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
enableParallelChecking = false;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Library for scalable cross-language services";
|
|
|
|
homepage = "http://thrift.apache.org/";
|
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
|
|
maintainers = [ maintainers.bjornfor ];
|
|
|
|
};
|
|
|
|
}
|