Unverified Commit ebb4f038 authored by Vladimír Čunát's avatar Vladimír Čunát Committed by GitHub
Browse files

cppcodec, nitrokey-app: fix build failure with cmake 4 (#453359)

parents 04973822 c5c69173
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
  stdenv,
  fetchFromGitHub,
  cmake,
  fetchpatch,
}:

stdenv.mkDerivation (finalAttrs: {
@@ -16,6 +17,17 @@ stdenv.mkDerivation (finalAttrs: {
    hash = "sha256-k4EACtDOSkTXezTeFtVdM1EVJjvGga/IQSrvDzhyaXw=";
  };

  patches = [
    # CMake 2.8 is deprecated and is no longer supported by CMake > 4
    # https://github.com/NixOS/nixpkgs/issues/445447
    # Luckily, this has been fixed on master.
    (fetchpatch {
      name = "modernize-cmake.patch";
      url = "https://github.com/tplgy/cppcodec/commit/8019b8b580f8573c33c50372baec7039dfe5a8ce.patch";
      hash = "sha256-0MCx3nTsey4Qonx+lyexbcxut0qIHOJZbkJ9u23Zuv8=";
    })
  ];

  nativeBuildInputs = [ cmake ];

  meta = with lib; {
+11 −0
Original line number Diff line number Diff line
@@ -38,6 +38,17 @@ stdenv.mkDerivation rec {
    cppcodec
  ];

  # CMake 3.1 is deprecated and is no longer supported by CMake > 4
  # https://github.com/NixOS/nixpkgs/issues/445447
  postPatch = ''
    substituteInPlace CMakeLists.txt --replace-fail \
      "CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0 FATAL_ERROR)" \
      "cmake_minimum_required(VERSION 3.10  FATAL_ERROR)" \
    --replace-fail \
      "cmake_policy(SET CMP0043 OLD)" \
      "cmake_policy(SET CMP0043 NEW)"
  '';

  meta = with lib; {
    description = "Provides extra functionality for the Nitrokey Pro and Storage";
    mainProgram = "nitrokey-app";