From e72b2beab026f1e9908cab53f2773a61256e4a72 Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Mon, 27 Apr 2020 18:23:44 -0400 Subject: [PATCH 1/5] vtk: unbreak on OS X --- pkgs/development/libraries/vtk/default.nix | 2 +- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/vtk/default.nix b/pkgs/development/libraries/vtk/default.nix index 6a7e26c753cd..1cc706f4eb73 100644 --- a/pkgs/development/libraries/vtk/default.nix +++ b/pkgs/development/libraries/vtk/default.nix @@ -57,7 +57,7 @@ stdenv.mkDerivation rec { ++ optional enablePython [ "-DVTK_WRAP_PYTHON:BOOL=ON" ]; postPatch = stdenv.lib.optionalString stdenv.isDarwin '' - sed -i 's|COMMAND vtkHashSource|COMMAND "DYLD_LIBRARY_PATH=''${VTK_BINARY_DIR}/lib" ''${VTK_BINARY_DIR}/bin/vtkHashSource-7.0|' ./Parallel/Core/CMakeLists.txt + sed -i 's|COMMAND vtkHashSource|COMMAND "DYLD_LIBRARY_PATH=''${VTK_BINARY_DIR}/lib" ''${VTK_BINARY_DIR}/bin/vtkHashSource-${majorVersion}|' ./Parallel/Core/CMakeLists.txt sed -i 's/fprintf(output, shift)/fprintf(output, "%s", shift)/' ./ThirdParty/libxml2/vtklibxml2/xmlschemas.c sed -i 's/fprintf(output, shift)/fprintf(output, "%s", shift)/g' ./ThirdParty/libxml2/vtklibxml2/xpath.c ''; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cfea73736d6e..f6782e376999 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14844,7 +14844,7 @@ in vte_290 = callPackage ../development/libraries/vte/2.90.nix { }; vtk = callPackage ../development/libraries/vtk { - stdenv = gcc8Stdenv; + stdenv = if stdenv.isDarwin then stdenv else gcc8Stdenv; inherit (darwin) libobjc; inherit (darwin.apple_sdk.libs) xpc; inherit (darwin.apple_sdk.frameworks) Cocoa CoreServices DiskArbitration From 404834334bbe8af992b8d39cf6d9d767f8cf463e Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Mon, 27 Apr 2020 13:28:48 -0400 Subject: [PATCH 2/5] itk: 5.0.1 -> 5.1.0 --- pkgs/development/libraries/itk/default.nix | 17 +++++++++++------ pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/pkgs/development/libraries/itk/default.nix b/pkgs/development/libraries/itk/default.nix index d745ff438cee..6c0298c0f71c 100644 --- a/pkgs/development/libraries/itk/default.nix +++ b/pkgs/development/libraries/itk/default.nix @@ -1,14 +1,15 @@ -{ stdenv, fetchFromGitHub, cmake, libX11, libuuid, xz, vtk, darwin }: +{ stdenv, fetchFromGitHub, cmake, makeWrapper +, pkgconfig, libX11, libuuid, xz, vtk, Cocoa }: stdenv.mkDerivation rec { pname = "itk"; - version = "5.0.1"; + version = "5.1.0"; src = fetchFromGitHub { owner = "InsightSoftwareConsortium"; repo = "ITK"; rev = "v${version}"; - sha256 = "0dcjsn5frjnrphfgw8alnd2ahrvicpx2a2ngb5ixaa9anaicz9z1"; + sha256 = "0rvkp00xj1js60021jv2ydyl74wvbyb205gm9d7hf8gy2q456hgl"; }; cmakeFlags = [ @@ -23,12 +24,16 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - nativeBuildInputs = [ cmake xz ]; - buildInputs = [ libX11 libuuid vtk ] ++ stdenv.lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ]; + nativeBuildInputs = [ cmake xz makeWrapper ]; + buildInputs = [ libX11 libuuid vtk ] ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa ]; + + postInstall = '' + wrapProgram "$out/bin/h5c++" --prefix PATH ":" "${pkgconfig}/bin" + ''; meta = { description = "Insight Segmentation and Registration Toolkit"; - homepage = "http://www.itk.org/"; + homepage = "https://www.itk.org/"; license = stdenv.lib.licenses.asl20; maintainers = with stdenv.lib.maintainers; [viric]; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f6782e376999..7bec4f99b53d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -12285,7 +12285,7 @@ in itk4 = callPackage ../development/libraries/itk/4.x.nix { stdenv = gcc8Stdenv; }; itk = callPackage ../development/libraries/itk { - stdenv = gcc8Stdenv; + inherit (darwin.apple_sdk.frameworks) Cocoa; }; jasper = callPackage ../development/libraries/jasper { }; From 20cf206a099ad7aa3ed02b0f39f53195223bf282 Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Mon, 27 Apr 2020 14:42:17 -0400 Subject: [PATCH 3/5] simpleitk: itk -> itk4 - simpleitk 1.2.4 is incompatible with ITK 5.1, so this can be reverted when 2.x is released. --- pkgs/development/libraries/simpleitk/default.nix | 4 ++-- pkgs/top-level/all-packages.nix | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/simpleitk/default.nix b/pkgs/development/libraries/simpleitk/default.nix index d6708b0dfed8..445a8bc5f21d 100644 --- a/pkgs/development/libraries/simpleitk/default.nix +++ b/pkgs/development/libraries/simpleitk/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, cmake, git, swig, lua, itk, tcl, tk }: +{ stdenv, fetchFromGitHub, cmake, git, swig, lua, itk4, tcl, tk }: stdenv.mkDerivation rec { pname = "simpleitk"; @@ -12,7 +12,7 @@ stdenv.mkDerivation rec { }; nativeBuildInputs = [ cmake git swig ]; - buildInputs = [ lua itk ]; + buildInputs = [ lua itk4 ]; cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" "-DCMAKE_CXX_FLAGS='-Wno-attributes'" ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7bec4f99b53d..58f7ecf4e7a4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14413,7 +14413,10 @@ in simp_le = callPackage ../tools/admin/simp_le { }; - simpleitk = callPackage ../development/libraries/simpleitk { lua = lua51Packages.lua; }; + simpleitk = callPackage ../development/libraries/simpleitk { + lua = lua51Packages.lua; + stdenv = gcc8Stdenv; + }; sfml = callPackage ../development/libraries/sfml { inherit (darwin.apple_sdk.frameworks) IOKit Foundation AppKit OpenAL; From 6f1430a8021274aa4ec4c7b52c3457e37574c094 Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Mon, 27 Apr 2020 15:03:38 -0400 Subject: [PATCH 4/5] ezminc: switch from itk5 to itk4 branch - itk5 branch currently lacks support for itk 5.1 --- pkgs/applications/science/biology/EZminc/default.nix | 10 +++++----- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/science/biology/EZminc/default.nix b/pkgs/applications/science/biology/EZminc/default.nix index 978615fa4592..7502a4ffd2ab 100644 --- a/pkgs/applications/science/biology/EZminc/default.nix +++ b/pkgs/applications/science/biology/EZminc/default.nix @@ -1,18 +1,18 @@ -{ stdenv, fetchFromGitHub, cmake, pkgconfig, libminc, bicpl, itk, fftwFloat, gsl }: +{ stdenv, fetchFromGitHub, cmake, pkgconfig, libminc, bicpl, itk4, fftwFloat, gsl }: stdenv.mkDerivation rec { pname = "EZminc"; - name = "${pname}-unstable-2019-07-25"; + name = "${pname}-unstable-2019-03-12"; src = fetchFromGitHub { owner = "BIC-MNI"; repo = pname; - rev = "9591edd5389a5bda2c1f606816c7cdb35c065adf"; - sha256 = "02k87qbpx0f48l2lbcjmlqx82py684z3sfi29va5icfg3hjd6j7b"; + rev = "5e3333ee356f914d34d66d33ea8df809c7f7fa51"; + sha256 = "0wy8cppf5xpgfqvgb3mqs1cjh81n6qzkk6zxv29wvng8nar9wsy4"; }; nativeBuildInputs = [ cmake pkgconfig ]; - buildInputs = [ itk libminc bicpl fftwFloat gsl ]; + buildInputs = [ itk4 libminc bicpl fftwFloat gsl ]; cmakeFlags = [ "-DLIBMINC_DIR=${libminc}/lib/" "-DEZMINC_BUILD_TOOLS=TRUE" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 58f7ecf4e7a4..32c7c926b324 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24322,7 +24322,7 @@ in est-sfs = callPackage ../applications/science/biology/est-sfs { }; - ezminc = callPackage ../applications/science/biology/EZminc { }; + ezminc = callPackage ../applications/science/biology/EZminc { stdenv = gcc8Stdenv; }; exonerate = callPackage ../applications/science/biology/exonerate { }; From 5caa76705bd839fb6733f64740dec95d7b2fefc5 Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Mon, 27 Apr 2020 15:04:43 -0400 Subject: [PATCH 5/5] elastix: update for ITK 5.1.0 - fetch patches to build elastix 5.0 with ITK 5.1 - update 'platforms': builds on Darwin, fails on aarch64 --- .../science/biology/elastix/default.nix | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/science/biology/elastix/default.nix b/pkgs/development/libraries/science/biology/elastix/default.nix index e5565aae29b1..4d98b12928f5 100644 --- a/pkgs/development/libraries/science/biology/elastix/default.nix +++ b/pkgs/development/libraries/science/biology/elastix/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, cmake, itk, python3 }: +{ stdenv, fetchFromGitHub, fetchpatch, cmake, itk, python3 }: stdenv.mkDerivation rec { pname = "elastix"; @@ -11,10 +11,24 @@ stdenv.mkDerivation rec { sha256 = "1zrl7rz4lwsx88b2shnl985f3a97lmp4ksbd437h9y0hfjq8l0lj"; }; + patches = [ + (fetchpatch { + name = "itk-5.1-compat.patch"; + url = "https://github.com/SuperElastix/elastix/commit/402e9a26f22f805b8f2db00c00e59f75fa1783ad.patch"; + sha256 = "1il6gc1lgy78i0w6gkkppr61nh6g0yjspbfk19hcz20778m5jhz9"; + }) + (fetchpatch { + name = "fix-osx-build.patch"; + url = "https://github.com/SuperElastix/elastix/commit/52e1dc3928046f9fbb85d4b2ecd0d5175fa9695d.patch"; + sha256 = "1hf7kgx1jv497pf0x5wj79sy1wncxcvhrkix9w086lcr8zwxvn9q"; + }) + ]; + + nativeBuildInputs = [ cmake python3 ]; buildInputs = [ itk ]; - doCheck = true; + doCheck = !stdenv.isDarwin; # usual dynamic linker issues preCheck = " export LD_LIBRARY_PATH=$(pwd)/bin @@ -24,7 +38,7 @@ stdenv.mkDerivation rec { homepage = "http://elastix.isi.uu.nl/"; description = "Image registration toolkit based on ITK"; maintainers = with maintainers; [ bcdarwin ]; - platforms = platforms.linux; + platforms = platforms.x86_64; # libitkpng linker issues with ITK 5.1 license = licenses.asl20; }; }