about summary refs log tree commit diff
path: root/pkgs/applications/graphics/rawtherapee/default.nix
blob: aa7c9c84ac1602fa0fb41d45b07084b516221513 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
{ lib
, stdenv
, fetchFromGitHub
, cmake
, pkg-config
, util-linux
, libselinux
, libsepol
, lerc
, libthai
, libdatrie
, libxkbcommon
, libepoxy
, libXtst
, wrapGAppsHook3
, makeWrapper
, pixman
, libpthreadstubs
, gtkmm3
, libXau
, libXdmcp
, lcms2
, libiptcdata
, fftw
, expat
, pcre2
, libsigcxx
, lensfun
, librsvg
, libcanberra-gtk3
, gtk-mac-integration
, exiv2
, libraw
  , libjxl
}:

stdenv.mkDerivation rec {
  pname = "rawtherapee";
  version = "5.11";

  src = fetchFromGitHub {
    owner = "Beep6581";
    repo = "RawTherapee";
    rev = version;
    hash = "sha256-jIAbguwF2aqRTk72ro5oHNTawA7biPSFC41YHgRR730=";
    # The developpers ask not to use the tarball from Github releases, see
    # https://www.rawtherapee.com/downloads/5.10/#news-relevant-to-package-maintainers
    forceFetchGit = true;
  };

  postPatch = ''
    echo "set(HG_VERSION ${version})" > ReleaseInfo.cmake
    substituteInPlace tools/osx/Info.plist.in rtgui/config.h.in \
      --replace "/Applications" "${placeholder "out"}/Applications"
  '';

  nativeBuildInputs = [
    cmake
    pkg-config
    wrapGAppsHook3
  ] ++ lib.optionals stdenv.isDarwin [
    makeWrapper
  ];

  buildInputs = [
    util-linux
    libselinux
    libsepol
    lerc
    libthai
    libdatrie
    libxkbcommon
    libepoxy
    libXtst
    pixman
    libpthreadstubs
    gtkmm3
    libXau
    libXdmcp
    lcms2
    libiptcdata
    fftw
    expat
    pcre2
    libsigcxx
    lensfun
    librsvg
    exiv2
    libraw
    libjxl
  ] ++ lib.optionals stdenv.isLinux [
    libcanberra-gtk3
  ] ++ lib.optionals stdenv.isDarwin [
    gtk-mac-integration
  ];

  cmakeFlags = [
    "-DPROC_TARGET_NUMBER=2"
    "-DCACHE_NAME_SUFFIX=\"\""
    "-DWITH_SYSTEM_LIBRAW=\"ON\""
    "-DWITH_JXL=\"ON\""
  ] ++ lib.optionals stdenv.isDarwin [
    "-DCMAKE_OSX_DEPLOYMENT_TARGET=${stdenv.hostPlatform.darwinMinVersion}"
  ];

  CMAKE_CXX_FLAGS = toString [
    "-std=c++11"
    "-Wno-deprecated-declarations"
    "-Wno-unused-result"
  ];
  env.CXXFLAGS = "-include cstdint"; # needed at least with gcc13 on aarch64-linux

  postInstall = lib.optionalString stdenv.isDarwin ''
    mkdir -p $out/Applications/RawTherapee.app $out/bin
    cp -R Release $out/Applications/RawTherapee.app/Contents
    for f in $out/Applications/RawTherapee.app/Contents/MacOS/*; do
      makeWrapper $f $out/bin/$(basename $f)
    done
  '';

  meta = {
    description = "RAW converter and digital photo processing software";
    homepage = "http://www.rawtherapee.com/";
    license = lib.licenses.gpl3Plus;
    maintainers = with lib.maintainers; [ jcumming mahe ];
    platforms = with lib.platforms; unix;
  };
}