On Tue, Nov 08, 2016 at 06:56:45PM -0500, Jiri B wrote: > Hi, > > an update of unpaper, it needs now libav which is part of ffmpeg. > > I tooks diffs from pkgsrc who use ffmpeg and not libav directly. > I can't comment those diff but it works for me on amd64.
I don't like adding random patches without an explanation about what they do. > I removed README as it was useless anyway and new doc files are > markdown-based so I did not include them. > > I'v tried my best ;) You are probably missing a bdep on textproc/libxslt for xsltproc. HOMEPAGE should be set to https://www.flameeyes.eu/projects/unpaper NO_TEST sould be removed and oh by the way, all tests fail so you need to have a look at that. It's a good start though ;-) > Index: Makefile > =================================================================== > RCS file: /cvs/ports/print/unpaper/Makefile,v > retrieving revision 1.4 > diff -u -p -r1.4 Makefile > --- Makefile 10 May 2014 07:42:47 -0000 1.4 > +++ Makefile 8 Nov 2016 23:52:18 -0000 > @@ -2,31 +2,29 @@ > > COMMENT= post-processing tool for scanned paper sheets > > -DISTNAME= unpaper-0.3 > +DISTNAME= unpaper-6.1 > > CATEGORIES= print graphics > > -HOMEPAGE= http://unpaper.berlios.de/ > +HOMEPAGE= https://github.com/Flameeyes/unpaper > > 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/ > > NO_TEST= Yes > +EXTRACT_SUFX= .tar.xz > > -do-build: > - cd ${WRKSRC} && \ > - ${CC} ${CFLAGS} -lm -o unpaper src/unpaper.c > +CONFIGURE_STYLE= gnu > +LIB_DEPENDS= graphics/ffmpeg > > do-install: > ${INSTALL_PROGRAM} ${WRKBUILD}/unpaper ${PREFIX}/bin > - ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/unpaper > - ${INSTALL_DATA} ${WRKSRC}/README \ > - ${PREFIX}/share/doc/unpaper > + ${INSTALL_MAN} ${WRKBUILD}/unpaper.1 ${PREFIX}/man/man1/unpaper.1 > > .include <bsd.port.mk> > Index: distinfo > =================================================================== > RCS file: /cvs/ports/print/unpaper/distinfo,v > retrieving revision 1.2 > diff -u -p -r1.2 distinfo > --- distinfo 18 Jan 2015 03:14:58 -0000 1.2 > +++ distinfo 8 Nov 2016 23:52:18 -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 8 Nov 2016 23:52:18 -0000 > @@ -0,0 +1,92 @@ > +$OpenBSD$ > + > +From pkgsrc-wip > + > +--- file.c.orig Sun Oct 26 23:35:38 2014 > ++++ file.c Tue Nov 8 20:13:38 2016 > +@@ -105,7 +105,7 @@ void loadImage(const char *filename, AVFrame **image) > + case AV_PIX_FMT_RGB24: > + case AV_PIX_FMT_MONOBLACK: > + case AV_PIX_FMT_MONOWHITE: > +- *image = frame; > ++ *image = av_frame_clone(frame); > + break; > + > + case AV_PIX_FMT_PAL8: > +@@ -123,6 +123,10 @@ void loadImage(const char *filename, AVFrame **image) > + default: > + errOutput("unable to open file %s: unsupported pixel format", > filename); > + } > ++ > ++ avcodec_close(avctx); > ++ av_free(avctx); > ++ avformat_close_input(&s); > + } > + > + > +@@ -134,13 +138,14 @@ void loadImage(const char *filename, AVFrame **image) > + * @param type filetype of the image to save > + * @return true on success, false on failure > + */ > +-void saveImage(char *filename, AVFrame *image, int outputPixFmt) { > ++void saveImage(char *filename, AVFrame *input, int outputPixFmt) { > + AVOutputFormat *fmt = NULL; > + enum AVCodecID output_codec = -1; > + AVCodec *codec; > + AVFormatContext *out_ctx; > + AVCodecContext *codec_ctx; > + AVStream *video_st; > ++ AVFrame *output = input; > + int ret; > + char errbuff[1024]; > + > +@@ -174,13 +179,11 @@ void saveImage(char *filename, AVFrame *image, int out > + break; > + } > + > +- if ( image->format != outputPixFmt ) { > +- AVFrame *output; > +- initImage(&output, image->width, image->height, > ++ if ( input->format != outputPixFmt ) { > ++ initImage(&output, input->width, input->height, > + outputPixFmt, -1); > +- copyImageArea(0, 0, image->width, image->height, > +- image, 0, 0, output); > +- image = output; > ++ copyImageArea(0, 0, input->width, input->height, > ++ input, 0, 0, output); > + } > + > + codec = avcodec_find_encoder(output_codec); > +@@ -194,9 +197,9 @@ void saveImage(char *filename, AVFrame *image, int out > + } > + > + codec_ctx = video_st->codec; > +- codec_ctx->width = image->width; > +- codec_ctx->height = image->height; > +- codec_ctx->pix_fmt = image->format; > ++ codec_ctx->width = output->width; > ++ codec_ctx->height = output->height; > ++ codec_ctx->pix_fmt = output->format; > + video_st->time_base.den = codec_ctx->time_base.den = 1; > + video_st->time_base.num = codec_ctx->time_base.num = 1; > + > +@@ -221,7 +224,7 @@ void saveImage(char *filename, AVFrame *image, int out > + av_init_packet(&pkt); > + > + /* encode the image */ > +- ret = avcodec_encode_video2(video_st->codec, &pkt, image, &got_packet); > ++ ret = avcodec_encode_video2(video_st->codec, &pkt, output, &got_packet); > + > + if (ret < 0) { > + av_strerror(ret, errbuff, sizeof(errbuff)); > +@@ -237,6 +240,9 @@ void saveImage(char *filename, AVFrame *image, int out > + > + avio_close(out_ctx->pb); > + av_free(out_ctx); > ++ > ++ if ( output != input ) > ++ av_frame_free(&output); > + } > + > + /** > Index: patches/patch-unpaper_c > =================================================================== > RCS file: patches/patch-unpaper_c > diff -N patches/patch-unpaper_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-unpaper_c 8 Nov 2016 23:52:18 -0000 > @@ -0,0 +1,15 @@ > +$OpenBSD$ > + > +From pkgsrc-wip > + > +--- unpaper.c.orig Sun Oct 26 22:43:51 2014 > ++++ unpaper.c Tue Nov 8 20:13:20 2016 > +@@ -367,7 +367,7 @@ int main(int argc, char* argv[]) { > + { NULL, no_argument, NULL, 0 } > + }; > + > +- c = getopt_long_only(argc, argv, > "hVl:S:x::n::M:s:z:p:m:W:B:w:b:Tt:qv", > ++ c = getopt_long(argc, argv, "hVl:S:x::n::M:s:z:p:m:W:B:w:b:Tt:qv", > + long_options, &option_index); > + if (c == -1) > + break; > Index: pkg/PLIST > =================================================================== > RCS file: /cvs/ports/print/unpaper/pkg/PLIST,v > retrieving revision 1.1.1.1 > diff -u -p -r1.1.1.1 PLIST > --- pkg/PLIST 17 Jul 2010 07:59:37 -0000 1.1.1.1 > +++ pkg/PLIST 8 Nov 2016 23:52:18 -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 > -- Antoine