nixos/java: No bashisms in `environment.shellInit` script (#294121)
[NixPkgs.git] / pkgs / applications / graphics / krita / generic.nix
blobb781bedd084fea1a3db9b7c6deb2e7cf2e6be1f8
1 { mkDerivation, lib, stdenv, fetchpatch, fetchurl, cmake, extra-cmake-modules
2 , karchive, kconfig, kwidgetsaddons, kcompletion, kcoreaddons
3 , kguiaddons, ki18n, kitemmodels, kitemviews, kwindowsystem
4 , kio, kcrash, breeze-icons
5 , boost, libraw, fftw, eigen, exiv2, fribidi, libaom, libheif, libkdcraw, lcms2, gsl, openexr, giflib
6 , libjxl, mlt , openjpeg, opencolorio, xsimd, poppler, curl, ilmbase, immer, kseexpr, lager
7 , libmypaint , libunibreak, libwebp
8 , qtmultimedia, qtx11extras, quazip, SDL2, zug, pkg-config
9 , python3Packages
10 , version
11 , kde-channel
12 , hash
15 mkDerivation rec {
16   pname = "krita-unwrapped";
17   inherit version;
19   src = fetchurl {
20     url = "mirror://kde/${kde-channel}/krita/${version}/krita-${version}.tar.gz";
21     inherit hash;
22   };
24   patches = [
25     # Fixes build with SIP 6.8
26     (fetchpatch {
27       name = "bump-SIP-ABI-version-to-12.8.patch";
28       url = "https://invent.kde.org/graphics/krita/-/commit/2d71c47661d43a4e3c1ab0c27803de980bdf2bb2.diff";
29       hash = "sha256-U3E44nj4vra++PJV20h4YHjES78kgrJtr4ktNeQfOdA=";
30     })
31   ];
33   nativeBuildInputs = [ cmake extra-cmake-modules pkg-config python3Packages.sip ];
35   buildInputs = [
36     karchive kconfig kwidgetsaddons kcompletion kcoreaddons kguiaddons
37     ki18n kitemmodels kitemviews kwindowsystem kio kcrash breeze-icons
38     boost libraw fftw eigen exiv2 fribidi lcms2 gsl openexr lager libaom libheif libkdcraw giflib
39     libjxl mlt openjpeg opencolorio xsimd poppler curl ilmbase immer kseexpr libmypaint
40     libunibreak libwebp qtmultimedia qtx11extras quazip SDL2 zug
41     python3Packages.pyqt5
42   ];
44   env.NIX_CFLAGS_COMPILE = toString ([ "-I${ilmbase.dev}/include/OpenEXR" ]
45     ++ lib.optional stdenv.cc.isGNU "-Wno-deprecated-copy");
47   # Krita runs custom python scripts in CMake with custom PYTHONPATH which krita determined in their CMake script.
48   # Patch the PYTHONPATH so python scripts can import sip successfully.
49   postPatch = let
50     pythonPath = python3Packages.makePythonPath (with python3Packages; [ sip setuptools ]);
51   in ''
52     substituteInPlace cmake/modules/FindSIP.cmake \
53       --replace 'PYTHONPATH=''${_sip_python_path}' 'PYTHONPATH=${pythonPath}'
54     substituteInPlace cmake/modules/SIPMacros.cmake \
55       --replace 'PYTHONPATH=''${_krita_python_path}' 'PYTHONPATH=${pythonPath}'
57     substituteInPlace plugins/impex/jp2/jp2_converter.cc \
58       --replace '<openjpeg.h>' '<${openjpeg.incDir}/openjpeg.h>'
59   '';
61   cmakeBuildType = "RelWithDebInfo";
63   cmakeFlags = [
64     "-DPYQT5_SIP_DIR=${python3Packages.pyqt5}/${python3Packages.python.sitePackages}/PyQt5/bindings"
65     "-DPYQT_SIP_DIR_OVERRIDE=${python3Packages.pyqt5}/${python3Packages.python.sitePackages}/PyQt5/bindings"
66     "-DBUILD_KRITA_QT_DESIGNER_PLUGINS=ON"
67   ];
69   meta = with lib; {
70     description = "Free and open source painting application";
71     homepage = "https://krita.org/";
72     maintainers = with maintainers; [ abbradar sifmelcara nek0 ];
73     mainProgram = "krita";
74     platforms = platforms.linux;
75     license = licenses.gpl3Only;
76   };