cmtk: fix build with cmake 4#488619
Conversation
EXPORT_LIBRARY_DEPENDENCIES was removed in cmake 4 (CMP0033). Remove the call and related install command since cmtk is a standalone tool that is not consumed as a cmake dependency. Also set CMAKE_POLICY_VERSION_MINIMUM=3.5 to handle cmake_minimum_required(VERSION 2.8.12) in upstream CMakeLists.txt. Fixes: NixOS#445447 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ebdf0b2 to
99d2430
Compare
|
Addressed the wrapper issue reported in review. Follow-up commit: Verification:
|
|
|
||
| cmakeFlags = [ | ||
| (lib.cmakeFeature "CMAKE_CXX_STANDARD" "14") | ||
| # Upstream is abandoned (last release 2016) and uses cmake features |
There was a problem hiding this comment.
It seems there is a new release for 3.4.0 dated from 2024. The archive format is a bit weird, but one that solved it still does not compile successfully.
If you want to give it a shot:
diff --git a/pkgs/by-name/cm/cmtk/package.nix b/pkgs/by-name/cm/cmtk/package.nix
index e08d6c1ae33f..7151664c7949 100644
--- a/pkgs/by-name/cm/cmtk/package.nix
+++ b/pkgs/by-name/cm/cmtk/package.nix
@@ -11,19 +11,17 @@
stdenv.mkDerivation (finalAttrs: {
pname = "cmtk";
- version = "3.3.2";
+ version = "3.4.0";
src = fetchurl {
name = "cmtk-source.tar.gz";
- url = "https://www.nitrc.org/frs/download.php/13188/CMTK-${finalAttrs.version}-Source.tar.gz//?i_agree=1&download_now=1";
- hash = "sha256-iE164NCOSOypZLLZfZy9RTyrS+YnY9ECqfb4QhlsMS4=";
+ url = "https://www.nitrc.org/frs/download.php/15655/CMTK-${finalAttrs.version}-Source.tar.gz//?i_agree=1&download_now=1";
+ hash = "sha256-FOBfFtv3XmGLeet/wT6phf/I4VjP2aY3Smya8z/MM24=";
};
- postPatch = ''
- substituteInPlace apps/vtkxform.cxx --replace-fail \
- "float xyzFloat[3] = { xyz[0], xyz[1], xyz[2] };" \
- "float xyzFloat[3] = { (float)xyz[0], (float)xyz[1], (float)xyz[2] };"
+ sourceRoot = "usr/local";
+ postPatch = ''
# EXPORT_LIBRARY_DEPENDENCIES was removed in cmake 4 (CMP0033).
# Remove the call and related install since cmtk is a standalone tool.
# https://github.com/NixOS/nixpkgs/issues/445447
Sigmanificient
left a comment
There was a problem hiding this comment.
Yeah it "works"... I do not particularly like the current state of that program tbh. It has been broken for a while now, has no maintainer and is accumulating patches just to get built.
I'm honestly thinking this package may not be worth the time investment, because of the poor maintenance of the upstream source 😅
|
Thanks for this PR! But I agree with Sigmanificient: I don't think this package should be kept. (Indeed, the fact that no one has complained that the package is broken implies to me that no one is using this package. I don't think it's a good use of resources to maintain userless packages!) Filed #506861 |
Summary
EXPORT_LIBRARY_DEPENDENCIEScall (removed in cmake 4, CMP0033) and its related install command. cmtk is a standalone tool, not consumed as a cmake dependency by other packages.CMAKE_POLICY_VERSION_MINIMUM=3.5to handlecmake_minimum_required(VERSION 2.8.12)in upstream CMakeLists.txtThis is a simpler alternative to draft PR #455098 which used a 267-line patch to modernize the export system. Since cmtk upstream is abandoned (last release 2016), removing the unused export is more appropriate than modernizing it.
Port of #445447
Test plan
nix-build -A cmtksucceedscmtk registration --helpworksnixfmtpasses🤖 Generated with Claude Code