2018-07-21 01:44:44 +01:00
|
|
|
{ stdenv, version, src
|
2015-02-06 20:21:57 +00:00
|
|
|
, autoreconfHook, zlib, gtest
|
|
|
|
, ...
|
|
|
|
}:
|
2010-10-30 22:44:22 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2015-02-20 18:42:14 +00:00
|
|
|
name = "protobuf-${version}";
|
2014-11-19 18:33:20 +00:00
|
|
|
|
2015-02-06 20:21:57 +00:00
|
|
|
inherit src;
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
rm -rf gtest
|
2017-01-06 20:37:12 +00:00
|
|
|
cp -r ${gtest.src}/googletest gtest
|
2015-02-06 20:21:57 +00:00
|
|
|
chmod -R a+w gtest
|
2015-10-20 02:40:55 +01:00
|
|
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
substituteInPlace src/google/protobuf/testing/googletest.cc \
|
|
|
|
--replace 'tmpnam(b)' '"'$TMPDIR'/foo"'
|
2015-02-06 20:21:57 +00:00
|
|
|
'';
|
2014-11-19 18:33:20 +00:00
|
|
|
|
2016-04-14 15:04:49 +01:00
|
|
|
outputs = [ "out" "lib" ];
|
|
|
|
|
2017-09-05 22:26:13 +01:00
|
|
|
nativeBuildInputs = [ autoreconfHook ];
|
|
|
|
buildInputs = [ zlib ];
|
2010-10-30 22:44:22 +01:00
|
|
|
|
2016-12-28 05:19:51 +00:00
|
|
|
# The generated C++ code uses static initializers which mutate a global data
|
|
|
|
# structure. This causes problems for an executable when:
|
|
|
|
#
|
|
|
|
# 1) it dynamically links to two libs, both of which contain generated C++ for
|
|
|
|
# the same proto file, and
|
|
|
|
# 2) the two aforementioned libs both dynamically link to libprotobuf.
|
|
|
|
#
|
|
|
|
# One solution is to statically link libprotobuf, that way the global
|
|
|
|
# variables are not shared; in fact, this is necessary for the python Mesos
|
|
|
|
# binding to not crash, as the python lib contains two C extensions which
|
|
|
|
# both refer to the same proto schema.
|
|
|
|
#
|
|
|
|
# See: https://github.com/NixOS/nixpkgs/pull/19064#issuecomment-255082684
|
|
|
|
# https://github.com/google/protobuf/issues/1489
|
|
|
|
dontDisableStatic = true;
|
|
|
|
configureFlags = [
|
|
|
|
"CFLAGS=-fPIC"
|
|
|
|
"CXXFLAGS=-fPIC"
|
|
|
|
];
|
|
|
|
|
2014-09-18 12:12:01 +01:00
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
meta = {
|
2010-10-30 22:44:22 +01:00
|
|
|
description = "Protocol Buffers - Google's data interchange format";
|
2014-11-25 11:59:56 +00:00
|
|
|
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.
|
|
|
|
'';
|
|
|
|
license = "mBSD";
|
2016-01-15 01:24:54 +00:00
|
|
|
homepage = https://developers.google.com/protocol-buffers/;
|
2016-08-02 18:50:55 +01:00
|
|
|
platforms = stdenv.lib.platforms.unix;
|
2010-10-30 22:44:22 +01:00
|
|
|
};
|
2015-02-20 18:36:16 +00:00
|
|
|
|
|
|
|
passthru.version = version;
|
2010-10-30 22:44:22 +01:00
|
|
|
}
|