1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchurl,
6 zlib,
7 libtiff,
8 libxml2,
9 openssl,
10 libiconv,
11 libpng,
12 cmake,
13}:
14
15stdenv.mkDerivation rec {
16 pname = "dcmtk";
17 version = "3.6.9";
18
19 src = fetchFromGitHub {
20 owner = "DCMTK";
21 repo = "dcmtk";
22 tag = "DCMTK-${version}";
23 hash = "sha256-mdI/YqM38WhnCbsylIlmqLLWC5/QR+a8Wn9CNcN7KXU=";
24 };
25
26 # The following patches are taken from the Debian package
27 # See https://salsa.debian.org/med-team/dcmtk
28 patches = [
29 (fetchurl {
30 url = "https://salsa.debian.org/med-team/dcmtk/-/raw/debian/3.6.9-4/debian/patches/01_dcmtk_3.6.0-1.patch";
31 hash = "sha256-kDEZvPqcF8+PYID24srMoPSBPltmnGiJ67LHsLVcPYM=";
32 })
33 (fetchurl {
34 url = "https://salsa.debian.org/med-team/dcmtk/-/raw/debian/3.6.9-4/debian/patches/07_dont_export_all_executables.patch";
35 hash = "sha256-5slFod+S7Yuj0u2CfTUw+MWZYuqQs4hgoGmh3KAUo+c=";
36 })
37 (fetchurl {
38 url = "https://salsa.debian.org/med-team/dcmtk/-/raw/debian/3.6.9-4/debian/patches/remove_version.patch";
39 hash = "sha256-jcV2xQzKdNiBgcaFtaxdJpJCCSVOqGIsi/A4iqVM8U8=";
40 })
41 (fetchurl {
42 url = "https://salsa.debian.org/med-team/dcmtk/-/raw/debian/3.6.9-4/debian/patches/0007-CVE-2024-47796.patch";
43 hash = "sha256-QYWgSbyIcOq3CVg2ynVSPCHBIrDj9uqX4ese1huoOoU=";
44 })
45 (fetchurl {
46 url = "https://salsa.debian.org/med-team/dcmtk/-/raw/debian/3.6.9-4/debian/patches/0008-CVE-2024-52333.patch";
47 hash = "sha256-/4NdauuH0v6CPMh+duMM91wWfylp6l4L2LTO80dDh9g=";
48 })
49 (fetchurl {
50 url = "https://salsa.debian.org/med-team/dcmtk/-/raw/debian/3.6.9-4/debian/patches/0009-CVE-2025-25475.patch";
51 hash = "sha256-ApuVw6aBoasuVlJ3fh/aufB2WRm2hFgLYCq1k3MPrsU=";
52 })
53 (fetchurl {
54 url = "https://salsa.debian.org/med-team/dcmtk/-/raw/debian/3.6.9-4/debian/patches/0010-CVE-2025-25474.patch";
55 hash = "sha256-aX8em1o88ND4srsYkG696elPsAIlvkRRZMT8wzD2GdQ=";
56 })
57 (fetchurl {
58 url = "https://salsa.debian.org/med-team/dcmtk/-/raw/debian/3.6.9-4/debian/patches/0011-CVE-2025-25472.patch";
59 hash = "sha256-o3/PykJFbYlasAFgPNWp09hRuH183tQuvGuaOV4MOoo=";
60 })
61 ];
62
63 nativeBuildInputs = [ cmake ];
64 buildInputs = [
65 libpng
66 zlib
67 libtiff
68 libxml2
69 openssl
70 libiconv
71 ];
72
73 cmakeFlags = [
74 (lib.cmakeFeature "CMAKE_CXX_STANDARD" "17")
75 (lib.cmakeBool "CMAKE_SKIP_RPATH" true)
76 "-DCMAKE_VERBOSE_MAKEFILE=ON"
77 (lib.cmakeBool "DCMTK_ENABLE_PRIVATE_TAGS" true)
78 (lib.cmakeBool "DCMTK_ENABLE_STL" true)
79 (lib.cmakeBool "DCMTK_WITH_ICONV" true)
80 (lib.cmakeBool "DCMTK_WITH_ICU" true)
81 (lib.cmakeBool "DCMTK_WITH_OPENSSL" true)
82 (lib.cmakeBool "DCMTK_WITH_TIFF" true)
83 (lib.cmakeBool "DCMTK_WITH_XML" true)
84 (lib.cmakeBool "DCMTK_WITH_ZLIB" true)
85 (lib.cmakeBool "USE_COMPILER_HIDDEN_VISIBILITY" true)
86 (lib.cmakeBool "BUILD_TESTING" false)
87 ];
88
89 doCheck = true;
90
91 meta = {
92 description = "Collection of libraries and applications implementing large parts of the DICOM standard";
93 longDescription = ''
94 DCMTK is a collection of libraries and applications implementing large parts of the DICOM standard.
95 It includes software for examining, constructing and converting DICOM image files, handling offline media,
96 sending and receiving images over a network connection, as well as demonstrative image storage and worklist servers.
97 DCMTK is is written in a mixture of ANSI C and C++.
98 It comes in complete source code and is made available as "open source" software.
99 '';
100 homepage = "https://dicom.offis.de/dcmtk";
101 license = lib.licenses.bsd3;
102 maintainers = with lib.maintainers; [ iimog ];
103 platforms = with lib.platforms; linux ++ darwin;
104 };
105}