diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/protobuf')
8 files changed, 163 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/protobuf/2.5.nix b/nixpkgs/pkgs/development/libraries/protobuf/2.5.nix new file mode 100644 index 000000000000..550d0b1bace2 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/protobuf/2.5.nix @@ -0,0 +1,10 @@ +{ callPackage, fetchurl, ... } @ args: + +callPackage ./generic.nix (args // rec { + version = "2.5.0"; + # make sure you test also -A pythonPackages.protobuf + src = fetchurl { + url = "http://protobuf.googlecode.com/files/${version}.tar.bz2"; + sha256 = "0xxn9gxhvsgzz2sgmihzf6pf75clr05mqj6218camwrwajpcbgqk"; + }; +}) \ No newline at end of file diff --git a/nixpkgs/pkgs/development/libraries/protobuf/3.1.nix b/nixpkgs/pkgs/development/libraries/protobuf/3.1.nix new file mode 100644 index 000000000000..91ef87512c84 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/protobuf/3.1.nix @@ -0,0 +1,6 @@ +{ callPackage, ... }: + +callPackage ./generic-v3.nix { + version = "3.1.0"; + sha256 = "0qlvpsmqgh9nw0k4zrxlxf75pafi3p0ahz99v6761b903y8qyv4i"; +} diff --git a/nixpkgs/pkgs/development/libraries/protobuf/3.4.nix b/nixpkgs/pkgs/development/libraries/protobuf/3.4.nix new file mode 100644 index 000000000000..5a9034a56a80 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/protobuf/3.4.nix @@ -0,0 +1,6 @@ +{ callPackage, lib, ... }: + +lib.overrideDerivation (callPackage ./generic-v3.nix { + version = "3.4.1"; + sha256 = "1lzxmbqlnmi34kymnf399azv86gmdbrf71xiad6wc24bzpkzqybb"; +}) (attrs: { NIX_CFLAGS_COMPILE = "-Wno-error"; }) diff --git a/nixpkgs/pkgs/development/libraries/protobuf/3.5.nix b/nixpkgs/pkgs/development/libraries/protobuf/3.5.nix new file mode 100644 index 000000000000..db9cb6f0371b --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/protobuf/3.5.nix @@ -0,0 +1,6 @@ +{ callPackage, lib, ... }: + +lib.overrideDerivation (callPackage ./generic-v3.nix { + version = "3.5.1.1"; + sha256 = "1h4xydr5j2zg1888ncn8a1jvqq8fgpgckrmjg6lqzy9jpkvqvfdk"; +}) (attrs: { NIX_CFLAGS_COMPILE = "-Wno-error"; }) diff --git a/nixpkgs/pkgs/development/libraries/protobuf/3.6.nix b/nixpkgs/pkgs/development/libraries/protobuf/3.6.nix new file mode 100644 index 000000000000..16decc44e847 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/protobuf/3.6.nix @@ -0,0 +1,6 @@ +{ callPackage, ... }: + +callPackage ./generic-v3.nix { + version = "3.6.1.3"; + sha256 = "1spj0d4flx6h3phxx3sg9r00yv734hina3365avkcz9brnm089c1"; +} diff --git a/nixpkgs/pkgs/development/libraries/protobuf/3.7.nix b/nixpkgs/pkgs/development/libraries/protobuf/3.7.nix new file mode 100644 index 000000000000..9bfb307e3286 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/protobuf/3.7.nix @@ -0,0 +1,6 @@ +{ callPackage, ... }: + +callPackage ./generic-v3.nix { + version = "3.7.1"; + sha256 = "00zkijvj80bmhlj8290x4bc416mng2dlbzwc4bkvfmbal1fx93m2"; +} diff --git a/nixpkgs/pkgs/development/libraries/protobuf/generic-v3.nix b/nixpkgs/pkgs/development/libraries/protobuf/generic-v3.nix new file mode 100644 index 000000000000..883dff56f2ee --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/protobuf/generic-v3.nix @@ -0,0 +1,63 @@ +{ stdenv +, fetchFromGitHub +, autoreconfHook, zlib, gmock, which, buildPackages +, version, sha256 +, ... +}: + +let +mkProtobufDerivation = buildProtobuf: stdenv: stdenv.mkDerivation rec { + name = "protobuf-${version}"; + + # make sure you test also -A pythonPackages.protobuf + src = fetchFromGitHub { + owner = "protocolbuffers"; + repo = "protobuf"; + rev = "v${version}"; + inherit sha256; + }; + + postPatch = '' + rm -rf gmock + cp -r ${gmock.src}/googlemock gmock + cp -r ${gmock.src}/googletest googletest + chmod -R a+w gmock + chmod -R a+w googletest + ln -s ../googletest gmock/gtest + '' + stdenv.lib.optionalString stdenv.isDarwin '' + substituteInPlace src/google/protobuf/testing/googletest.cc \ + --replace 'tmpnam(b)' '"'$TMPDIR'/foo"' + ''; + + nativeBuildInputs = [ autoreconfHook buildPackages.which buildPackages.stdenv.cc buildProtobuf ]; + + buildInputs = [ zlib ]; + configureFlags = if buildProtobuf == null then [] else [ "--with-protoc=${buildProtobuf}/bin/protoc" ]; + + enableParallelBuilding = true; + + doCheck = true; + + dontDisableStatic = true; + + NIX_CFLAGS_COMPILE = with stdenv.lib; + # gcc before 6 doesn't know this option + optionalString (hasPrefix "gcc-6" stdenv.cc.cc.name) "-Wno-error=misleading-indentation"; + + 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. + ''; + license = stdenv.lib.licenses.bsd3; + platforms = stdenv.lib.platforms.unix; + homepage = https://developers.google.com/protocol-buffers/; + }; + + passthru.version = version; +}; +in mkProtobufDerivation(if (stdenv.buildPlatform != stdenv.hostPlatform) + then (mkProtobufDerivation null buildPackages.stdenv) + else null) stdenv diff --git a/nixpkgs/pkgs/development/libraries/protobuf/generic.nix b/nixpkgs/pkgs/development/libraries/protobuf/generic.nix new file mode 100644 index 000000000000..1a20d806b968 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/protobuf/generic.nix @@ -0,0 +1,60 @@ +{ stdenv, version, src +, autoreconfHook, zlib, gtest +, ... +}: + +stdenv.mkDerivation rec { + name = "protobuf-${version}"; + + inherit src; + + postPatch = '' + rm -rf gtest + cp -r ${gtest.src}/googletest gtest + chmod -R a+w gtest + '' + stdenv.lib.optionalString stdenv.isDarwin '' + substituteInPlace src/google/protobuf/testing/googletest.cc \ + --replace 'tmpnam(b)' '"'$TMPDIR'/foo"' + ''; + + outputs = [ "out" "lib" ]; + + nativeBuildInputs = [ autoreconfHook ]; + buildInputs = [ zlib ]; + + # 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" + ]; + + doCheck = true; + + meta = { + description = "Protocol Buffers - 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. + ''; + license = "mBSD"; + homepage = https://developers.google.com/protocol-buffers/; + platforms = stdenv.lib.platforms.unix; + }; + + passthru.version = version; +} |