1 { lib, stdenv, version, src
2 , autoreconfHook, zlib, gtest
14 cp -r ${gtest.src}/googletest gtest
16 '' + lib.optionalString stdenv.isDarwin ''
17 substituteInPlace src/google/protobuf/testing/googletest.cc \
18 --replace 'tmpnam(b)' '"'$TMPDIR'/foo"'
21 outputs = [ "out" "lib" ];
23 nativeBuildInputs = [ autoreconfHook ];
24 buildInputs = [ zlib ];
26 # The generated C++ code uses static initializers which mutate a global data
27 # structure. This causes problems for an executable when:
29 # 1) it dynamically links to two libs, both of which contain generated C++ for
30 # the same proto file, and
31 # 2) the two aforementioned libs both dynamically link to libprotobuf.
33 # One solution is to statically link libprotobuf, that way the global
34 # variables are not shared; in fact, this is necessary for the python Mesos
35 # binding to not crash, as the python lib contains two C extensions which
36 # both refer to the same proto schema.
38 # See: https://github.com/NixOS/nixpkgs/pull/19064#issuecomment-255082684
39 # https://github.com/google/protobuf/issues/1489
40 dontDisableStatic = true;
49 description = "Protocol Buffers - Google's data interchange format";
51 '' Protocol Buffers are a way of encoding structured data in an
52 efficient yet extensible format. Google uses Protocol Buffers for
53 almost all of its internal RPC protocols and file formats.
56 homepage = "https://developers.google.com/protocol-buffers/";
57 platforms = lib.platforms.unix;
60 passthru.version = version;