commit:     73517ac75958a14ba307612decaae65a0c30699e
Author:     ChaosEngine <andrzej.pauli <AT> gmail <DOT> com>
AuthorDate: Mon Nov 21 15:25:39 2016 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sat Nov 26 11:06:27 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=73517ac7

media-video/qgifer: Port codebase to >=media-libs/giflib-5.1

Gentoo-bug: 536634
Closes: https://github.com/gentoo/gentoo/pull/2881

 .../qgifer/files/qgifer-0.2.1-giflib5.patch        | 157 +++++++++++++++++++++
 media-video/qgifer/qgifer-0.2.1-r5.ebuild          |  50 +++++++
 2 files changed, 207 insertions(+)

diff --git a/media-video/qgifer/files/qgifer-0.2.1-giflib5.patch 
b/media-video/qgifer/files/qgifer-0.2.1-giflib5.patch
new file mode 100644
index 00000000..9ddfdac
--- /dev/null
+++ b/media-video/qgifer/files/qgifer-0.2.1-giflib5.patch
@@ -0,0 +1,157 @@
+Port qgifer to giflib 5 API.
+See also: https://bugs.gentoo.org/show_bug.cgi?id=536634
+
+--- a/src/gifcreator.cpp
++++ b/src/gifcreator.cpp
+@@ -38,7 +38,7 @@
+                   j--;
+              }
+      for(int i=0;i<cmaps.size();i++)
+-        FreeMapObject(cmaps[i]);
++        GifFreeMapObject(cmaps[i]);
+ }
+ 
+ 
+@@ -52,7 +52,7 @@
+      }
+   
+   
+-     GifFileType *GifFile = EGifOpenFileName(filename, FALSE);
++     GifFileType *GifFile = EGifOpenFileName(filename, 0, NULL);
+   
+      if (!GifFile){
+         PrintGifError();
+@@ -74,7 +74,7 @@
+      {
+         char nsle[12] = "NETSCAPE2.0";
+         char subblock[3];
+-        if (EGifPutExtensionFirst(GifFile, APPLICATION_EXT_FUNC_CODE, 11, 
nsle) == GIF_ERROR) {
++        if (EGifPutExtension(GifFile, APPLICATION_EXT_FUNC_CODE, 11, nsle) == 
GIF_ERROR) {
+              PrintGifError();
+              return false;
+         }
+@@ -82,7 +82,7 @@
+         subblock[2] = loop_count % 256;
+         subblock[1] = loop_count / 256;
+ 
+-        if (EGifPutExtensionLast(GifFile, APPLICATION_EXT_FUNC_CODE, 3, 
subblock) == GIF_ERROR) {
++        if (EGifPutExtension(GifFile, APPLICATION_EXT_FUNC_CODE, 3, subblock) 
== GIF_ERROR) {
+              PrintGifError();
+              return false;
+         }
+@@ -111,7 +111,7 @@
+             
+         if (EGifPutImageDesc(
+                  GifFile,
+-                 0, 0, w, h, FALSE, cmaps.size() > ni ? cmaps.at(ni) : 
cmaps.at(cmaps.size()-1)
++                 0, 0, w, h, 0, cmaps.size() > ni ? cmaps.at(ni) : 
cmaps.at(cmaps.size()-1)
+                  ) == GIF_ERROR) {
+              PrintGifError();
+              endProgress();
+@@ -135,7 +135,7 @@
+         return false;
+      }
+    
+-     if (EGifCloseFile(GifFile) == GIF_ERROR) {
++     if (EGifCloseFile(GifFile, NULL) == GIF_ERROR) {
+         PrintGifError();
+         endProgress();
+         return false;
+--- a/src/gifcreator.h
++++ b/src/gifcreator.h
+@@ -31,6 +31,12 @@
+ typedef vector<GifByteType> Frame;
+ typedef unsigned char Byte;
+ 
++static inline void
++PrintGifError()
++{
++      fprintf(stderr, "\nGIF-LIB error: %s.\n", GifErrorString(GIF_ERROR));
++}
++
+ class GifCreator
+ {
+ 
+--- a/src/palettewidget.cpp
++++ b/src/palettewidget.cpp
+@@ -34,7 +34,7 @@
+ 
+ PaletteWidget::~PaletteWidget()
+ {
+-     FreeMapObject(palette);
++     GifFreeMapObject(palette);
+ }
+ 
+ void PaletteWidget::paintEvent(QPaintEvent*)
+@@ -117,7 +117,7 @@
+      if(palette && mindiff > 1)
+      {
+         qDebug() << "deleting old palette, size: " << size << ", colors: " << 
palette->ColorCount;
+-        FreeMapObject(palette);
++        GifFreeMapObject(palette);
+         qDebug() << "done";
+         palette = NULL;
+      }
+@@ -157,7 +157,7 @@
+      }
+ 
+      ColorMapObject* previous = palette;
+-     palette = MakeMapObject(size, NULL);
++     palette = GifMakeMapObject(size, NULL);
+      if (!palette) 
+      {
+         qDebug() << "NULL palette!";
+@@ -165,7 +165,7 @@
+      }
+      
+ 
+-     if (QuantizeBuffer(fimg.width(), fimg.height(), &size, 
++     if (GifQuantizeBuffer(fimg.width(), fimg.height(), &size, 
+                       &(r[0]),&(g[0]),&(b[0]), &(output[0]), 
+                       palette->Colors) == GIF_ERROR) 
+      {
+@@ -178,11 +178,11 @@
+      //qDebug() << "difference: " << df;
+      if(previous && df < mindiff)
+      {
+-        FreeMapObject(palette);
++        GifFreeMapObject(palette);
+         palette = previous;
+      }
+      else if(df >= mindiff)
+-        FreeMapObject(previous);
++        GifFreeMapObject(previous);
+ 
+      // qDebug() << "palette (" << palette->ColorCount << ") :";
+      // for(int i=0;i<size;i++)
+@@ -230,8 +230,8 @@
+ {
+      QStringList rgb = QString(str).split(";", QString::SkipEmptyParts);
+      if(palette)
+-        FreeMapObject(palette);
+-     palette = MakeMapObject(rgb.size(), NULL);
++        GifFreeMapObject(palette);
++     palette = GifMakeMapObject(rgb.size(), NULL);
+      if(!palette)
+         return false;
+      size = rgb.size();
+--- a/src/palettewidget.h
++++ b/src/palettewidget.h
+@@ -30,7 +30,7 @@
+      PaletteWidget(QWidget* parent=0, Qt::WindowFlags f=0);
+      virtual ~PaletteWidget();
+      ColorMapObject* map() {return palette;}
+-     ColorMapObject* mapCopy() {return MakeMapObject(palette->ColorCount, 
palette->Colors);}
++     ColorMapObject* mapCopy() {return GifMakeMapObject(palette->ColorCount, 
palette->Colors);}
+      bool fromImage(const QImage& img, int palette_size, float mindiff = 2);
+      void setColumnCount(int cc){cols = cc;}
+      bool toFile(const QString& path);
+@@ -38,7 +38,7 @@
+      QString toString();
+      bool fromString(const QString& str);
+      int getSize() const {return size;}
+-     void clear() {if(palette) FreeMapObject(palette); palette = NULL; 
update();}
++     void clear() {if(palette) GifFreeMapObject(palette); palette = NULL; 
update();}
+ private:
+      int size;
+      int cols;

diff --git a/media-video/qgifer/qgifer-0.2.1-r5.ebuild 
b/media-video/qgifer/qgifer-0.2.1-r5.ebuild
new file mode 100644
index 00000000..554e243
--- /dev/null
+++ b/media-video/qgifer/qgifer-0.2.1-r5.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit cmake-utils
+
+DESCRIPTION="A video-based animated GIF creator"
+HOMEPAGE="https://sourceforge.net/projects/qgifer/";
+SRC_URI="mirror://sourceforge/${PN}/${P}-source.tar.gz"
+
+LICENSE="GPL-3+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+IUSE="debug imagemagick opencv3"
+
+RDEPEND="
+       >=media-libs/giflib-5.1:=
+       dev-qt/qtcore:4
+       dev-qt/qtgui:4
+       virtual/ffmpeg:0
+       imagemagick? ( media-gfx/imagemagick:0 )
+       !opencv3? ( <media-libs/opencv-3.0.0:0=[ffmpeg] )
+       opencv3? ( >=media-libs/opencv-3.0.0:0=[ffmpeg] )"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}/${P}-source"
+
+PATCHES=(
+       "${FILESDIR}/${P}-desktop.patch"
+       # Port to giflib 5 API
+       "${FILESDIR}/${P}-giflib5.patch"
+)
+
+src_prepare(){
+       use opencv3 && PATCHES+=( "${FILESDIR}/${P}-opencv3.patch" )
+       cmake-utils_src_prepare
+
+       # Fix the doc path
+       sed -i -e "s|share/doc/qgifer|share/doc/${PF}|" CMakeLists.txt || die
+}
+
+src_configure() {
+       local mycmakeargs=(
+                $(usex debug '-DRELEASE_MODE=OFF' '')
+       )
+       cmake-utils_src_configure
+}

Reply via email to