Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 224 lines 5.3 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchurl, 5 replaceVars, 6 autoreconfHook, 7 pkg-config, 8 intltool, 9 babl, 10 gegl, 11 gtk2, 12 glib, 13 gdk-pixbuf, 14 isocodes, 15 pango, 16 cairo, 17 freetype, 18 fontconfig, 19 lcms, 20 libpng, 21 libjpeg, 22 libjxl, 23 poppler, 24 poppler_data, 25 libtiff, 26 libmng, 27 librsvg, 28 libwmf, 29 zlib, 30 libzip, 31 ghostscript, 32 aalib, 33 shared-mime-info, 34 libexif, 35 gettext, 36 makeWrapper, 37 gtk-doc, 38 xorg, 39 glib-networking, 40 libmypaint, 41 gexiv2, 42 harfbuzz, 43 mypaint-brushes1, 44 libwebp, 45 libheif, 46 libxslt, 47 libgudev, 48 openexr, 49 desktopToDarwinBundle, 50 gtk-mac-integration-gtk2, 51 withPython ? false, 52 python2, 53}: 54 55let 56 python = python2.withPackages (pp: [ pp.pygtk ]); 57in 58stdenv.mkDerivation (finalAttrs: { 59 pname = "gimp"; 60 version = "2.10.38"; 61 62 outputs = [ 63 "out" 64 "dev" 65 ]; 66 67 src = fetchurl { 68 url = "http://download.gimp.org/pub/gimp/v${lib.versions.majorMinor finalAttrs.version}/gimp-${finalAttrs.version}.tar.bz2"; 69 sha256 = "sha256-UKhF7sEciDH+hmFweVD1uERuNfMO37ms+Y+FwRM/hW4="; 70 }; 71 72 patches = [ 73 # to remove compiler from the runtime closure, reference was retained via 74 # gimp --version --verbose output 75 (replaceVars ./remove-cc-reference.patch { 76 cc_version = stdenv.cc.cc.name; 77 }) 78 79 # Use absolute paths instead of relying on PATH 80 # to make sure plug-ins are loaded by the correct interpreter. 81 ./hardcode-plugin-interpreters.patch 82 83 # GIMP queries libheif.pc for builtin encoder/decoder support to determine if AVIF/HEIC files are supported 84 # (see https://gitlab.gnome.org/GNOME/gimp/-/blob/a8b1173ca441283971ee48f4778e2ffd1cca7284/configure.ac?page=2#L1846-1852) 85 # These variables have been removed since libheif 1.18.0 86 # (see https://github.com/strukturag/libheif/commit/cf0d89c6e0809427427583290547a7757428cf5a) 87 # This has already been fixed for the upcoming GIMP 3, but the fix has not been backported to 2.x yet 88 # (see https://gitlab.gnome.org/GNOME/gimp/-/issues/9080) 89 ./force-enable-libheif.patch 90 ]; 91 92 # error: possibly undefined macro: AM_NLS 93 preAutoreconf = '' 94 cp ${gettext}/share/gettext/m4/nls.m4 m4macros 95 ''; 96 97 nativeBuildInputs = [ 98 autoreconfHook # hardcode-plugin-interpreters.patch changes Makefile.am 99 pkg-config 100 intltool 101 gettext 102 makeWrapper 103 gtk-doc 104 libxslt 105 ] 106 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 107 desktopToDarwinBundle 108 ]; 109 110 buildInputs = [ 111 babl 112 gegl 113 gtk2 114 glib 115 gdk-pixbuf 116 pango 117 cairo 118 gexiv2 119 harfbuzz 120 isocodes 121 freetype 122 fontconfig 123 lcms 124 libpng 125 libjpeg 126 libjxl 127 poppler 128 poppler_data 129 libtiff 130 openexr 131 libmng 132 librsvg 133 libwmf 134 zlib 135 libzip 136 ghostscript 137 aalib 138 shared-mime-info 139 libwebp 140 libheif 141 libexif 142 xorg.libXpm 143 glib-networking 144 libmypaint 145 mypaint-brushes1 146 ] 147 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 148 gtk-mac-integration-gtk2 149 ] 150 ++ lib.optionals stdenv.hostPlatform.isLinux [ 151 libgudev 152 ] 153 ++ lib.optionals withPython [ 154 python 155 # Duplicated here because python.withPackages does not expose the dev output with pkg-config files 156 python2.pkgs.pygtk 157 ]; 158 159 # needed by gimp-2.0.pc 160 propagatedBuildInputs = [ 161 gegl 162 ]; 163 164 configureFlags = [ 165 "--without-webkit" # old version is required 166 "--disable-check-update" 167 "--with-bug-report-url=https://github.com/NixOS/nixpkgs/issues/new" 168 "--with-icc-directory=/run/current-system/sw/share/color/icc" 169 # fix libdir in pc files (${exec_prefix} needs to be passed verbatim) 170 "--libdir=\${exec_prefix}/lib" 171 ] 172 ++ lib.optionals (!withPython) [ 173 "--disable-python" # depends on Python2 which was EOLed on 2020-01-01 174 ]; 175 176 enableParallelBuilding = true; 177 178 doCheck = true; 179 180 env = { 181 NIX_CFLAGS_COMPILE = toString ( 182 [ ] 183 ++ lib.optionals stdenv.cc.isGNU [ "-Wno-error=incompatible-pointer-types" ] 184 ++ lib.optionals stdenv.hostPlatform.isDarwin [ "-DGDK_OSX_BIG_SUR=16" ] 185 ); 186 187 # Check if librsvg was built with --disable-pixbuf-loader. 188 PKG_CONFIG_GDK_PIXBUF_2_0_GDK_PIXBUF_MODULEDIR = "${librsvg}/${gdk-pixbuf.moduleDir}"; 189 }; 190 191 preConfigure = '' 192 # The check runs before glib-networking is registered 193 export GIO_EXTRA_MODULES="${glib-networking}/lib/gio/modules:$GIO_EXTRA_MODULES" 194 ''; 195 196 postFixup = '' 197 wrapProgram $out/bin/gimp-${lib.versions.majorMinor finalAttrs.version} \ 198 --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" 199 ''; 200 201 passthru = { 202 # The declarations for `gimp-with-plugins` wrapper, 203 # used for determining plug-in installation paths 204 majorVersion = "${lib.versions.major finalAttrs.version}.0"; 205 targetLibDir = "lib/gimp/${finalAttrs.passthru.majorVersion}"; 206 targetDataDir = "share/gimp/${finalAttrs.passthru.majorVersion}"; 207 targetPluginDir = "${finalAttrs.passthru.targetLibDir}/plug-ins"; 208 targetScriptDir = "${finalAttrs.passthru.targetDataDir}/scripts"; 209 210 # probably its a good idea to use the same gtk in plugins ? 211 gtk = gtk2; 212 213 python2Support = withPython; 214 }; 215 216 meta = with lib; { 217 description = "GNU Image Manipulation Program"; 218 homepage = "https://www.gimp.org/"; 219 maintainers = with maintainers; [ ]; 220 license = licenses.gpl3Plus; 221 platforms = platforms.unix; 222 mainProgram = "gimp"; 223 }; 224})