gimp3.0.4: rebuilding from 0
This commit is contained in:
parent
eca9ff8954
commit
e4f6e95212
305
flake.nix
305
flake.nix
@ -1,287 +1,82 @@
|
|||||||
{
|
{
|
||||||
description = "Nix Flake for GIMP 3 built from source";
|
description = "Nix Flake for GIMP 3.0.4 built from source";
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
# Source du code GIMP
|
# Source du code GIMP
|
||||||
gimp-source = {
|
gimp-source = {
|
||||||
url = "git+https://gitlab.gnome.org/GNOME/gimp.git";
|
url = "git+https://gitlab.gnome.org/GNOME/gimp";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
gimp-data = {
|
||||||
|
url = "git+https://gitlab.gnome.org/GNOME/gimp-data";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
outputs = { self, nixpkgs, flake-utils, gimp-source }:
|
outputs = { self, nixpkgs, flake-utils, gimp-source, ... }:
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs { inherit system; };
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
in
|
||||||
buildGimp3 = {
|
{
|
||||||
version ? "3.0.0",
|
packages.default = pkgs.stdenv.mkDerivation {
|
||||||
enabledFeatures ? [],
|
|
||||||
disabledFeatures ? []
|
|
||||||
}: pkgs.stdenv.mkDerivation rec {
|
|
||||||
pname = "gimp";
|
pname = "gimp";
|
||||||
inherit version;
|
version = "3.0.4";
|
||||||
|
|
||||||
# FIXED: Use fetchgit to properly fetch submodules
|
src = gimp-source;
|
||||||
src = pkgs.fetchgit {
|
|
||||||
url = "https://gitlab.gnome.org/GNOME/gimp.git";
|
|
||||||
rev = "master";
|
|
||||||
fetchSubmodules = true;
|
|
||||||
sha256 = pkgs.lib.fakeSha256;
|
|
||||||
};
|
|
||||||
|
|
||||||
# FIXED: Added missing critical dependencies
|
|
||||||
nativeBuildInputs = with pkgs; [
|
|
||||||
pkg-config
|
|
||||||
meson
|
|
||||||
ninja
|
|
||||||
python3
|
|
||||||
gettext
|
|
||||||
perl
|
|
||||||
intltool
|
|
||||||
appstream-glib
|
|
||||||
desktop-file-utils
|
|
||||||
gobject-introspection
|
|
||||||
wrapGAppsHook
|
|
||||||
cmake # Often needed for some dependencies
|
|
||||||
autoconf
|
|
||||||
automake
|
|
||||||
libtool
|
|
||||||
git # Sometimes needed during build
|
|
||||||
];
|
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
glib
|
#0
|
||||||
glib-networking # FIXED: Moved to more prominent position
|
meson
|
||||||
gtk3
|
#1
|
||||||
gdk-pixbuf
|
pkg-config
|
||||||
pango
|
#2
|
||||||
cairo
|
gettext
|
||||||
harfbuzz
|
#3
|
||||||
babl
|
babl
|
||||||
gegl
|
gegl
|
||||||
libmypaint
|
#4
|
||||||
mypaint-brushes1
|
gtk4
|
||||||
|
glib
|
||||||
|
glib-networking
|
||||||
|
gdk-pixbuf
|
||||||
|
pango
|
||||||
|
#5
|
||||||
|
cairo
|
||||||
|
#6
|
||||||
|
#??
|
||||||
|
harfbuzz
|
||||||
|
#7
|
||||||
|
zlib
|
||||||
|
libzip
|
||||||
|
#??
|
||||||
|
#8
|
||||||
gexiv2
|
gexiv2
|
||||||
libwebp
|
#9
|
||||||
libpng
|
libpng
|
||||||
libjpeg
|
libjpeg
|
||||||
libtiff
|
libtiff
|
||||||
libheif
|
|
||||||
libexif
|
|
||||||
lcms2
|
|
||||||
poppler
|
|
||||||
poppler_data
|
|
||||||
ghostscript
|
|
||||||
librsvg
|
librsvg
|
||||||
libmng
|
lcms
|
||||||
libjxl
|
#10
|
||||||
libwmf
|
libmypaint
|
||||||
libxslt
|
# Add your build dependencies
|
||||||
libxml2
|
# gcc
|
||||||
json-glib
|
# cmake
|
||||||
libgudev
|
# python3
|
||||||
# iso-codes # Not available in nixpkgs under this name
|
|
||||||
aalib
|
|
||||||
openexr
|
|
||||||
dbus-glib
|
|
||||||
xorg.libXmu
|
|
||||||
xorg.libXpm
|
|
||||||
zlib
|
|
||||||
bzip2
|
|
||||||
# FIXED: Added missing dependencies
|
|
||||||
freetype
|
|
||||||
fontconfig
|
|
||||||
pixman
|
|
||||||
at-spi2-atk
|
|
||||||
at-spi2-core
|
|
||||||
atk
|
|
||||||
# FIXED: Additional dependencies that might be needed
|
|
||||||
libsoup_3 # Required for glib-networking functionality
|
|
||||||
gsettings-desktop-schemas # For GSettings schemas
|
|
||||||
hicolor-icon-theme # For proper icon handling
|
|
||||||
# FIXED: Python dependencies for PyGObject
|
|
||||||
python3Packages.pygobject3
|
|
||||||
python3Packages.pycairo
|
|
||||||
] ++ pkgs.lib.optionals (pkgs.stdenv.isLinux) [
|
|
||||||
libunwind
|
|
||||||
];
|
];
|
||||||
|
|
||||||
# FIXED: Better meson configuration with explicit glib-networking support
|
|
||||||
mesonFlags = [
|
|
||||||
"-Dbuild-id=Nix"
|
|
||||||
"-Dcheck-update=no" # Disable update checks
|
|
||||||
# FIXED: Ensure glib-networking is properly detected
|
|
||||||
"-Dglib-networking=enabled"
|
|
||||||
# Explicitly disable problematic features that might cause build issues
|
|
||||||
"-Dalsa=disabled"
|
|
||||||
"-Dgudev=disabled"
|
|
||||||
] ++ pkgs.lib.optionals (enabledFeatures != [])
|
|
||||||
(map (feature: "-D${feature}=enabled") enabledFeatures)
|
|
||||||
++ pkgs.lib.optionals (disabledFeatures != [])
|
|
||||||
(map (feature: "-D${feature}=disabled") disabledFeatures);
|
|
||||||
|
|
||||||
# FIXED: Better build configuration with proper environment setup
|
|
||||||
configurePhase = ''
|
|
||||||
runHook preConfigure
|
|
||||||
|
|
||||||
# FIXED: Set up environment for glib-networking detection
|
|
||||||
export PKG_CONFIG_PATH="${pkgs.glib-networking}/lib/pkgconfig:${pkgs.glib}/lib/pkgconfig:$PKG_CONFIG_PATH"
|
|
||||||
export GIO_MODULE_DIR="${pkgs.glib-networking}/lib/gio/modules"
|
|
||||||
|
|
||||||
# FIXED: Set up Python environment for PyGObject
|
|
||||||
export PYTHONPATH="${pkgs.python3Packages.pygobject3}/${pkgs.python3.sitePackages}:${pkgs.python3Packages.pycairo}/${pkgs.python3.sitePackages}:$PYTHONPATH"
|
|
||||||
|
|
||||||
# Ensure pkg-config can find all dependencies
|
|
||||||
export PKG_CONFIG_PATH="${pkgs.lib.concatStringsSep ":" (map (p: "${p}/lib/pkgconfig") buildInputs)}:$PKG_CONFIG_PATH"
|
|
||||||
|
|
||||||
# Ensure we have a clean build directory
|
|
||||||
meson setup build . $mesonFlags
|
|
||||||
|
|
||||||
runHook postConfigure
|
|
||||||
'';
|
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
runHook preBuild
|
meson compile
|
||||||
|
|
||||||
# FIXED: Set environment variables for build
|
|
||||||
export GIO_MODULE_DIR="${pkgs.glib-networking}/lib/gio/modules"
|
|
||||||
export GSETTINGS_SCHEMA_DIR="${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}/glib-2.0/schemas"
|
|
||||||
|
|
||||||
# Build with limited parallelism to avoid memory issues
|
|
||||||
ninja -C build -j$NIX_BUILD_CORES
|
|
||||||
|
|
||||||
runHook postBuild
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
|
||||||
|
|
||||||
ninja -C build install
|
|
||||||
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
|
|
||||||
postInstall = ''
|
|
||||||
# Création des répertoires pour les plugins
|
|
||||||
mkdir -p $out/lib/gimp/3.0/plug-ins
|
|
||||||
mkdir -p $out/lib/gimp/3.0/scripts
|
|
||||||
|
|
||||||
# FIXED: Ensure desktop file is properly installed
|
|
||||||
mkdir -p $out/share/applications
|
|
||||||
if [ -f build/desktop/org.gimp.GIMP.desktop ]; then
|
|
||||||
cp build/desktop/org.gimp.GIMP.desktop $out/share/applications/
|
|
||||||
fi
|
|
||||||
|
|
||||||
# FIXED: Set up GIO modules path for runtime
|
|
||||||
mkdir -p $out/lib/gio/modules
|
|
||||||
if [ -d "${pkgs.glib-networking}/lib/gio/modules" ]; then
|
|
||||||
ln -sf "${pkgs.glib-networking}/lib/gio/modules"/* $out/lib/gio/modules/
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
|
|
||||||
# FIXED: Add environment variables that might be needed
|
|
||||||
preBuild = ''
|
|
||||||
export HOME=$(mktemp -d)
|
|
||||||
export XDG_CACHE_HOME=$HOME/.cache
|
|
||||||
export XDG_CONFIG_HOME=$HOME/.config
|
|
||||||
export XDG_DATA_HOME=$HOME/.local/share
|
|
||||||
|
|
||||||
# FIXED: Ensure glib-networking is available
|
|
||||||
export GIO_MODULE_DIR="${pkgs.glib-networking}/lib/gio/modules"
|
|
||||||
export GSETTINGS_SCHEMA_DIR="${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}/glib-2.0/schemas"
|
|
||||||
|
|
||||||
# FIXED: Python environment for PyGObject
|
|
||||||
export PYTHONPATH="${pkgs.python3Packages.pygobject3}/${pkgs.python3.sitePackages}:${pkgs.python3Packages.pycairo}/${pkgs.python3.sitePackages}:$PYTHONPATH"
|
|
||||||
'';
|
|
||||||
|
|
||||||
# FIXED: Add preFixup to handle GSettings and GIO modules
|
|
||||||
preFixup = ''
|
|
||||||
gappsWrapperArgs+=(
|
|
||||||
--prefix GIO_MODULE_DIR : "${pkgs.glib-networking}/lib/gio/modules"
|
|
||||||
--prefix GSETTINGS_SCHEMA_DIR : "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}/glib-2.0/schemas"
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with pkgs.lib; {
|
|
||||||
description = "GNU Image Manipulation Program (GIMP) version 3.0";
|
|
||||||
homepage = "https://www.gimp.org/";
|
|
||||||
license = licenses.gpl3Plus;
|
|
||||||
platforms = platforms.unix;
|
|
||||||
maintainers = [ ];
|
|
||||||
broken = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Construction de base de GIMP 3
|
|
||||||
gimp3-base = buildGimp3 {};
|
|
||||||
|
|
||||||
mkGimp3WithPlugins = {
|
|
||||||
plugins ? [],
|
|
||||||
enabledFeatures ? [],
|
|
||||||
disabledFeatures ? []
|
|
||||||
}: pkgs.symlinkJoin {
|
|
||||||
name = "gimp3-with-plugins";
|
|
||||||
paths = [ (buildGimp3 { inherit enabledFeatures disabledFeatures; }) ] ++ plugins;
|
|
||||||
|
|
||||||
postBuild = ''
|
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cat > $out/bin/gimp << EOF
|
# Install built files
|
||||||
#!/bin/sh
|
# make install PREFIX=$out
|
||||||
export GIMP3_PLUGINDIR=\$HOME/.config/GIMP/3.0/plug-ins:${pkgs.lib.concatStringsSep ":" (map (p: "${p}/lib/gimp/3.0/plug-ins") plugins)}
|
# cp executable $out/bin/
|
||||||
export GIMP3_SCRIPTDIR=\$HOME/.config/GIMP/3.0/scripts:${pkgs.lib.concatStringsSep ":" (map (p: "${p}/lib/gimp/3.0/scripts") plugins)}
|
|
||||||
export GIO_MODULE_DIR="${pkgs.glib-networking}/lib/gio/modules"
|
|
||||||
exec ${gimp3-base}/bin/gimp "\$@"
|
|
||||||
EOF
|
|
||||||
chmod +x $out/bin/gimp
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
}
|
||||||
{
|
);
|
||||||
packages = rec {
|
|
||||||
# Ultra-minimal version for testing
|
|
||||||
gimp3-test = buildGimp3 {
|
|
||||||
disabledFeatures = [
|
|
||||||
"javascript"
|
|
||||||
"alsa"
|
|
||||||
"gudev"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
gimp3 = gimp3-base;
|
|
||||||
|
|
||||||
# Simplified version with fewer potential build issues
|
|
||||||
gimp3-minimal = buildGimp3 {
|
|
||||||
disabledFeatures = [
|
|
||||||
"python"
|
|
||||||
"javascript"
|
|
||||||
"lua"
|
|
||||||
"webkitgtk"
|
|
||||||
"alsa"
|
|
||||||
"gudev"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
gimp3-full = buildGimp3 {
|
|
||||||
enabledFeatures = [
|
|
||||||
"webp"
|
|
||||||
"openexr"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
default = gimp3-test;
|
|
||||||
};
|
|
||||||
|
|
||||||
lib = {
|
|
||||||
inherit buildGimp3 mkGimp3WithPlugins;
|
|
||||||
};
|
|
||||||
|
|
||||||
apps = rec {
|
|
||||||
gimp3 = flake-utils.lib.mkApp {
|
|
||||||
drv = self.packages.${system}.gimp3;
|
|
||||||
exePath = "/bin/gimp";
|
|
||||||
};
|
|
||||||
default = gimp3;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user