From 27030bf87d044539aa6f7f16280d648ac2ecfa36 Mon Sep 17 00:00:00 2001 From: Kai Knoblich Date: Sun, 8 Sep 2019 12:13:40 +0000 Subject: [PATCH] graphics/unpaper: Update to 6.1 * Add an additional patch that fixes the unpaper's usage for the libav/ffmpeg API. [1] * Remove the DOCS option as nearly all files are now in Markdown format and the relevant info has been transferred into the unpaper(1) manpage. * Take maintainership Notable changes since 0.3: * Use libav for both input and output of files, rather than custom code. This adds support for many different input file formats outside of PPM/PBM/PGM, as long as libav can redconduct them to a pixel format that is implemented. * Implementation of mathematically accurate interpolation, using cubic algorithm by default. * Options are now documented in the unpaper(1) man page, rather than in the code. https://github.com/Flameeyes/unpaper/blob/unpaper-6.1/NEWS Obtained from: Debian [1] --- graphics/unpaper/Makefile | 28 ++++++++++++--------------- graphics/unpaper/distinfo | 5 +++-- graphics/unpaper/files/patch-file.c | 30 +++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 18 deletions(-) create mode 100644 graphics/unpaper/files/patch-file.c diff --git a/graphics/unpaper/Makefile b/graphics/unpaper/Makefile index 5ac1a001b245..1c523f72c44e 100644 --- a/graphics/unpaper/Makefile +++ b/graphics/unpaper/Makefile @@ -2,31 +2,27 @@ # $FreeBSD$ PORTNAME= unpaper -PORTVERSION= 0.3 +PORTVERSION= 6.1 CATEGORIES= graphics MASTER_SITES= https://www.flameeyes.eu/files/ -MAINTAINER= ports@FreeBSD.org +MAINTAINER= kai@FreeBSD.org COMMENT= Post-processing tool for scanned sheets of paper LICENSE= GPLv2 -LICENSE_FILE= ${WRKSRC}/LICENSE +LICENSE_FILE= ${WRKSRC}/COPYING -PORTDOCS= * -PLIST_FILES= bin/${PORTNAME} +BUILD_DEPENDS= xsltproc:textproc/libxslt \ + bash:shells/bash +LIB_DEPENDS= libavcodec.so:multimedia/ffmpeg \ + libavformat.so:multimedia/ffmpeg \ + libavutil.so:multimedia/ffmpeg -OPTIONS_DEFINE= DOCS +USES= autoreconf pkgconfig tar:xz -do-build: - @${CC} ${CFLAGS} -o ${WRKSRC}/${PORTNAME} \ - ${WRKSRC}/src/${PORTNAME}.c -lm +GNU_CONFIGURE= yes -do-install: - ${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin - -do-install-DOCS-on: - @${MKDIR} ${STAGEDIR}${DOCSDIR} - @cd ${WRKSRC}/ && ${INSTALL_DATA} CHANGELOG README ${STAGEDIR}${DOCSDIR} - @cd ${WRKSRC}/doc/ && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR} +PLIST_FILES= bin/${PORTNAME} \ + man/man1/${PORTNAME}.1.gz .include diff --git a/graphics/unpaper/distinfo b/graphics/unpaper/distinfo index 9021174aa58d..16e5a9c01cd8 100644 --- a/graphics/unpaper/distinfo +++ b/graphics/unpaper/distinfo @@ -1,2 +1,3 @@ -SHA256 (unpaper-0.3.tar.gz) = 3433664040942bf7638946e2327e5c64119c600fde8ace918f47109fafbde5be -SIZE (unpaper-0.3.tar.gz) = 546488 +TIMESTAMP = 1565468288 +SHA256 (unpaper-6.1.tar.xz) = 237c84f5da544b3f7709827f9f12c37c346cdf029b1128fb4633f9bafa5cb930 +SIZE (unpaper-6.1.tar.xz) = 2655724 diff --git a/graphics/unpaper/files/patch-file.c b/graphics/unpaper/files/patch-file.c new file mode 100644 index 000000000000..aa8bbf6368fb --- /dev/null +++ b/graphics/unpaper/files/patch-file.c @@ -0,0 +1,30 @@ +Subject: Fix wrong ffmpeg API usage +Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=800312 +Bug: https://github.com/Flameeyes/unpaper/issues/39 +Author: Andreas Cadhalpun +Forwarded: https://github.com/Flameeyes/unpaper/pull/42 + +--- file.c.orig 2014-10-26 22:35:38 UTC ++++ file.c +@@ -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) {