about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/protobuf
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-09-22 19:21:26 +0000
committerAlyssa Ross <hi@alyssa.is>2023-09-22 19:21:26 +0000
commitea2acbed493e218f696673a004a95829392c5e33 (patch)
treec5716552f205bbf4d4addfa4675ea5073786bd06 /nixpkgs/pkgs/development/libraries/protobuf
parent06ba6c84f858b011fb1132721e5d5e28fcda4a8a (diff)
parent8aa8cd68f4745eb92f003666bfd300f3e67cd9c1 (diff)
downloadnixlib-ea2acbed493e218f696673a004a95829392c5e33.tar
nixlib-ea2acbed493e218f696673a004a95829392c5e33.tar.gz
nixlib-ea2acbed493e218f696673a004a95829392c5e33.tar.bz2
nixlib-ea2acbed493e218f696673a004a95829392c5e33.tar.lz
nixlib-ea2acbed493e218f696673a004a95829392c5e33.tar.xz
nixlib-ea2acbed493e218f696673a004a95829392c5e33.tar.zst
nixlib-ea2acbed493e218f696673a004a95829392c5e33.zip
Merge branch 'staging' of https://github.com/NixOS/nixpkgs
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/protobuf')
-rw-r--r--nixpkgs/pkgs/development/libraries/protobuf/3.17.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/protobuf/3.24.nix4
-rw-r--r--nixpkgs/pkgs/development/libraries/protobuf/generic-v3-cmake.nix150
3 files changed, 74 insertions, 86 deletions
diff --git a/nixpkgs/pkgs/development/libraries/protobuf/3.17.nix b/nixpkgs/pkgs/development/libraries/protobuf/3.17.nix
deleted file mode 100644
index 36198b5d337b..000000000000
--- a/nixpkgs/pkgs/development/libraries/protobuf/3.17.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-{ callPackage, ... } @ args:
-
-callPackage ./generic-v3.nix ({
-  version = "3.17.3";
-  sha256 = "08644kaxhpjs38q5q4fp01yr0wakg1ijha4g3lzp2ifg7y3c465d";
-} // args)
diff --git a/nixpkgs/pkgs/development/libraries/protobuf/3.24.nix b/nixpkgs/pkgs/development/libraries/protobuf/3.24.nix
index 2deb155444ec..60ad747194df 100644
--- a/nixpkgs/pkgs/development/libraries/protobuf/3.24.nix
+++ b/nixpkgs/pkgs/development/libraries/protobuf/3.24.nix
@@ -1,6 +1,6 @@
 { callPackage, ... } @ args:
 
 callPackage ./generic-v3-cmake.nix ({
-  version = "3.24.2";
-  sha256 = "sha256-yVLszyVtsz1CCzeOkioL4O3mWTFKKVBUyOhwDbC5UqE=";
+  version = "3.24.3";
+  sha256 = "sha256-wXGQW/o674DeLXX2IlyZskl5OrBcSRptOMoJqLQGm94=";
 } // args)
diff --git a/nixpkgs/pkgs/development/libraries/protobuf/generic-v3-cmake.nix b/nixpkgs/pkgs/development/libraries/protobuf/generic-v3-cmake.nix
index 384d2d0decb4..5b5ab87bfcd5 100644
--- a/nixpkgs/pkgs/development/libraries/protobuf/generic-v3-cmake.nix
+++ b/nixpkgs/pkgs/development/libraries/protobuf/generic-v3-cmake.nix
@@ -13,53 +13,45 @@
 , version
 , sha256
 
-# downstream dependencies
+  # downstream dependencies
 , python3
+, grpc
 
 , ...
 }:
 
-let
-  self = stdenv.mkDerivation {
-    pname = "protobuf";
-    inherit version;
+stdenv.mkDerivation (finalAttrs: {
+  pname = "protobuf";
+  inherit version;
 
-    src = fetchFromGitHub {
-      owner = "protocolbuffers";
-      repo = "protobuf";
-      rev = "v${version}";
-      inherit sha256;
-    };
-
-    # re-create submodule logic
-    postPatch = ''
-      rm -rf gmock
-      cp -r ${gtest.src}/googlemock third_party/gmock
-      cp -r ${gtest.src}/googletest third_party/
-      chmod -R a+w third_party/
+  src = fetchFromGitHub {
+    owner = "protocolbuffers";
+    repo = "protobuf";
+    rev = "v${version}";
+    inherit sha256;
+  };
 
-      ln -s ../googletest third_party/gmock/gtest
-      ln -s ../gmock third_party/googletest/googlemock
-      ln -s $(pwd)/third_party/googletest third_party/googletest/googletest
-    '' + lib.optionalString stdenv.isDarwin ''
-      substituteInPlace src/google/protobuf/testing/googletest.cc \
-        --replace 'tmpnam(b)' '"'$TMPDIR'/foo"'
-    '';
+  postPatch = lib.optionalString stdenv.isDarwin ''
+    substituteInPlace src/google/protobuf/testing/googletest.cc \
+      --replace 'tmpnam(b)' '"'$TMPDIR'/foo"'
+  '';
 
-    patches = lib.optionals (lib.versionOlder version "3.22") [
-      # fix protobuf-targets.cmake installation paths, and allow for CMAKE_INSTALL_LIBDIR to be absolute
-      # https://github.com/protocolbuffers/protobuf/pull/10090
-      (fetchpatch {
-        url = "https://github.com/protocolbuffers/protobuf/commit/a7324f88e92bc16b57f3683403b6c993bf68070b.patch";
-        sha256 = "sha256-SmwaUjOjjZulg/wgNmR/F5b8rhYA2wkKAjHIOxjcQdQ=";
-      })
-    ] ++ lib.optionals stdenv.hostPlatform.isStatic [
-      ./static-executables-have-no-rpath.patch
-    ];
+  patches = lib.optionals (lib.versionOlder version "3.22") [
+    # fix protobuf-targets.cmake installation paths, and allow for CMAKE_INSTALL_LIBDIR to be absolute
+    # https://github.com/protocolbuffers/protobuf/pull/10090
+    (fetchpatch {
+      url = "https://github.com/protocolbuffers/protobuf/commit/a7324f88e92bc16b57f3683403b6c993bf68070b.patch";
+      sha256 = "sha256-SmwaUjOjjZulg/wgNmR/F5b8rhYA2wkKAjHIOxjcQdQ=";
+    })
+  ] ++ lib.optionals stdenv.hostPlatform.isStatic [
+    ./static-executables-have-no-rpath.patch
+  ];
 
-    nativeBuildInputs = let
+  nativeBuildInputs =
+    let
       protobufVersion = "${lib.versions.major version}_${lib.versions.minor version}";
-    in [
+    in
+    [
       cmake
     ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
       # protoc of the same version must be available for build. For non-cross builds, it's able to
@@ -67,52 +59,54 @@ let
       buildPackages."protobuf${protobufVersion}"
     ];
 
-    buildInputs = [
-      zlib
-    ];
+  buildInputs = [
+    gtest
+    zlib
+  ];
 
-    propagatedBuildInputs = [
-      abseil-cpp
-    ];
+  propagatedBuildInputs = [
+    abseil-cpp
+  ];
 
-    cmakeDir = if lib.versionOlder version "3.22" then "../cmake" else null;
-    cmakeFlags = [
-      "-Dprotobuf_ABSL_PROVIDER=package"
-    ] ++ lib.optionals (!stdenv.targetPlatform.isStatic) [
-      "-Dprotobuf_BUILD_SHARED_LIBS=ON"
-    ]
-    # Tests fail to build on 32-bit platforms; fixed in 3.22
-    # https://github.com/protocolbuffers/protobuf/issues/10418
-    ++ lib.optional
-      (stdenv.targetPlatform.is32bit && lib.versionOlder version "3.22")
-      "-Dprotobuf_BUILD_TESTS=OFF";
+  strictDeps = true;
 
-    # unfortunately the shared libraries have yet to been patched by nix, thus tests will fail
-    doCheck = false;
+  cmakeDir = if lib.versionOlder version "3.22" then "../cmake" else null;
+  cmakeFlags = [
+    "-Dprotobuf_USE_EXTERNAL_GTEST=ON"
+    "-Dprotobuf_ABSL_PROVIDER=package"
+  ] ++ lib.optionals (!stdenv.targetPlatform.isStatic) [
+    "-Dprotobuf_BUILD_SHARED_LIBS=ON"
+  ]
+  # Tests fail to build on 32-bit platforms; fixed in 3.22
+  # https://github.com/protocolbuffers/protobuf/issues/10418
+  ++ lib.optionals (stdenv.targetPlatform.is32bit && lib.versionOlder version "3.22") [
+    "-Dprotobuf_BUILD_TESTS=OFF"
+  ];
 
-    passthru = {
-      tests = {
-        pythonProtobuf = python3.pkgs.protobuf.override(_: {
-          protobuf = self;
-        });
-      };
+  doCheck = true;
 
-      inherit abseil-cpp;
+  passthru = {
+    tests = {
+      pythonProtobuf = python3.pkgs.protobuf.override (_: {
+        protobuf = finalAttrs.finalPackage;
+      });
+      inherit grpc;
     };
 
-    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 = lib.licenses.bsd3;
-      platforms = lib.platforms.unix;
-      homepage = "https://developers.google.com/protocol-buffers/";
-      maintainers = with lib.maintainers; [ jonringer ];
-      mainProgram = "protoc";
-    };
+    inherit abseil-cpp;
+  };
+
+  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 = lib.licenses.bsd3;
+    platforms = lib.platforms.all;
+    homepage = "https://protobuf.dev/";
+    maintainers = with lib.maintainers; [ jonringer ];
+    mainProgram = "protoc";
   };
-in
-  self
+})