1{ lib
2, stdenv
3, fetchFromGitHub
4, fetchpatch
5, uthash
6, meson
7, ninja
8, pkg-config
9, check
10}:
11
12stdenv.mkDerivation (finalAttrs: {
13 pname = "libdicom";
14 version = "1.0.5";
15
16 src = fetchFromGitHub {
17 owner = "ImagingDataCommons";
18 repo = "libdicom";
19 rev = "v${finalAttrs.version}";
20 sha256 = "sha256-9n0Gp9+fmTM/shgWC8zpwt1pic9BrvDubOt7f+ZDMeE=";
21 };
22
23 patches = [
24 (fetchpatch {
25 name = "CVE-2024-24793.CVE-2024-24794.patch";
26 url = "https://github.com/ImagingDataCommons/libdicom/commit/3661aa4cdbe9c39f67d38ae87520f9e3ed50ab16.patch";
27 excludes = [ "CHANGELOG.md" ];
28 hash = "sha256-/KTp0nKYk6jX4phNHY+nzjEptUBHKM2JkOftS5vHsEw=";
29 })
30 ];
31
32 buildInputs = [ uthash ];
33
34 nativeBuildInputs = [ meson ninja pkg-config ]
35 ++ lib.optionals (finalAttrs.finalPackage.doCheck) [ check ];
36
37 mesonBuildType = "release";
38
39 mesonFlags = lib.optionals (!finalAttrs.finalPackage.doCheck) [ "-Dtests=false" ];
40
41 doCheck = true;
42
43 meta = with lib; {
44 description = "C library for reading DICOM files";
45 homepage = "https://github.com/ImagingDataCommons/libdicom";
46 license = licenses.mit;
47 maintainers = with maintainers; [ lromor ];
48 platforms = platforms.unix;
49 };
50})