about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorMario Rodas <marsam@users.noreply.github.com>2023-11-21 08:33:54 -0500
committerGitHub <noreply@github.com>2023-11-21 08:33:54 -0500
commitdba8a3ef926b7528d025fc1234e61074d97f2dac (patch)
tree6839d879b0be848a77b4c45a8f98421ae473de3a /pkgs
parentb56dc6becd4b0d50714eec0bd69a8050f98f5362 (diff)
parentdc16ee70143744bd35e5ac7dba03bb729f19e5bd (diff)
Merge pull request #265927 from bcdarwin/itk-unvendor
itk: unvendor some of the dependencies
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/libraries/gdcm/default.nix2
-rw-r--r--pkgs/development/libraries/itk/generic.nix43
2 files changed, 34 insertions, 11 deletions
diff --git a/pkgs/development/libraries/gdcm/default.nix b/pkgs/development/libraries/gdcm/default.nix
index 3298be5cc3cc3..2a4fdaca27254 100644
--- a/pkgs/development/libraries/gdcm/default.nix
+++ b/pkgs/development/libraries/gdcm/default.nix
@@ -76,6 +76,8 @@ stdenv.mkDerivation rec {
     "TestSCUValidation"
     # errors because 3 classes not wrapped:
     "TestWrapPython"
+  ] ++ lib.optionals (stdenv.isAarch64 && stdenv.isLinux) [
+    "TestRescaler2"
   ];
 
   checkPhase = ''
diff --git a/pkgs/development/libraries/itk/generic.nix b/pkgs/development/libraries/itk/generic.nix
index 3a6b2afee0d95..e2db993707e21 100644
--- a/pkgs/development/libraries/itk/generic.nix
+++ b/pkgs/development/libraries/itk/generic.nix
@@ -1,7 +1,8 @@
 { version, rev, sourceSha256 }:
 
-{ lib, stdenv, fetchFromGitHub, cmake, makeWrapper
-, pkg-config, libX11, libuuid, xz, vtk, Cocoa }:
+{ lib, stdenv, fetchFromGitHub, cmake
+, expat, fftw, gdcm, hdf5-cpp, libjpeg, libminc, libtiff, libpng
+, libX11, libuuid, xz, vtk, zlib, Cocoa }:
 
 let
   itkGenericLabelInterpolatorSrc = fetchFromGitHub {
@@ -41,8 +42,6 @@ stdenv.mkDerivation {
     substituteInPlace CMake/ITKSetStandardCompilerFlags.cmake  \
       --replace "-march=corei7" ""  \
       --replace "-mtune=native" ""
-    substituteInPlace Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmopenjpeg/src/lib/openjp2/libopenjp2.pc.cmake.in  \
-      --replace "@OPENJPEG_INSTALL_LIB_DIR@" "@OPENJPEG_INSTALL_FULL_LIB_DIR@"
     ln -sr ${itkGenericLabelInterpolatorSrc} Modules/External/ITKGenericLabelInterpolator
     ln -sr ${itkAdaptiveDenoisingSrc} Modules/External/ITKAdaptiveDenoising
     ln -sr ${itkSimpleITKFiltersSrc} Modules/External/ITKSimpleITKFilters
@@ -52,6 +51,15 @@ stdenv.mkDerivation {
     "-DBUILD_EXAMPLES=OFF"
     "-DBUILD_SHARED_LIBS=ON"
     "-DITK_FORBID_DOWNLOADS=ON"
+    "-DITK_USE_SYSTEM_LIBRARIES=ON"  # finds common libraries e.g. hdf5, libpng, libtiff, zlib, but not GDCM, NIFTI, MINC, etc.
+    # note ITK_USE_SYSTEM_EIGEN, part of ITK_USE_SYSTEM_LIBRARIES,
+    # causes "...-itk-5.2.1/include/ITK-5.2/itkSymmetricEigenAnalysis.h:23:31: fatal error: Eigen/Eigenvalues: No such file or directory"
+    # when compiling c3d, but maybe an ITK 5.2/eigen version issue:
+    "-DITK_USE_SYSTEM_EIGEN=OFF"
+    "-DITK_USE_SYSTEM_GOOGLETEST=OFF"  # ANTs build failure due to https://github.com/ANTsX/ANTs/issues/1489
+    "-DITK_USE_SYSTEM_GDCM=ON"
+    "-DITK_USE_SYSTEM_MINC=ON"
+    "-DLIBMINC_DIR=${libminc}/lib/cmake"
     "-DModule_ITKMINC=ON"
     "-DModule_ITKIOMINC=ON"
     "-DModule_ITKIOTransformMINC=ON"
@@ -63,8 +71,12 @@ stdenv.mkDerivation {
     "-DModule_GenericLabelInterpolator=ON"
   ];
 
-  nativeBuildInputs = [ cmake xz makeWrapper ];
-  buildInputs = [ libX11 libuuid vtk ] ++ lib.optionals stdenv.isDarwin [ Cocoa ];
+  nativeBuildInputs = [ cmake xz ];
+  buildInputs = [
+    libX11
+    libuuid
+    vtk
+  ] ++ lib.optionals stdenv.isDarwin [ Cocoa ];
   # Due to ITKVtkGlue=ON and the additional dependencies needed to configure VTK 9
   # (specifically libGL and libX11 on Linux),
   # it's now seemingly necessary for packages that configure ITK to
@@ -72,11 +84,20 @@ stdenv.mkDerivation {
   # These deps were propagated from VTK 9 in https://github.com/NixOS/nixpkgs/pull/206935,
   # so we simply propagate them again from ITK.
   # This admittedly is a hack and seems like an issue with VTK 9's CMake configuration.
-  propagatedBuildInputs = vtk.propagatedBuildInputs;
-
-  postInstall = ''
-    wrapProgram "$out/bin/h5c++" --prefix PATH ":" "${pkg-config}/bin"
-  '';
+  propagatedBuildInputs = [
+    # The dependencies we've un-vendored from ITK, such as GDCM, must be propagated,
+    # otherwise other software built against ITK fails to configure since ITK headers
+    # refer to these previously vendored libraries:
+    expat
+    fftw
+    gdcm
+    hdf5-cpp
+    libjpeg
+    libminc
+    libpng
+    libtiff
+    zlib
+  ] ++ vtk.propagatedBuildInputs;
 
   meta = {
     description = "Insight Segmentation and Registration Toolkit";