2021-01-21 17:00:13 +00:00
|
|
|
{ lib, stdenv
|
2016-11-09 20:51:43 +00:00
|
|
|
, fetchFromGitHub
|
2019-06-16 20:59:06 +01:00
|
|
|
, autoreconfHook, zlib, gmock, buildPackages
|
2016-11-09 20:51:43 +00:00
|
|
|
, version, sha256
|
|
|
|
, ...
|
|
|
|
}:
|
|
|
|
|
2018-10-15 08:22:24 +01:00
|
|
|
let
|
2019-08-13 22:52:01 +01:00
|
|
|
mkProtobufDerivation = buildProtobuf: stdenv: stdenv.mkDerivation {
|
2019-08-13 22:52:01 +01:00
|
|
|
pname = "protobuf";
|
|
|
|
inherit version;
|
2016-11-09 20:51:43 +00:00
|
|
|
|
|
|
|
# make sure you test also -A pythonPackages.protobuf
|
|
|
|
src = fetchFromGitHub {
|
2018-09-25 02:43:15 +01:00
|
|
|
owner = "protocolbuffers";
|
2016-11-09 20:51:43 +00:00
|
|
|
repo = "protobuf";
|
|
|
|
rev = "v${version}";
|
|
|
|
inherit sha256;
|
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
rm -rf gmock
|
2017-01-06 20:37:12 +00:00
|
|
|
cp -r ${gmock.src}/googlemock gmock
|
|
|
|
cp -r ${gmock.src}/googletest googletest
|
2016-11-09 20:51:43 +00:00
|
|
|
chmod -R a+w gmock
|
2017-01-06 20:37:12 +00:00
|
|
|
chmod -R a+w googletest
|
|
|
|
ln -s ../googletest gmock/gtest
|
2021-01-21 17:00:13 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2016-11-09 20:51:43 +00:00
|
|
|
substituteInPlace src/google/protobuf/testing/googletest.cc \
|
|
|
|
--replace 'tmpnam(b)' '"'$TMPDIR'/foo"'
|
|
|
|
'';
|
|
|
|
|
2018-10-15 08:22:24 +01:00
|
|
|
nativeBuildInputs = [ autoreconfHook buildPackages.which buildPackages.stdenv.cc buildProtobuf ];
|
|
|
|
|
2017-09-05 22:26:13 +01:00
|
|
|
buildInputs = [ zlib ];
|
2018-10-15 08:22:24 +01:00
|
|
|
configureFlags = if buildProtobuf == null then [] else [ "--with-protoc=${buildProtobuf}/bin/protoc" ];
|
2016-11-09 20:51:43 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2017-09-28 11:57:54 +01:00
|
|
|
dontDisableStatic = true;
|
|
|
|
|
2016-11-09 20:51:43 +00:00
|
|
|
meta = {
|
|
|
|
description = "Google's data interchange format";
|
|
|
|
longDescription =
|
|
|
|
''Protocol Buffers are a way of encoding structured data in an efficient
|
|
|
|
yet extensible format. Google uses Protocol Buffers for almost all of
|
|
|
|
its internal RPC protocols and file formats.
|
|
|
|
'';
|
2021-01-21 17:00:13 +00:00
|
|
|
license = lib.licenses.bsd3;
|
|
|
|
platforms = lib.platforms.unix;
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://developers.google.com/protocol-buffers/";
|
2016-11-09 20:51:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
passthru.version = version;
|
2018-10-15 08:22:24 +01:00
|
|
|
};
|
|
|
|
in mkProtobufDerivation(if (stdenv.buildPlatform != stdenv.hostPlatform)
|
|
|
|
then (mkProtobufDerivation null buildPackages.stdenv)
|
|
|
|
else null) stdenv
|