@@ -1,12 +1,14 @@
{
stdenv ,
lib ,
fetchFromGitLab ,
fetchurl ,
fetchpatch ,
replaceVars ,
meson ,
ninja ,
pkg-config ,
babl ,
cfitsio ,
gegl ,
gtk3 ,
glib ,
@@ -21,6 +23,8 @@
fontconfig ,
lcms ,
libpng ,
libiff ,
libilbm ,
libjpeg ,
libjxl ,
poppler ,
@@ -41,6 +45,7 @@
libxslt ,
gobject-introspection ,
vala ,
gi-docgen ,
perl ,
appstream-glib ,
desktop-file-utils ,
@@ -48,6 +53,7 @@
glib-networking ,
json-glib ,
libmypaint ,
llvmPackages ,
gexiv2 ,
harfbuzz ,
mypaint-brushes1 ,
@@ -63,8 +69,6 @@
desktopToDarwinBundle ,
AppKit ,
Cocoa ,
gtk-mac-integration-gtk3 ,
unstableGitUpdater ,
}:
let
@@ -76,23 +80,17 @@ let
in
stdenv . mkDerivation ( finalAttrs : {
pname = " g i m p " ;
version = " 2 . 9 9 . 1 4 - u n s t a b l e - 2 0 2 3 - 0 3 - 1 7 " ;
version = " 3 . 0 . 0 - R C 1 " ;
outputs = [
" o u t "
" d e v "
" d e v d o c "
] ;
# We should not use fetchFromGitLab because the build system
# will complain and mark the build as unsupported when it cannot find
# .git directory but downloading the whole repo is jus too much.
src = fetchFromGitLab rec {
name = " g i m p - d e v - ${ rev } " ; # to make sure the hash is updated
domain = " g i t l a b . g n o m e . o r g " ;
owner = " G N O M E " ;
repo = " g i m p " ;
rev = " a d 7 a 2 e 5 3 e b 7 2 e f 4 7 1 5 6 6 f a 2 d 0 c e 9 f a e e c 9 2 9 f b c f " ;
hash = " s h a 2 5 6 - I J M U J c 8 1 7 E D W I R q q k C u w A c S w 7 g c g C k X x P a n 5 f E q 1 A O 0 = " ;
src = fetchurl {
url = " h t t p s : / / d o w n l o a d . g i m p . o r g / g i m p / v ${ lib . versions . majorMinor finalAttrs . version } / g i m p - ${ finalAttrs . version } . t a r . x z " ;
hash = " s h a 2 5 6 - s 9 C y Z M X j j n i f q v N B c A M 5 f z J A A U x Z x / Q X + c o 7 0 5 x f + 2 Y = " ;
} ;
patches = [
@@ -104,6 +102,7 @@ stdenv.mkDerivation (finalAttrs: {
# Use absolute paths instead of relying on PATH
# to make sure plug-ins are loaded by the correct interpreter.
# TODO: This now only appears to be used on Windows.
( replaceVars ./hardcode-plugin-interpreters.patch {
python_interpreter = python . interpreter ;
PYTHON_PATH = null ;
@@ -115,12 +114,12 @@ stdenv.mkDerivation (finalAttrs: {
session_conf = " ${ dbus . out } / s h a r e / d b u s - 1 / s e s s i o n . c o n f " ;
} )
# Since we pass absolute datadirs to Meson, the path is resolved incorrectly .
# What is more, even the assumption that iso-codes have the same datadir
# subdirectory as GIMP is incorrect. Though, there is not a way to obtain
# the correct directory at the moment. There is a MR against isocodes to fix that:
# https://salsa.debian.org/iso-codes-team/iso-codes/merge_requests/11
./fix-isocodes-paths.patch
# Fix pkg-config file .
# https://gitlab.gnome.org/GNOME/gimp/-/merge_requests/2037
( fetchpatch {
url = " h t t p s : / / g i t l a b . g n o m e . o r g / G N O M E / g i m p / - / c o m m i t / a 1 8 e 1 8 0 6 d b c 9 b 1 8 0 a e f a b b 2 c 0 f a e 4 3 4 9 3 f 1 e f 1 4 a . p a t c h " ;
hash = " s h a 2 5 6 - B U r P m 9 l B / a i y b B 2 S d 3 T K l J + 5 9 I T M Z l N U B X J P 5 Z d L Q 4 4 = " ;
} )
] ;
nativeBuildInputs =
@@ -135,6 +134,9 @@ stdenv.mkDerivation (finalAttrs: {
perl
vala
# for docs
gi-docgen
# for tests
desktop-file-utils
]
@@ -150,6 +152,7 @@ stdenv.mkDerivation (finalAttrs: {
[
appstream-glib # for library
babl
cfitsio
gegl
gtk3
glib
@@ -164,6 +167,8 @@ stdenv.mkDerivation (finalAttrs: {
fontconfig
lcms
libpng
libiff
libilbm
libjpeg
libjxl
poppler
@@ -204,9 +209,9 @@ stdenv.mkDerivation (finalAttrs: {
gjs
]
++ lib . optionals stdenv . hostPlatform . isDarwin [
llvmPackages . openmp
AppKit
Cocoa
gtk-mac-integration-gtk3
]
++ lib . optionals stdenv . hostPlatform . isLinux [
libgudev
@@ -215,6 +220,9 @@ stdenv.mkDerivation (finalAttrs: {
propagatedBuildInputs = [
# needed by gimp-3.0.pc
gegl
cairo
pango
gexiv2
] ;
mesonFlags =
@@ -227,14 +235,10 @@ stdenv.mkDerivation (finalAttrs: {
( lib . mesonEnable " l i n u x - i n p u t " stdenv . hostPlatform . isLinux )
# Not very important to do downstream, save a dependency.
" - D a p p d a t a - t e s t = d i s a b l e d "
# Incompatible with version in nixpkgs
" - D j p e g - x l = d i s a b l e d "
# Broken references
" - D g i - d o c g e n = d i s a b l e d "
]
++ lib . optionals stdenv . hostPlatform . isDarwin [
" - D a l s a = d i s a b l e d "
" - D j a v a s c r i p t = f a l s e "
" - D j a v a s c r i p t = d i s a b l e d "
] ;
doCheck = true ;
@@ -243,11 +247,7 @@ stdenv.mkDerivation (finalAttrs: {
# The check runs before glib-networking is registered
GIO_EXTRA_MODULES = " ${ glib-networking } / l i b / g i o / m o d u l e s " ;
NIX_CFLAGS_COMPILE = toString (
[ ]
++ lib . optionals stdenv . cc . isGNU [ " - W n o - e r r o r = i n c o m p a t i b l e - p o i n t e r - t y p e s " ]
++ lib . optionals stdenv . hostPlatform . isDarwin [ " - D G D K _ O S X _ B I G _ S U R = 1 6 " ]
) ;
NIX_CFLAGS_COMPILE = lib . optionalString stdenv . hostPlatform . isDarwin " - D G D K _ O S X _ B I G _ S U R = 1 6 " ;
# Check if librsvg was built with --disable-pixbuf-loader.
PKG_CONFIG_GDK_PIXBUF_2_0_GDK_PIXBUF_MODULEDIR = " ${ librsvg } / ${ gdk-pixbuf . moduleDir } " ;
@@ -258,19 +258,46 @@ stdenv.mkDerivation (finalAttrs: {
a p p / t e s t s / c r e a t e _ t e s t _ e n v . s h \
t o o l s / g i m p - m k e n u m s
# B y p a s s t h e n e e d f o r d o w n l o a d i n g g i t a r c h i v e .
s u b s t i t u t e a p p / g i t - v e r s i o n . h . i n g i t - v e r s i o n . h \
- - s u b s t - v a r - b y G I M P _ G I T _ V E R S I O N " G I M P _ 2 . 9 9 . ? - g ${ builtins . substring 0 10 finalAttrs . src . rev } " \
- - s u b s t - v a r - b y G I M P _ G I T _ V E R S I O N _ A B B R E V " ${ builtins . substring 0 10 finalAttrs . src . rev } " \
- - s u b s t - v a r - b y G I M P _ G I T _ L A S T _ C O M M I T _ Y E A R " ${ builtins . head ( builtins . match " . + \- u n s t a b l e - ( [ 0 - 9 ] { 4 } ) - [ 0 - 9 ] { 2 } - [ 0 - 9 ] { 2 } " finalAttrs . version ) } "
# G I M P i s e x e c u t e d a t b u i l d t i m e s o w e n e e d t o f i x t h i s .
# T O D O : L o o k i n t o i f w e c a n f i x t h e i n t e r p t h i n g .
c h m o d + x p l u g - i n s / p y t h o n / { c o l o r x h t m l , f i l e - o p e n r a s t e r , f o g g i f y , g r a d i e n t s - s a v e - a s - c s s , h i s t o g r a m - e x p o r t , p a l e t t e - o f f s e t , p a l e t t e - s o r t , p a l e t t e - t o - g r a d i e n t , p y t h o n - e v a l , s p y r o - p l u s } . p y
p a t c h S h e b a n g s \
p l u g - i n s / p y t h o n / { c o l o r x h t m l , f i l e - o p e n r a s t e r , f o g g i f y , g r a d i e n t s - s a v e - a s - c s s , h i s t o g r a m - e x p o r t , p a l e t t e - o f f s e t , p a l e t t e - s o r t , p a l e t t e - t o - g r a d i e n t , p y t h o n - e v a l , s p y r o - p l u s } . p y
'' ;
preBuild =
let
librarySuffix =
if stdenv . hostPlatform . extensions . library = = " . s o " then
" 3 . 0 . s o . 0 "
else if stdenv . hostPlatform . extensions . library = = " . d y l i b " then
" 3 . 0 . 0 . d y l i b "
else
throw " U n s u p p o r t e d l i b r a r y e x t e n s i o n ‘ ${ stdenv . hostPlatform . extensions . library } ’ " ;
in
''
# O u r g o b j e c t - i n t r o s p e c t i o n p a t c h e s m a k e t h e s h a r e d l i b r a r y p a t h s a b s o l u t e
# i n t h e G I R f i l e s . W h e n r u n n i n g G I M P i n b u i l d o r c h e c k p h a s e , i t w i l l t r y
# t o u s e p l u g - i n s , w h i c h i m p o r t G I M P i n t r o s p e c t i o n f i l e s w h i c h w i l l t r y
# t o l o a d t h e G I M P l i b r a r i e s w h i c h w i l l n o t b e i n s t a l l e d y e t .
# S o w e n e e d t o r e p l a c e t h e a b s o l u t e p a t h w i t h a l o c a l o n e .
# W e a r e u s i n g a s y m l i n k t h a t w i l l b e o v e r r i d d e n d u r i n g i n s t a l l a t i o n .
m k d i r - p " $o u t / l i b "
l n - s " $P W D / l i b g i m p / l i b g i m p - ${ librarySuffix } " \
" $P W D / l i b g i m p b a s e / l i b g i m p b a s e - ${ librarySuffix } " \
" $P W D / l i b g i m p c o l o r / l i b g i m p c o l o r - ${ librarySuffix } " \
" $P W D / l i b g i m p c o n f i g / l i b g i m p c o n f i g - ${ librarySuffix } " \
" $P W D / l i b g i m p m a t h / l i b g i m p m a t h - ${ librarySuffix } " \
" $P W D / l i b g i m p m o d u l e / l i b g i m p m o d u l e - ${ librarySuffix } " \
" $o u t / l i b / "
'' ;
preCheck = ''
# A v o i d “ E r r o r r e t r i e v i n g a c c e s s i b i l i t y b u s a d d r e s s ”
e x p o r t N O _ A T _ B R I D G E = 1
# F i x s t o r i n g r e c e n t f i l e l i s t i n t e s t s
e x p o r t H O M E = " $T M P D I R "
e x p o r t X D G _ D A T A _ D I R S = " ${ glib . getSchemaDataDirPath gtk3 } : $X D G _ D A T A _ D I R S "
e x p o r t X D G _ D A T A _ D I R S = " ${ glib . getSchemaDataDirPath gtk3 } : ${ adwaita-icon-theme } / s h a r e : $X D G _ D A T A _ D I R S "
'' ;
preFixup = ''
@@ -284,10 +311,15 @@ stdenv.mkDerivation (finalAttrs: {
} " )
'' ;
postFixup = ''
# C a n n o t b e i n p o s t I n s t a l l , o t h e r w i s e _ m u l t i o u t D o c s h o o k i n p r e F i x u p w i l l m o v e r i g h t b a c k .
m o v e T o O u t p u t " s h a r e / d o c " " $d e v d o c "
'' ;
passthru = {
# The declarations for `gimp-with-plugins` wrapper,
# used for determining plug-in installation paths
majorVersion = " 2 . 9 9 " ;
majorVersion = " ${ lib . versions . major finalAttrs . version } . 0 " ;
targetLibDir = " l i b / g i m p / ${ finalAttrs . passthru . majorVersion } " ;
targetDataDir = " s h a r e / g i m p / ${ finalAttrs . passthru . majorVersion } " ;
targetPluginDir = " ${ finalAttrs . passthru . targetLibDir } / p l u g - i n s " ;
@@ -295,12 +327,6 @@ stdenv.mkDerivation (finalAttrs: {
# probably its a good idea to use the same gtk in plugins ?
gtk = gtk3 ;
updateScript = unstableGitUpdater {
stableVersion = true ;
tagPrefix = " G I M P _ " ;
tagConverter = " s e d s / _ / . / g " ;
} ;
} ;
meta = with lib ; {
@@ -308,7 +334,7 @@ stdenv.mkDerivation (finalAttrs: {
homepage = " h t t p s : / / w w w . g i m p . o r g / " ;
maintainers = with maintainers ; [ jtojnar ] ;
license = licenses . gpl3Plus ;
platforms = platforms . unix ;
platforms = platforms . linux ;
mainProgram = " g i m p " ;
} ;
} )