about summary refs log tree commit diff
path: root/pkgs/by-name/cm/cmake/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/cm/cmake/package.nix')
-rw-r--r--pkgs/by-name/cm/cmake/package.nix35
1 files changed, 24 insertions, 11 deletions
diff --git a/pkgs/by-name/cm/cmake/package.nix b/pkgs/by-name/cm/cmake/package.nix
index ca0f1789a110..3b5caabec709 100644
--- a/pkgs/by-name/cm/cmake/package.nix
+++ b/pkgs/by-name/cm/cmake/package.nix
@@ -25,7 +25,7 @@
     isBootstrap
   else false)
 , useOpenSSL ? !isMinimalBuild
-, useSharedLibraries ? (!isMinimalBuild && !stdenv.isCygwin)
+, useSharedLibraries ? (!isMinimalBuild && !stdenv.hostPlatform.isCygwin)
 , uiToolkits ? [] # can contain "ncurses" and/or "qt5"
 , buildDocs ? !(isMinimalBuild || (uiToolkits == []))
 , darwin
@@ -48,11 +48,11 @@ stdenv.mkDerivation (finalAttrs: {
     + lib.optionalString isMinimalBuild "-minimal"
     + lib.optionalString cursesUI "-cursesUI"
     + lib.optionalString qt5UI "-qt5UI";
-  version = "3.29.6";
+  version = "3.30.5";
 
   src = fetchurl {
     url = "https://cmake.org/files/v${lib.versions.majorMinor finalAttrs.version}/cmake-${finalAttrs.version}.tar.gz";
-    hash = "sha256-E5ExMAO4PUjiqxFai1JaVX942MFURhi0jR2QGEoQ8K8=";
+    hash = "sha256-n1XhpAUI8vKbfgZfoIwp+CxAL6BALag5//5koldVqG0=";
   };
 
   patches = [
@@ -66,17 +66,22 @@ stdenv.mkDerivation (finalAttrs: {
     # Derived from https://github.com/libuv/libuv/commit/1a5d4f08238dd532c3718e210078de1186a5920d
     ./003-libuv-application-services.diff
   ]
-  ++ lib.optional stdenv.isCygwin ./004-cygwin.diff
+  ++ lib.optional stdenv.hostPlatform.isCygwin ./004-cygwin.diff
   # Derived from https://github.com/curl/curl/commit/31f631a142d855f069242f3e0c643beec25d1b51
-  ++ lib.optional (stdenv.isDarwin && isMinimalBuild) ./005-remove-systemconfiguration-dep.diff
+  ++ lib.optional (stdenv.hostPlatform.isDarwin && isMinimalBuild) ./005-remove-systemconfiguration-dep.diff
   # On Darwin, always set CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG.
-  ++ lib.optional stdenv.isDarwin ./006-darwin-always-set-runtime-c-flag.diff
+  ++ lib.optional stdenv.hostPlatform.isDarwin ./006-darwin-always-set-runtime-c-flag.diff
   # On platforms where ps is not part of stdenv, patch the invocation of ps to use an absolute path.
-  ++ lib.optional (stdenv.isDarwin || stdenv.isFreeBSD) (
+  ++ lib.optional (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isFreeBSD) (
     substituteAll {
       src = ./007-darwin-bsd-ps-abspath.diff;
       ps = lib.getExe ps;
-    });
+    })
+  ++ [
+    # Backport of https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9900
+    # Needed to corretly link curl in pkgsStatic.
+    ./008-FindCURL-Add-more-target-properties-from-pkg-config.diff
+  ];
 
   outputs = [ "out" ] ++ lib.optionals buildDocs [ "man" "info" ];
   separateDebugInfo = true;
@@ -108,8 +113,8 @@ stdenv.mkDerivation (finalAttrs: {
   ++ lib.optional useOpenSSL openssl
   ++ lib.optional cursesUI ncurses
   ++ lib.optional qt5UI qtbase
-  ++ lib.optional stdenv.isDarwin CoreServices
-  ++ lib.optional (stdenv.isDarwin && !isMinimalBuild) SystemConfiguration;
+  ++ lib.optional stdenv.hostPlatform.isDarwin CoreServices
+  ++ lib.optional (stdenv.hostPlatform.isDarwin && !isMinimalBuild) SystemConfiguration;
 
   preConfigure = ''
     fixCmakeFiles .
@@ -181,6 +186,14 @@ stdenv.mkDerivation (finalAttrs: {
     sed -i 's|bin/cmake|${buildPackages.cmakeMinimal}/bin/cmake|g' Makefile
   '';
 
+  # Undo some of `fixCmakeFiles` for Darwin to make sure that checks for libraries in the SDK find them
+  # (e.g., `find_library(MATH_LIBRARY m)` should find `$SDKROOT/usr/lib/libm.tbd`).
+  postFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
+    substituteInPlace "$out/share/cmake-${lib.versions.majorMinor finalAttrs.version}/Modules/Platform/Darwin.cmake" \
+       --replace-fail '/var/empty/include' '/usr/include' \
+       --replace-fail '/var/empty/lib' '/usr/lib'
+  '';
+
   dontUseCmakeConfigure = true;
   enableParallelBuilding = true;
 
@@ -207,6 +220,6 @@ stdenv.mkDerivation (finalAttrs: {
     maintainers = with lib.maintainers; [ ttuegel lnl7 AndersonTorres ];
     platforms = lib.platforms.all;
     mainProgram = "cmake";
-    broken = (qt5UI && stdenv.isDarwin);
+    broken = (qt5UI && stdenv.hostPlatform.isDarwin);
   };
 })