From 74fc0c6f2d5998e99a18036f64ca9e17fa60d63f Mon Sep 17 00:00:00 2001
From: Michael Hanson <hansonorders@verizon.net>
Date: Fri, 12 Nov 2010 00:04:34 +0000
Subject: mjpegtools: bump for sdl

---
 abs/core/mjpegtools/PKGBUILD                       | 42 ++++++++++++++--------
 .../mjpegtools/mjpegtools-1.9.0-glibc-2.10.patch   | 11 ++++++
 abs/core/mjpegtools/mjpegtools-1.9.0-jpeg-7.patch  | 24 +++++++++++++
 abs/core/mjpegtools/mjpegtools.install             | 16 +++++++++
 abs/core/mjpegtools/png2yuv-fix-memleak.patch      | 10 ++++++
 5 files changed, 88 insertions(+), 15 deletions(-)
 create mode 100644 abs/core/mjpegtools/mjpegtools-1.9.0-glibc-2.10.patch
 create mode 100644 abs/core/mjpegtools/mjpegtools-1.9.0-jpeg-7.patch
 create mode 100644 abs/core/mjpegtools/mjpegtools.install
 create mode 100644 abs/core/mjpegtools/png2yuv-fix-memleak.patch

diff --git a/abs/core/mjpegtools/PKGBUILD b/abs/core/mjpegtools/PKGBUILD
index 13c9061..bf31ebf 100644
--- a/abs/core/mjpegtools/PKGBUILD
+++ b/abs/core/mjpegtools/PKGBUILD
@@ -1,29 +1,41 @@
-# $Id: PKGBUILD 356 2008-04-18 22:56:27Z aaron $
+# $Id: PKGBUILD 84755 2010-07-04 03:32:01Z eric $
 # Contributor: Damir Perisa <damir.perisa@bluewin.ch>
 # Mantainer: Roberto Carvajal <roberto@archlinux.org>
 
 pkgname=mjpegtools
 pkgver=1.9.0
-pkgrel=11
-pkgdesc="The mjpeg programs are a set of tools that can do recording of videos and playback, simple cut-and-paste editing and the MPEG compression of audio and video under Linux. "
+pkgrel=12
+pkgdesc="Set of tools that can do recording of videos and playback, simple cut-and-paste editing and the MPEG compression of audio and video"
 arch=(i686 x86_64)
 license=('GPL')
 url="http://mjpeg.sourceforge.net/"
-depends=('libpng' 'sdl' 'gcc' 'libdv' 'libjpeg6')
-makedepends=('gtk2' 'libjpeg6')
+depends=('libjpeg>=8' 'libpng>=1.4.0' 'sdl' 'gcc-libs' 'libdv' 'libjpeg6')
+makedepends=('gtk2>=2.18.6')
+optdepends=('gtk2: glav GUI')
 options=('!makeflags' '!libtool')
+install=mjpegtools.install
 source=(http://downloads.sourceforge.net/sourceforge/mjpeg/${pkgname}-${pkgver}.tar.gz
-	mjpegtools-1.8.0-gcc41.patch)
+        mjpegtools-1.9.0-glibc-2.10.patch
+        png2yuv-fix-memleak.patch
+        mjpegtools-1.9.0-jpeg-7.patch)
+md5sums=('309a6fcf0900a010d6a9c1e91afc2f5c' 'b8ae66237d83be533db8eea166fd3357'\
+         '39e1def8fb0f7c58a217b22dc251a86a' 'ccc7562a3933877d3362da7cf4695ea0')
+sha1sums=('1701233354c7ea86b5b7808c4dd5d03a71118e48' '3029f0e835e693b144298ed9f8143c9566be26f3'\
+         '8af5c3747756353bef56d03bafbdd086ff15c02c' '2bdb1b3b8591cede11d4a133a758e8ead35db4dd')
 
 build() {
-  cd ${startdir}/src/${pkgname}-${pkgver}
- # patch -Np1 -i ${startdir}/src/mjpegtools-1.8.0-gcc41.patch || return 1
-env CPPFLAGS="-I/opt/libjpeg6/include" LDFLAGS="-L/opt/libjpeg6/lib"   ./configure --prefix=/usr  --enable-static-build 
-  find -name Makefile -exec sed -i -e 's:-march=k8 -mtune=k8::' -e 's:-march=pentium3 -mtune=pentium3::' {} \;
-
-  make || return 1
-  make DESTDIR=${startdir}/pkg install
+  cd "${srcdir}/${pkgname}-${pkgver}"
+  sed -i -e '/ARCHFLAGS=/s:=.*:=:' configure
+  patch -Np1 -i "$srcdir/mjpegtools-1.9.0-glibc-2.10.patch"
+  patch -Np1 -i "${srcdir}/png2yuv-fix-memleak.patch"
+  patch -Np0 -i "${srcdir}/mjpegtools-1.9.0-jpeg-7.patch"
+  env CPPFLAGS="-I/opt/libjpeg6/include" LDFLAGS="-L/opt/libjpeg6/lib"
+  ./configure --prefix=/usr --enable-largefile
+  make
+}
 
-  install -m644 mpeg2enc/mpeg2syntaxcodes.h \
-      ${startdir}/pkg/usr/include/mjpegtools/mpeg2enc/
+package() {
+  cd "${srcdir}/${pkgname}-${pkgver}"
+  make DESTDIR="${pkgdir}" install
+  install -m644 mpeg2enc/mpeg2syntaxcodes.h "${pkgdir}/usr/include/mjpegtools/mpeg2enc/"
 }
diff --git a/abs/core/mjpegtools/mjpegtools-1.9.0-glibc-2.10.patch b/abs/core/mjpegtools/mjpegtools-1.9.0-glibc-2.10.patch
new file mode 100644
index 0000000..e161560
--- /dev/null
+++ b/abs/core/mjpegtools/mjpegtools-1.9.0-glibc-2.10.patch
@@ -0,0 +1,11 @@
+--- mjpegtools-1.9.0/mplex/lpcmstrm_in.cpp.orig	2009-05-27 01:31:46.000000000 -0700
++++ mjpegtools-1.9.0/mplex/lpcmstrm_in.cpp	2009-05-27 01:33:09.000000000 -0700
+@@ -53,7 +53,7 @@
+ 
+ bool LPCMStream::Probe(IBitStream &bs )
+ {
+-    char *last_dot = strrchr( bs.StreamName(), '.' );
++    const char *last_dot = strrchr( bs.StreamName(), '.' );
+     return 
+         last_dot != NULL 
+         && strcmp( last_dot+1, "lpcm") == 0;
diff --git a/abs/core/mjpegtools/mjpegtools-1.9.0-jpeg-7.patch b/abs/core/mjpegtools/mjpegtools-1.9.0-jpeg-7.patch
new file mode 100644
index 0000000..ec36731
--- /dev/null
+++ b/abs/core/mjpegtools/mjpegtools-1.9.0-jpeg-7.patch
@@ -0,0 +1,24 @@
+Fix segmentation fault with jpeg-7 and above where dinfo.do_fancy_upsampling isn't set by default to FALSE anymore.
+
+Patch by: Salah Coronya
+
+http://bugs.gentoo.org/show_bug.cgi?id=293919
+
+--- lavtools/jpegutils.c
++++ lavtools/jpegutils.c
+@@ -502,6 +502,7 @@
+ 
+    jpeg_read_header (&dinfo, TRUE);
+    dinfo.raw_data_out = TRUE;
++   dinfo.do_fancy_upsampling = FALSE;
+    dinfo.out_color_space = JCS_YCbCr;
+    dinfo.dct_method = JDCT_IFAST;
+    guarantee_huff_tables(&dinfo);
+@@ -599,6 +600,7 @@
+       if (field > 0) {
+          jpeg_read_header (&dinfo, TRUE);
+          dinfo.raw_data_out = TRUE;
++         dinfo.do_fancy_upsampling = FALSE;
+          dinfo.out_color_space = JCS_YCbCr;
+          dinfo.dct_method = JDCT_IFAST;
+          jpeg_start_decompress (&dinfo);
diff --git a/abs/core/mjpegtools/mjpegtools.install b/abs/core/mjpegtools/mjpegtools.install
new file mode 100644
index 0000000..1ef7d6f
--- /dev/null
+++ b/abs/core/mjpegtools/mjpegtools.install
@@ -0,0 +1,16 @@
+infodir=/usr/share/info
+file=mjpeg-howto.info
+
+post_install() {
+  [ -x usr/bin/install-info ] || return 0
+  install-info $infodir/$file.gz $infodir/dir 2> /dev/null
+}
+
+post_upgrade() {
+  post_install $1
+}
+
+pre_remove() {
+  [ -x usr/bin/install-info ] || return 0
+  install-info --delete $infodir/$file.gz $infodir/dir 2> /dev/null
+}
diff --git a/abs/core/mjpegtools/png2yuv-fix-memleak.patch b/abs/core/mjpegtools/png2yuv-fix-memleak.patch
new file mode 100644
index 0000000..a6f03a4
--- /dev/null
+++ b/abs/core/mjpegtools/png2yuv-fix-memleak.patch
@@ -0,0 +1,10 @@
+--- mjpegtools-1.9.0/lavtools/png2yuv.c.orig	2010-01-17 14:26:24.000000000 +0100
++++ mjpegtools-1.9.0/lavtools/png2yuv.c	2010-01-17 14:27:53.000000000 +0100
+@@ -407,6 +407,7 @@
+     return 2;
+     }
+ 
++  png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
+   fclose(pngfile);
+ 
+   return 1;
-- 
cgit v0.12

