From ef5475235ce4f3d1405dca5653cbe3599f0ff637 Mon Sep 17 00:00:00 2001 From: Justin Humm Date: Mon, 2 Mar 2020 14:48:21 -0800 Subject: glimpse: init at 0.2.0 Co-authored-by: Louis Bettens Co-authored-by: ash lea --- .../applications/graphics/gimp/plugins/default.nix | 2 +- pkgs/applications/graphics/glimpse/default.nix | 197 +++++++++++++++++++++ .../graphics/glimpse/plugins/default.nix | 11 ++ .../graphics/glimpse/remove-cc-reference.patch | 13 ++ pkgs/applications/graphics/glimpse/wrapper.nix | 30 ++++ 5 files changed, 252 insertions(+), 1 deletion(-) create mode 100644 pkgs/applications/graphics/glimpse/default.nix create mode 100644 pkgs/applications/graphics/glimpse/plugins/default.nix create mode 100644 pkgs/applications/graphics/glimpse/remove-cc-reference.patch create mode 100644 pkgs/applications/graphics/glimpse/wrapper.nix (limited to 'pkgs/applications/graphics') diff --git a/pkgs/applications/graphics/gimp/plugins/default.nix b/pkgs/applications/graphics/gimp/plugins/default.nix index b2a5b771211c..555bfbe17e7f 100644 --- a/pkgs/applications/graphics/gimp/plugins/default.nix +++ b/pkgs/applications/graphics/gimp/plugins/default.nix @@ -35,7 +35,7 @@ let } // attrs // { - name = "gimp-plugin-${name}"; + name = "${gimp.name}-plugin-${name}"; buildInputs = [ gimp gimp.gtk diff --git a/pkgs/applications/graphics/glimpse/default.nix b/pkgs/applications/graphics/glimpse/default.nix new file mode 100644 index 000000000000..de85fb9bf174 --- /dev/null +++ b/pkgs/applications/graphics/glimpse/default.nix @@ -0,0 +1,197 @@ +{ stdenv +, lib +, fetchFromGitHub +, substituteAll +, pkg-config +, intltool +, babl +, gegl +, gtk2 +, glib +, gdk-pixbuf +, isocodes +, pango +, cairo +, freetype +, fontconfig +, lcms +, libpng +, libjpeg +, poppler +, poppler_data +, libtiff +, libmng +, librsvg +, libwmf +, zlib +, libzip +, ghostscript +, aalib +, shared-mime-info +, python2 +, libexif +, gettext +, xorg +, glib-networking +, libmypaint +, gexiv2 +, harfbuzz +, mypaint-brushes1 +, libwebp +, libheif +, libgudev +, openexr +, AppKit +, Cocoa +, gtk-mac-integration-gtk2 +, libxslt +, automake +, autoconf +, libtool +, makeWrapper +, autoreconfHook +, gtk-doc +}: +let + python = python2.withPackages (pp: [ pp.pygtk ]); +in +stdenv.mkDerivation rec { + pname = "glimpse"; + version = "0.2.0"; + + outputs = [ "out" "dev" ]; + + src = fetchFromGitHub { + owner = "glimpse-editor"; + repo = "Glimpse"; + rev = "v${version}"; + sha256 = "sha256-qbZQmAo7fuJWWbn0QTyxAwAenZOdsGueUq5/3IV8Njc="; + }; + + patches = [ + # to remove compiler from the runtime closure, reference was retained via + # gimp --version --verbose output + (substituteAll { + src = ./remove-cc-reference.patch; + cc_version = stdenv.cc.cc.name; + }) + ../gimp/hardcode-plugin-interpreters.patch + ]; + + postPatch = '' + ln -s ${gtk-doc}/share/gtk-doc/data/gtk-doc.make . + ''; + + nativeBuildInputs = [ + autoreconfHook + pkg-config + intltool + gettext + automake + autoconf + makeWrapper + gtk-doc + libxslt + libtool + ]; + + buildInputs = [ + babl + gegl + gtk2 + glib + gdk-pixbuf + pango + cairo + gexiv2 + harfbuzz + isocodes + freetype + fontconfig + lcms + libpng + libjpeg + poppler + poppler_data + libtiff + openexr + libmng + librsvg + libwmf + zlib + libzip + ghostscript + aalib + shared-mime-info + libwebp + libheif + python + libexif + xorg.libXpm + glib-networking + libmypaint + mypaint-brushes1 + ] ++ lib.optionals stdenv.isDarwin [ + AppKit + Cocoa + gtk-mac-integration-gtk2 + ] ++ lib.optionals stdenv.isLinux [ + libgudev + ]; + + # needed by gimp-2.0.pc + propagatedBuildInputs = [ + gegl + ]; + + # Check if librsvg was built with --disable-pixbuf-loader. + PKG_CONFIG_GDK_PIXBUF_2_0_GDK_PIXBUF_MODULEDIR = "${librsvg}/${gdk-pixbuf.moduleDir}"; + + preAutoreconf = '' + # The check runs before glib-networking is registered + export GIO_EXTRA_MODULES="${glib-networking}/lib/gio/modules:$GIO_EXTRA_MODULES" + ''; + + postFixup = '' + wrapProgram $out/bin/glimpse-${lib.versions.majorMinor version} \ + --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" + ''; + + passthru = rec { + # The declarations for `glimpse-with-plugins` wrapper, + # used for determining plug-in installation paths + majorVersion = "2.0"; + targetPluginDir = "lib/glimpse/${majorVersion}/plug-ins"; + targetScriptDir = "share/glimpse/${majorVersion}/scripts"; + targetDataDir = "share/gimp/${majorVersion}"; + targetLibDir = "lib/gimp/${majorVersion}"; + + # probably its a good idea to use the same gtk in plugins ? + gtk = gtk2; + }; + + configureFlags = [ + "--without-webkit" # old version is required + "--with-bug-report-url=https://github.com/NixOS/nixpkgs/issues/new" + "--with-icc-directory=/run/current-system/sw/share/color/icc" + # fix libdir in pc files (${exec_prefix} needs to be passed verbatim) + "--libdir=\${exec_prefix}/lib" + ]; + + # on Darwin, + # test-eevl.c:64:36: error: initializer element is not a compile-time constant + doCheck = !stdenv.isDarwin; + + enableParallelBuilding = true; + + meta = with lib; { + description = "An open source image editor based on the GNU Image Manipulation Program"; + longDescription = '' + Glimpse is an open source image editor based on the GNU Image Manipulation Program (GIMP). The goal is to experiment with new ideas and expand the use of free software. + ''; + homepage = "https://glimpse-editor.org"; + maintainers = with maintainers; [ ashkitten erictapen ]; + license = licenses.gpl3Plus; + platforms = platforms.unix; + }; +} diff --git a/pkgs/applications/graphics/glimpse/plugins/default.nix b/pkgs/applications/graphics/glimpse/plugins/default.nix new file mode 100644 index 000000000000..48c65c3d5646 --- /dev/null +++ b/pkgs/applications/graphics/glimpse/plugins/default.nix @@ -0,0 +1,11 @@ +# Use `glimpse-with-plugins` package for Glimpse with all plug-ins. +# If you just want a subset of plug-ins, you can specify them explicitly: +# `glimpse-with-plugins.override { plugins = with glimpsePlugins; [ gap ]; }`. + +{ gimpPlugins, glimpse }: + +# This attrs can be extended in the future if there happen to be glimpse-only +# plugins or some that need further modification in order to work with Glimpse. +gimpPlugins.overrideScope' (self: super: { + gimp = glimpse; +}) diff --git a/pkgs/applications/graphics/glimpse/remove-cc-reference.patch b/pkgs/applications/graphics/glimpse/remove-cc-reference.patch new file mode 100644 index 000000000000..e63bf88dfdd7 --- /dev/null +++ b/pkgs/applications/graphics/glimpse/remove-cc-reference.patch @@ -0,0 +1,13 @@ +diff --git a/app/gimp-version.c b/app/gimp-version.c +index b584398231..1b40a1570f 100644 +--- a/app/gimp-version.c ++++ b/app/gimp-version.c +@@ -230,7 +230,7 @@ gimp_version (gboolean be_verbose, + GIMP_BUILD_ID, + gimp_version_get_revision (), + GIMP_BUILD_PLATFORM_FAMILY, +- CC_VERSION, ++ "@cc_version@", + lib_versions); + g_free (lib_versions); + diff --git a/pkgs/applications/graphics/glimpse/wrapper.nix b/pkgs/applications/graphics/glimpse/wrapper.nix new file mode 100644 index 000000000000..cdfb2f668731 --- /dev/null +++ b/pkgs/applications/graphics/glimpse/wrapper.nix @@ -0,0 +1,30 @@ +{ lib, symlinkJoin, glimpse, makeWrapper, glimpsePlugins, gnome3, plugins ? null }: + +let + allPlugins = lib.filter (pkg: lib.isDerivation pkg && !pkg.meta.broken or false) (lib.attrValues glimpsePlugins); + selectedPlugins = if plugins == null then allPlugins else plugins; + extraArgs = map (x: x.wrapArgs or "") selectedPlugins; + versionBranch = lib.versions.majorMinor glimpse.version; + +in +symlinkJoin { + name = "glimpse-with-plugins-${glimpse.version}"; + + paths = [ glimpse ] ++ selectedPlugins; + + buildInputs = [ makeWrapper ]; + + postBuild = '' + for each in glimpse-${versionBranch} glimpse-console-${versionBranch}; do + wrapProgram $out/bin/$each \ + --set GIMP2_PLUGINDIR "$out/lib/glimpse/2.0" \ + --set GIMP2_DATADIR "$out/share/glimpse/2.0" \ + --prefix GTK_PATH : "${gnome3.gnome-themes-extra}/lib/gtk-2.0" \ + ${toString extraArgs} + done + + for each in glimpse glimpse-console; do + ln -sf "$each-${versionBranch}" $out/bin/$each + done + ''; +} -- cgit v1.2.3