dcm2niix: support usage of suggested Cloudflare zlib
This commit is contained in:
parent
9019ce0106
commit
d1c3fea7ec
@ -1,17 +1,26 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, substituteAll
|
||||
, cmake
|
||||
, git
|
||||
, openjpeg
|
||||
, libyamlcpp
|
||||
, zlib
|
||||
, batchVersion ? false
|
||||
, withJpegLs ? true
|
||||
, withOpenJpeg ? true
|
||||
, withSystemZlib ? true
|
||||
, withCloudflareZlib ? true
|
||||
}:
|
||||
|
||||
let
|
||||
cloudflareZlib = fetchFromGitHub {
|
||||
owner = "ningfei";
|
||||
repo = "zlib";
|
||||
# HEAD revision of the gcc.amd64 branch on 2022-04-14. Reminder to update
|
||||
# whenever bumping package version.
|
||||
rev = "fda61188d1d4dcd21545c34c2a2f5cc9b0f5db4b";
|
||||
sha256 = "sha256-qySFwY0VI2BQLO2XoCZeYshXEDnHh6SmJ3MvcBUROWU=";
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
version = "1.0.20211006";
|
||||
pname = "dcm2niix";
|
||||
@ -23,22 +32,28 @@ stdenv.mkDerivation rec {
|
||||
sha256 = "sha256-fQAVOzynMdSLDfhcYWcaXkFW/mnv4zySGLVJNE7ql/c=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ cmake git ];
|
||||
patches = lib.optionals withCloudflareZlib [
|
||||
(substituteAll {
|
||||
src = ./dont-fetch-external-libs.patch;
|
||||
inherit cloudflareZlib;
|
||||
})
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = lib.optionals batchVersion [ libyamlcpp ]
|
||||
++ lib.optionals withOpenJpeg [ openjpeg openjpeg.dev ]
|
||||
++ lib.optionals withSystemZlib [ zlib ];
|
||||
++ lib.optionals withOpenJpeg [ openjpeg openjpeg.dev ];
|
||||
|
||||
cmakeFlags = lib.optionals batchVersion [
|
||||
"-DBATCH_VERSION=ON"
|
||||
"-DYAML-CPP_DIR=${libyamlcpp}/lib/cmake/yaml-cpp"
|
||||
] ++ lib.optionals withJpegLs [
|
||||
"-DUSE_JPEGLS=ON"
|
||||
] ++ lib.optionals withOpenJpeg [
|
||||
"-DUSE_OPENJPEG=ON"
|
||||
"-DOpenJPEG_DIR=${openjpeg}/lib/${openjpeg.pname}-${lib.versions.majorMinor openjpeg.version}"
|
||||
] ++ lib.optionals withSystemZlib [
|
||||
"-DZLIB_IMPLEMENTATION=System"
|
||||
];
|
||||
"-DBATCH_VERSION=ON"
|
||||
"-DYAML-CPP_DIR=${libyamlcpp}/lib/cmake/yaml-cpp"
|
||||
] ++ lib.optionals withJpegLs [
|
||||
"-DUSE_JPEGLS=ON"
|
||||
] ++ lib.optionals withOpenJpeg [
|
||||
"-DUSE_OPENJPEG=ON"
|
||||
"-DOpenJPEG_DIR=${openjpeg}/lib/${openjpeg.pname}-${lib.versions.majorMinor openjpeg.version}"
|
||||
] ++ lib.optionals withCloudflareZlib [
|
||||
"-DZLIB_IMPLEMENTATION=Cloudflare"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
description = "DICOM to NIfTI converter";
|
||||
|
@ -0,0 +1,36 @@
|
||||
diff --git a/SuperBuild/External-CLOUDFLARE-ZLIB.cmake b/SuperBuild/External-CLOUDFLARE-ZLIB.cmake
|
||||
index 9f064eb..fe74df5 100644
|
||||
--- a/SuperBuild/External-CLOUDFLARE-ZLIB.cmake
|
||||
+++ b/SuperBuild/External-CLOUDFLARE-ZLIB.cmake
|
||||
@@ -1,8 +1,5 @@
|
||||
-set(CLOUDFLARE_BRANCH gcc.amd64) # Cloudflare zlib branch
|
||||
-
|
||||
ExternalProject_Add(zlib
|
||||
- GIT_REPOSITORY "${git_protocol}://github.com/ningfei/zlib.git"
|
||||
- GIT_TAG "${CLOUDFLARE_BRANCH}"
|
||||
+ URL file://@cloudflareZlib@
|
||||
SOURCE_DIR cloudflare-zlib
|
||||
BINARY_DIR cloudflare-zlib-build
|
||||
CMAKE_ARGS
|
||||
diff --git a/SuperBuild/SuperBuild.cmake b/SuperBuild/SuperBuild.cmake
|
||||
index 2a0a956..81354a7 100644
|
||||
--- a/SuperBuild/SuperBuild.cmake
|
||||
+++ b/SuperBuild/SuperBuild.cmake
|
||||
@@ -1,17 +1,3 @@
|
||||
-# Check if git exists
|
||||
-find_package(Git)
|
||||
-if(NOT GIT_FOUND)
|
||||
- message(FATAL_ERROR "Cannot find Git. Git is required for Superbuild")
|
||||
-endif()
|
||||
-
|
||||
-# Use git protocol or not
|
||||
-option(USE_GIT_PROTOCOL "If behind a firewall turn this off to use http instead." ON)
|
||||
-if(USE_GIT_PROTOCOL)
|
||||
- set(git_protocol "git")
|
||||
-else()
|
||||
- set(git_protocol "https")
|
||||
-endif()
|
||||
-
|
||||
# Basic CMake build settings
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
|
Loading…
Reference in New Issue
Block a user