From de96fb7cc7c1477af00e260dc972331500881769 Mon Sep 17 00:00:00 2001 From: Mateusz Kowalczyk Date: Mon, 3 Nov 2014 23:01:03 +0000 Subject: [PATCH] sxiv: update to 1.3-git and fix runtime behaviour The fix involves using imlib2 built with giflib instead of a libungif. Initially I split imlib2 into two but other distros seem to build imlib2 with giflib already and everything still builds with giflib version so I migrated imlib2 to giflib all together. Closes #4622 --- pkgs/applications/graphics/sxiv/146.patch | 25 -------- pkgs/applications/graphics/sxiv/default.nix | 23 +++---- pkgs/development/libraries/imlib2/default.nix | 8 ++- .../libraries/imlib2/giflib51.patch | 64 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 +- 5 files changed, 83 insertions(+), 41 deletions(-) delete mode 100644 pkgs/applications/graphics/sxiv/146.patch create mode 100644 pkgs/development/libraries/imlib2/giflib51.patch diff --git a/pkgs/applications/graphics/sxiv/146.patch b/pkgs/applications/graphics/sxiv/146.patch deleted file mode 100644 index ad1b030e1a46..000000000000 --- a/pkgs/applications/graphics/sxiv/146.patch +++ /dev/null @@ -1,25 +0,0 @@ -From b901236261dc717dc08ed10f63e2d5cd3f3031f8 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Bart=C5=82omiej=20Piotrowski?= -Date: Tue, 27 May 2014 11:46:06 +0200 -Subject: [PATCH] Fix build with giflib >= 5.1.0. - ---- - image.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/image.c b/image.c -index e62a69f..7eec544 100644 ---- a/image.c -+++ b/image.c -@@ -278,7 +278,11 @@ bool img_load_gif(img_t *img, const fileinfo_t *file) - } - } while (rec != TERMINATE_RECORD_TYPE); - -+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5 && GIFLIB_MINOR >= 1 -+ DGifCloseFile(gif, NULL); -+#else - DGifCloseFile(gif); -+#endif - - if (err && !file->loaded) - warn("corrupted gif file: %s", file->name); diff --git a/pkgs/applications/graphics/sxiv/default.nix b/pkgs/applications/graphics/sxiv/default.nix index b62bbb57f642..e7e52f91b499 100644 --- a/pkgs/applications/graphics/sxiv/default.nix +++ b/pkgs/applications/graphics/sxiv/default.nix @@ -1,20 +1,21 @@ -{ stdenv, fetchurl, libX11, imlib2, giflib }: +{ stdenv, fetchgit, libX11, imlib2, giflib, libexif }: stdenv.mkDerivation rec { - name = "sxiv-1.2"; + version = "1.3-git"; + name = "sxiv-${version}"; - src = fetchurl { - url = "https://github.com/muennich/sxiv/archive/v1.2.tar.gz"; - name = "${name}.tar.gz"; - sha256 = "1wwcxy2adc67xd8x6c2sayy1cjcwrv2lvv1iwln7y4w992gbcxmc"; + src = fetchgit { + url = "git@github.com:muennich/sxiv.git"; + rev = "f55d9f4283f7133ab5a137fc04ee19d1df62fafb"; + sha256 = "85f734f40fdc837514b72694de12bac92fe130286fa6f1dc374e94d575ca8280"; }; - patches = [ ./146.patch ]; - - buildInputs = [ libX11 imlib2 giflib ]; - - prePatch = ''sed -i "s@/usr/local@$out@" Makefile''; + postUnpack = '' + substituteInPlace $sourceRoot/Makefile \ + --replace /usr/local $out + ''; + buildInputs = [ libX11 imlib2 giflib libexif ]; meta = { description = "Simple X Image Viewer"; homepage = "https://github.com/muennich/sxiv"; diff --git a/pkgs/development/libraries/imlib2/default.nix b/pkgs/development/libraries/imlib2/default.nix index 5b19323f9434..53f978551cdd 100644 --- a/pkgs/development/libraries/imlib2/default.nix +++ b/pkgs/development/libraries/imlib2/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, x11, libjpeg, libtiff, libungif, libpng, bzip2, pkgconfig }: +{ stdenv, fetchurl, x11, libjpeg, libtiff, giflib, libpng, bzip2, pkgconfig }: stdenv.mkDerivation rec { name = "imlib2-1.4.6"; @@ -8,10 +8,14 @@ stdenv.mkDerivation rec { sha256 = "0x1j0ylpclkp8cfpwfpkjywqz124bqskyxbw8pvwzkv2gmrbwldg"; }; - buildInputs = [ x11 libjpeg libtiff libungif libpng bzip2 ]; + buildInputs = [ x11 libjpeg libtiff giflib libpng bzip2 ]; nativeBuildInputs = [ pkgconfig ]; + # From + # https://github.com/PhantomX/slackbuilds/blob/master/imlib2/patches/imlib2-giflib51.patch + patches = [ ./giflib51.patch ]; + preConfigure = '' substituteInPlace imlib2-config.in \ --replace "@my_libs@" "" diff --git a/pkgs/development/libraries/imlib2/giflib51.patch b/pkgs/development/libraries/imlib2/giflib51.patch new file mode 100644 index 000000000000..97eaeb0b96e6 --- /dev/null +++ b/pkgs/development/libraries/imlib2/giflib51.patch @@ -0,0 +1,64 @@ +diff -ruN imlib2-1.4.6.orig/src/modules/loaders/loader_gif.c imlib2-1.4.6/src/modules/loaders/loader_gif.c +--- imlib2-1.4.6.orig/src/modules/loaders/loader_gif.c 2013-12-21 10:16:10.000000000 +0000 ++++ imlib2-1.4.6/src/modules/loaders/loader_gif.c 2014-05-27 09:52:35.857291512 +0000 +@@ -36,7 +36,7 @@ + #endif + if (fd < 0) + return 0; +- gif = DGifOpenFileHandle(fd); ++ gif = DGifOpenFileHandle(fd, NULL); + if (!gif) + { + close(fd); +@@ -60,13 +60,13 @@ + h = gif->Image.Height; + if (!IMAGE_DIMENSIONS_OK(w, h)) + { +- DGifCloseFile(gif); ++ DGifCloseFile(gif, NULL); + return 0; + } + rows = malloc(h * sizeof(GifRowType *)); + if (!rows) + { +- DGifCloseFile(gif); ++ DGifCloseFile(gif, NULL); + return 0; + } + for (i = 0; i < h; i++) +@@ -78,7 +78,7 @@ + rows[i] = malloc(w * sizeof(GifPixelType)); + if (!rows[i]) + { +- DGifCloseFile(gif); ++ DGifCloseFile(gif, NULL); + for (i = 0; i < h; i++) + { + if (rows[i]) +@@ -150,7 +150,7 @@ + im->data = (DATA32 *) malloc(sizeof(DATA32) * w * h); + if (!im->data) + { +- DGifCloseFile(gif); ++ DGifCloseFile(gif, NULL); + free(rows); + return 0; + } +@@ -181,7 +181,7 @@ + last_per = (int)per; + if (!(progress(im, (int)per, 0, last_y, w, i))) + { +- DGifCloseFile(gif); ++ DGifCloseFile(gif, NULL); + for (i = 0; i < h; i++) + { + free(rows[i]); +@@ -198,7 +198,7 @@ + { + progress(im, 100, 0, last_y, w, h); + } +- DGifCloseFile(gif); ++ DGifCloseFile(gif, NULL); + for (i = 0; i < h; i++) + { + free(rows[i]); \ No newline at end of file diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index acc4be8c410b..2559032b07eb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10447,9 +10447,7 @@ let }) ); - sxiv = callPackage ../applications/graphics/sxiv { - giflib = giflib_5_0; - }; + sxiv = callPackage ../applications/graphics/sxiv { }; bittorrentSync = callPackage ../applications/networking/bittorrentsync { };