about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/gdk-pixbuf
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/gdk-pixbuf')
-rw-r--r--nixpkgs/pkgs/development/libraries/gdk-pixbuf/default.nix144
-rw-r--r--nixpkgs/pkgs/development/libraries/gdk-pixbuf/installed-tests-path.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh17
-rw-r--r--nixpkgs/pkgs/development/libraries/gdk-pixbuf/xlib.nix52
4 files changed, 226 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/gdk-pixbuf/default.nix b/nixpkgs/pkgs/development/libraries/gdk-pixbuf/default.nix
new file mode 100644
index 000000000000..7f63d5f67e78
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gdk-pixbuf/default.nix
@@ -0,0 +1,144 @@
+{ stdenv
+, fetchurl
+, nixosTests
+, fixDarwinDylibNames
+, meson
+, ninja
+, pkg-config
+, gettext
+, python3
+, libxslt
+, docbook-xsl-nons
+, docbook_xml_dtd_43
+, gi-docgen
+, glib
+, libtiff
+, libjpeg
+, libpng
+, gnome
+, gobject-introspection
+, doCheck ? false
+, makeWrapper
+, lib
+}:
+
+let
+  withGtkDoc = stdenv.buildPlatform == stdenv.hostPlatform;
+in
+stdenv.mkDerivation rec {
+  pname = "gdk-pixbuf";
+  version = "2.42.6";
+
+  outputs = [ "out" "dev" "man" ]
+    ++ lib.optional withGtkDoc "devdoc"
+    ++ lib.optional (stdenv.buildPlatform == stdenv.hostPlatform) "installedTests";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "0zz7pmw2z46g7mr1yjxbsdldd5pd03xbjc58inj8rxfqgrdvg9n4";
+  };
+
+  patches = [
+    # Move installed tests to a separate output
+    ./installed-tests-path.patch
+  ];
+
+  nativeBuildInputs = [
+    meson
+    ninja
+    pkg-config
+    gettext
+    python3
+    gobject-introspection
+    makeWrapper
+    glib
+    gi-docgen
+
+    # for man pages
+    libxslt
+    docbook-xsl-nons
+    docbook_xml_dtd_43
+  ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
+
+  propagatedBuildInputs = [
+    glib
+    libtiff
+    libjpeg
+    libpng
+  ];
+
+  mesonFlags = [
+    "-Dgtk_doc=${lib.boolToString withGtkDoc}"
+    "-Dintrospection=${if (stdenv.buildPlatform == stdenv.hostPlatform) then "enabled" else "disabled"}"
+    "-Dgio_sniffing=false"
+  ];
+
+  postPatch = ''
+    chmod +x build-aux/* # patchShebangs only applies to executables
+    patchShebangs build-aux
+
+    substituteInPlace tests/meson.build --subst-var-by installedtestsprefix "$installedTests"
+  '';
+
+  preInstall = ''
+    PATH=$PATH:$out/bin # for install script
+  '';
+
+  postInstall =
+    ''
+      # All except one utility seem to be only useful during building.
+      moveToOutput "bin" "$dev"
+      moveToOutput "bin/gdk-pixbuf-thumbnailer" "$out"
+
+    '' + lib.optionalString stdenv.isDarwin ''
+      # meson erroneously installs loaders with .dylib extension on Darwin.
+      # Their @rpath has to be replaced before gdk-pixbuf-query-loaders looks at them.
+      for f in $out/${passthru.moduleDir}/*.dylib; do
+          install_name_tool -change @rpath/libgdk_pixbuf-2.0.0.dylib $out/lib/libgdk_pixbuf-2.0.0.dylib $f
+          mv $f ''${f%.dylib}.so
+      done
+    '' + lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
+      # We need to install 'loaders.cache' in lib/gdk-pixbuf-2.0/2.10.0/
+      $dev/bin/gdk-pixbuf-query-loaders --update-cache
+    '' + lib.optionalString withGtkDoc ''
+      # So that devhelp can find this.
+      mkdir -p "$devdoc/share/devhelp"
+      mv "$out/share/doc" "$devdoc/share/devhelp/books"
+    '';
+
+  # The fixDarwinDylibNames hook doesn't patch binaries.
+  preFixup = lib.optionalString stdenv.isDarwin ''
+    for f in $out/bin/* $dev/bin/*; do
+        install_name_tool -change @rpath/libgdk_pixbuf-2.0.0.dylib $out/lib/libgdk_pixbuf-2.0.0.dylib $f
+    done
+  '';
+
+  # The tests take an excessive amount of time (> 1.5 hours) and memory (> 6 GB).
+  inherit doCheck;
+
+  setupHook = ./setup-hook.sh;
+
+  separateDebugInfo = stdenv.isLinux;
+
+  passthru = {
+    updateScript = gnome.updateScript {
+      packageName = pname;
+      versionPolicy = "odd-unstable";
+    };
+
+    tests = {
+      installedTests = nixosTests.installed-tests.gdk-pixbuf;
+    };
+
+    # gdk_pixbuf_moduledir variable from gdk-pixbuf-2.0.pc
+    moduleDir = "lib/gdk-pixbuf-2.0/2.10.0/loaders";
+  };
+
+  meta = with lib; {
+    description = "A library for image loading and manipulation";
+    homepage = "https://gitlab.gnome.org/GNOME/gdk-pixbuf";
+    maintainers = [ maintainers.eelco ] ++ teams.gnome.members;
+    license = licenses.lgpl21Plus;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/gdk-pixbuf/installed-tests-path.patch b/nixpkgs/pkgs/development/libraries/gdk-pixbuf/installed-tests-path.patch
new file mode 100644
index 000000000000..1da2b0a10dcd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gdk-pixbuf/installed-tests-path.patch
@@ -0,0 +1,13 @@
+--- a/tests/meson.build
++++ b/tests/meson.build
+@@ -85,8 +85,8 @@
+   'aero.gif',
+ ]
+ 
+-installed_test_bindir = join_paths(gdk_pixbuf_libexecdir, 'installed-tests', meson.project_name())
+-installed_test_datadir = join_paths(gdk_pixbuf_datadir, 'installed-tests', meson.project_name())
++installed_test_bindir = join_paths('@installedtestsprefix@', 'libexec', 'installed-tests', meson.project_name())
++installed_test_datadir = join_paths('@installedtestsprefix@', 'share', 'installed-tests', meson.project_name())
+ 
+ install_data(test_data, install_dir: installed_test_bindir)
+ install_subdir('test-images', install_dir: installed_test_bindir)
diff --git a/nixpkgs/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh b/nixpkgs/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh
new file mode 100644
index 000000000000..bdfd00009dc5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh
@@ -0,0 +1,17 @@
+findGdkPixbufLoaders() {
+
+	# choose the longest loaders.cache
+	local loadersCache="$1/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"
+	if [[ -f "$loadersCache" ]]; then
+		if [[ -f "${GDK_PIXBUF_MODULE_FILE-}" ]]; then
+			if (( "$(cat "$loadersCache" | wc -l)" > "$(cat "$GDK_PIXBUF_MODULE_FILE" | wc -l)" )); then
+				export GDK_PIXBUF_MODULE_FILE="$loadersCache"
+			fi
+		else
+			export GDK_PIXBUF_MODULE_FILE="$loadersCache"
+		fi
+	fi
+
+}
+
+addEnvHooks "$targetOffset" findGdkPixbufLoaders
diff --git a/nixpkgs/pkgs/development/libraries/gdk-pixbuf/xlib.nix b/nixpkgs/pkgs/development/libraries/gdk-pixbuf/xlib.nix
new file mode 100644
index 000000000000..bc4c14beb458
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gdk-pixbuf/xlib.nix
@@ -0,0 +1,52 @@
+{ lib, stdenv
+, fetchFromGitLab
+, meson
+, ninja
+, pkg-config
+, docbook-xsl-nons
+, docbook_xml_dtd_43
+, gtk-doc
+, gdk-pixbuf
+, libX11
+}:
+
+stdenv.mkDerivation rec {
+  pname = "gdk-pixbuf-xlib";
+  version = "2020-06-11-unstable";
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  src = fetchFromGitLab {
+    domain = "gitlab.gnome.org";
+    owner = "Archive";
+    repo = "gdk-pixbuf-xlib";
+    rev = "3116b8ae55501cf48d16970aa2b50a5530e15223";
+    sha256 = "15wisf2xld3cr7lprnic8fvwpcmww4rydwc1bn2zilyi52vzl2zd";
+  };
+
+  nativeBuildInputs = [
+    meson
+    ninja
+    pkg-config
+    docbook-xsl-nons
+    docbook_xml_dtd_43
+    gtk-doc
+  ];
+
+  propagatedBuildInputs = [
+    gdk-pixbuf
+    libX11
+  ];
+
+  mesonFlags = [
+    "-Dgtk_doc=true"
+  ];
+
+  meta = with lib; {
+    description = "Deprecated API for integrating GdkPixbuf with Xlib data types";
+    homepage = "https://gitlab.gnome.org/Archive/gdk-pixbuf-xlib";
+    maintainers = teams.gnome.members;
+    license = licenses.lgpl21Plus;
+    platforms = platforms.unix;
+  };
+}