3 , autoreconfHook, zlib, gtest, buildPackages
9 mkProtobufDerivation = buildProtobuf: stdenv: stdenv.mkDerivation {
13 # make sure you test also -A pythonPackages.protobuf
14 src = fetchFromGitHub {
15 owner = "protocolbuffers";
23 cp -r ${gtest.src}/googlemock gmock
24 cp -r ${gtest.src}/googletest googletest
26 chmod -R a+w googletest
27 ln -s ../googletest gmock/gtest
28 '' + lib.optionalString stdenv.isDarwin ''
29 substituteInPlace src/google/protobuf/testing/googletest.cc \
30 --replace 'tmpnam(b)' '"'$TMPDIR'/foo"'
33 nativeBuildInputs = [ autoreconfHook buildPackages.which buildPackages.stdenv.cc buildProtobuf ];
35 buildInputs = [ zlib ];
36 configureFlags = lib.optional (buildProtobuf != null) "--with-protoc=${buildProtobuf}/bin/protoc";
38 enableParallelBuilding = true;
42 dontDisableStatic = true;
45 description = "Google's data interchange format";
47 ''Protocol Buffers are a way of encoding structured data in an efficient
48 yet extensible format. Google uses Protocol Buffers for almost all of
49 its internal RPC protocols and file formats.
51 homepage = "https://developers.google.com/protocol-buffers/";
52 license = lib.licenses.bsd3;
53 mainProgram = "protoc";
54 platforms = lib.platforms.unix;
57 in mkProtobufDerivation(if (stdenv.buildPlatform != stdenv.hostPlatform)
58 then (mkProtobufDerivation null buildPackages.stdenv)