diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-01-07 02:18:36 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2019-01-07 02:18:47 +0000 |
commit | 36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch) | |
tree | b3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/development/libraries/protobuf | |
parent | 4e31070265257dc67d120c27e0f75c2344fdfa9a (diff) | |
parent | abf060725d7614bd3b9f96764262dfbc2f9c2199 (diff) | |
download | nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2 nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip |
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/protobuf')
7 files changed, 157 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..0009209d9cef --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/protobuf/3.6.nix @@ -0,0 +1,6 @@ +{ callPackage, ... }: + +callPackage ./generic-v3.nix { + version = "3.6.1"; + sha256 = "1bg40miylzpy2wgbd7l7zjgmk43l12q38fq0zkn0vzy1lsj457sq"; +} 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; +} |