> Agreed. And I'm not sure the unpaper.c patch is needed. There's another
> version of the ffmpeg patch at https://github.com/Flameeyes/unpaper/pull/42
> but nothing committed upstream.

That one is definitely better.
It prevents erroring out with:
unpaper: error: unable to open file ./tests/imgsrc001.png: unsupported pixel 
format

> This fixes a bunch of them:
> 
> TEST_DEPENDS=   sysutils/coreutils
> 
> pre-test:
>         ln -fs ${LOCALBASE}/bin/gmd5sum ${WRKDIR}/bin/md5sum

Thanks.

New diff.

Index: Makefile
===================================================================
RCS file: /cvs/ports/print/unpaper/Makefile,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 Makefile
--- Makefile    10 May 2014 07:42:47 -0000      1.4
+++ Makefile    9 Nov 2016 16:13:32 -0000
@@ -1,32 +1,34 @@
 # $OpenBSD: Makefile,v 1.4 2014/05/10 07:42:47 ajacoutot Exp $
 
-COMMENT=       post-processing tool for scanned paper sheets
+COMMENT=               post-processing tool for scanned paper sheets
 
-DISTNAME=      unpaper-0.3
+DISTNAME=              unpaper-6.1
 
-CATEGORIES=    print graphics
+CATEGORIES=            print graphics
 
-HOMEPAGE=      http://unpaper.berlios.de/
+HOMEPAGE=              https://www.flameeyes.eu/projects/unpaper
 
-MAINTAINER=    Antoine Jacoutot <ajacou...@openbsd.org>
+MAINTAINER=            Antoine Jacoutot <ajacou...@openbsd.org>
 
 # GPLv2
 PERMIT_PACKAGE_CDROM=  Yes
 
-WANTLIB += c m
+WANTLIB += avcodec avformat avutil c m
 
-MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=unpaper/}
+MASTER_SITES=          https://www.flameeyes.eu/files/
+EXTRACT_SUFX=          .tar.xz
 
-NO_TEST=       Yes
+BUILD_DEPENDS=         textproc/libxslt # xsltproc
+LIB_DEPENDS=           graphics/ffmpeg
+TEST_DEPENDS=          sysutils/coreutils
 
-do-build:
-       cd ${WRKSRC} && \
-               ${CC} ${CFLAGS} -lm -o unpaper src/unpaper.c
+CONFIGURE_STYLE=       gnu
 
-do-install:
-       ${INSTALL_PROGRAM} ${WRKBUILD}/unpaper ${PREFIX}/bin
-       ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/unpaper
-       ${INSTALL_DATA} ${WRKSRC}/README \
-               ${PREFIX}/share/doc/unpaper
+post-install:
+# useless
+       rm -rf ${PREFIX}/share/doc/unpaper
+
+pre-test:
+       ln -fs ${LOCALBASE}/bin/gmd5sum ${WRKDIR}/bin/md5sum
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/print/unpaper/distinfo,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 distinfo
--- distinfo    18 Jan 2015 03:14:58 -0000      1.2
+++ distinfo    9 Nov 2016 16:13:32 -0000
@@ -1,2 +1,2 @@
-SHA256 (unpaper-0.3.tar.gz) = NDNmQECUK/djiUbiMn5cZBGcYA/eis6Rj0cQn6+95b4=
-SIZE (unpaper-0.3.tar.gz) = 546488
+SHA256 (unpaper-6.1.tar.xz) = I3yE9dpUSz93CYJ/nxLDfDRs3wKbESj7RjP5uvpcuTA=
+SIZE (unpaper-6.1.tar.xz) = 2655724
Index: patches/patch-file_c
===================================================================
RCS file: patches/patch-file_c
diff -N patches/patch-file_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-file_c        9 Nov 2016 16:13:32 -0000
@@ -0,0 +1,28 @@
+$OpenBSD$
+
+https://github.com/Flameeyes/unpaper/pull/42
+
+--- file.c.orig        Sun Oct 26 23:35:38 2014
++++ file.c     Wed Nov  9 16:53:16 2016
+@@ -93,10 +93,21 @@ void loadImage(const char *filename, AVFrame **image) 
+     if (pkt.stream_index != 0)
+         errOutput("unable to open file %s: invalid stream.", filename);
+ 
++    while (!got_frame && pkt.data) {
++
++        if (pkt.size <= 0) {
++            pkt.data = NULL;
++            pkt.size = 0;
++        }
++
+     ret = avcodec_decode_video2(avctx, frame, &got_frame, &pkt);
+     if (ret < 0) {
+         av_strerror(ret, errbuff, sizeof(errbuff));
+         errOutput("unable to open file %s: %s", filename, errbuff);
++    }
++
++        pkt.data += ret;
++        pkt.size -= ret;
+     }
+ 
+     switch(frame->format) {
Index: patches/patch-tests_runtestG3_sh
===================================================================
RCS file: patches/patch-tests_runtestG3_sh
diff -N patches/patch-tests_runtestG3_sh
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-tests_runtestG3_sh    9 Nov 2016 16:13:32 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- tests/runtestG3.sh.orig    Wed Nov  9 17:01:15 2016
++++ tests/runtestG3.sh Wed Nov  9 17:01:38 2016
+@@ -8,7 +8,7 @@ set -x
+ rm -f tests/resultsG3.pbm
+ touch tests/resultsG3.pbm
+ 
+-./unpaper -v --no-processing 1 ${srcdir:-.}/tests/imgsrc001.png 
tests/resultsG3.pbm
++./unpaper --overwrite -v --no-processing 1 ${srcdir:-.}/tests/imgsrc001.png 
tests/resultsG3.pbm
+ 
+ [ -s tests/resultsG3.pbm ]
+ 
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/print/unpaper/pkg/PLIST,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 PLIST
--- pkg/PLIST   17 Jul 2010 07:59:37 -0000      1.1.1.1
+++ pkg/PLIST   9 Nov 2016 16:13:32 -0000
@@ -1,4 +1,3 @@
 @comment $OpenBSD: PLIST,v 1.1.1.1 2010/07/17 07:59:37 ajacoutot Exp $
 @bin bin/unpaper
-share/doc/unpaper/
-share/doc/unpaper/README
+@man man/man1/unpaper.1



Reply via email to