6.1 bump from Flameeyes fork

The fork was merged back to the origin.
The 6.1 code does not build with current libav 5.0.

Fix in upstream <https://github.com/unpaper/unpaper/pull/104> requires
too many changes. I will add a rabase on top.
This commit is contained in:
Petr Písař 2022-02-25 14:43:05 +01:00
parent 6ad23905a8
commit c733c7eb9d
7 changed files with 156 additions and 77 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
unpaper-0.3.tar.gz
/unpaper-6.1.tar.xz
/unpaper-6.1.tar.xz.sig

Binary file not shown.

View File

@ -1 +1,2 @@
be41eaf8556e7df39ab53939c99c4f7b unpaper-0.3.tar.gz
SHA512 (unpaper-6.1.tar.xz) = afef705985d3c265672c9e42130acc34befc080c361f3169e299b5110c662d0b9845a9d0ca4fc3aad468f49967ded36fb60ffed296373569dd7337c3cb81e79c
SHA512 (unpaper-6.1.tar.xz.sig) = b1047d94cb521beb95d502f00d24ba47d52fbd5aa327f6ec07e54f1427bcb242af57625dda7fc95039ed34d242f2d6c29449f1e2ffc1d1cc00597c9ae881d40f

View File

@ -1,55 +0,0 @@
diff --git a/src/unpaper.c b/src/unpaper.c
index f967d92..53f55b0 100644
--- a/src/unpaper.c
+++ b/src/unpaper.c
@@ -1,9 +1,9 @@
/* ---------------------------------------------------------------------------
unpaper - written by Jens Gulden 2005-2007 */
-const char* VERSION = "0.3";
+const char VERSION[] = "0.3";
-const char* README =
+const char README[] =
"unpaper is a post-processing tool for scanned sheets of paper, especially for\n"
"book pages that have been scanned from previously created photocopies.\n"
"The main purpose is to make scanned book pages better readable on screen\n"
@@ -29,7 +29,7 @@ const char* README =
"Conversion to PDF can e.g. be achieved with the Linux tools pgm2tiff, tiffcp\n"
"and tiff2pdf.";
-const char* COMPILE =
+const char COMPILE[] =
"gcc -D TIMESTAMP=\"<yyyy-MM-dd HH:mm:ss>\" -lm -O3 -funroll-all-loops -fomit-frame-pointer -ftree-vectorize -o unpaper unpaper.c\n";
/* ------------------------------------------------------------------------ */
@@ -46,17 +46,17 @@ const char* BUILD = TIMESTAMP;
const char* BUILD = NULL;
#endif
-const char* WELCOME =
+const char WELCOME[] =
"unpaper %s - written by Jens Gulden 2005-2007.\n"
"Licensed under the GNU General Public License, this comes with no warranty.\n";
-const char* USAGE =
+const char USAGE[] =
"Usage: unpaper [options] <input-file(s)> <output-file(s)>\n\n"
"Filenames may contain a formatting placeholder starting with '%%' to insert a\n"
"page counter for multi-page processing. E.g.: 'scan%%03d.pbm' to process files\n"
"scan001.pbm, scan002.pbm, scan003.pbm etc.\n";
-const char* OPTIONS =
+const char OPTIONS[] =
"-l --layout single Set default layout options for a sheet:\n"
" |double 'single': One page per sheet.\n"
" |none 'double': Two pages per sheet, landscape\n"
@@ -558,7 +558,7 @@ const char* OPTIONS =
//--help-compile Undocumented.
-const char* HELP =
+const char HELP[] =
"Run 'unpaper --help' for usage information.\n";

View File

@ -0,0 +1,30 @@
From 78480f765f26f4bc2e5ac521fa78ba62bd899213 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Fri, 8 Jul 2016 10:29:29 +0200
Subject: [PATCH] Do not install COPYING into docdir
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
Makefile.am | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 461d7ef..5e518d2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,7 +6,8 @@ unpaper_SOURCES = file.c imageprocess.c imageprocess.h parse.c \
unpaper_CFLAGS = $(LIBAV_CFLAGS)
unpaper_LDADD = $(LIBAV_LIBS)
-dist_doc_DATA = NEWS COPYING README.md AUTHORS
+extra_DIST = COPYING
+dist_doc_DATA = NEWS README.md AUTHORS
dist_man_MANS = unpaper.1
dist_html_DATA = doc/basic-concepts.md doc/image-processing.md \
--
2.5.5

View File

@ -0,0 +1,55 @@
From 89bce4417c35a8cbaa35f5a7451abca3d1c95adc Mon Sep 17 00:00:00 2001
From: Thomas Koch <thomas@koch.ro>
Date: Mon, 28 Sep 2015 07:39:30 +0200
Subject: [PATCH] fix ffmpeg incompatibility
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Thanks to Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> for the patch.
Received 2015-09-28 via debian bug
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=800312
with the following comment:
Not really. unpaper just doesn't use the API correctly.
More specifically, it doesn't make sure it actually got a frame.
The following change makes it work:
Closes: #39
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
file.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/file.c b/file.c
index c92994d..3989447 100644
--- a/file.c
+++ b/file.c
@@ -93,12 +93,23 @@ 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) {
case AV_PIX_FMT_Y400A: // 8-bit grayscale PNG
case AV_PIX_FMT_GRAY8:
--
2.5.5

View File

@ -1,15 +1,40 @@
Name: unpaper
Version: 0.3
Release: 27%{?dist}
Version: 6.1
Release: 1%{?dist}
Summary: Post-processing of scanned and photocopied book pages
# Licensed under any GPL version since none is specified
License: GPL+
URL: http://unpaper.berlios.de/
Source0: http://download.berlios.de/%{name}/%{name}-%{version}.tar.gz
Patch0: unpaper-0.3-format-security.patch
# COPYING: GPLv2 text
# other files: GPLv2
# README.md: GPLv2
## Not in the binary package
# aclocal.m4: FSFULLR and GPLv2+ with Autoconf exception
# configure: FSFUL
# depcomp: GPLv2+ with Autoconf exception
# install-sh: MIT
# Makefile.in: FSFULLR
# missing: GPLv2+ with Autoconf exception
# test-driver: GPLv2+ with Autoconf exception
License: GPLv2
URL: https://www.flameeyes.eu/projects/{%name}
Source0: https://www.flameeyes.eu/files/%{name}-%{version}.tar.xz
Source1: https://www.flameeyes.eu/files/%{name}-%{version}.tar.xz.sig
# A key exported from keyserver <hkp://pgp.surfnet.nl> on 2022-02-25.
Source2: gpgkey-BDAEF3008A1CC62079C2A16847664B94E36B629F.gpg
# Do not put COPYING into docdir, not upstreamable,
Patch0: unpaper-6.1-Do-not-install-COPYING-into-docdir.patch
# Restore compatibility with ffmpeg-2.8,
# <https://github.com/Flameeyes/unpaper/issues/39>
Patch1: unpaper-6.1-fix-ffmpeg-incompatibility.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bash
BuildRequires: coreutils
BuildRequires: gcc
BuildRequires: gnupg2
BuildRequires: pkgconfig(libavcodec)
BuildRequires: pkgconfig(libavformat)
BuildRequires: pkgconfig(libavutil)
BuildRequires: sed
# xsltproc not used, there is no XML source for the manual
%description
unpaper is a post-processing tool for scanned sheets of paper, especially for
@ -17,33 +42,54 @@ book pages that have been scanned from previously created photocopies. The
main purpose is to make scanned book pages better readable on screen after
conversion to PDF. Additionally, unpaper might be useful to enhance the
quality of scanned pages before performing optical character recognition (OCR).
unpaper tries to clean scanned images by removing dark edges that appeared
through scanning or copying on areas outside the actual page content (e.g. dark
areas between the left-hand-side and the right-hand-side of a double- sided
book-page scan). The program also tries to detect misaligned centering and
rotation of pages and will automatically straighten each page by rotating it to
the correct angle. This process is called "deskewing".
areas between the left-hand-side and the right-hand-side of a double-sided
book-page scan).
The program also tries to detect misaligned centering and rotation of pages
and will automatically straighten each page by rotating it to the correct
angle. This process is called "deskewing".
%prep
%setup -q
%patch0 -p1
# fix eol encoding in LICENSE
sed -i -e 's/\r//' LICENSE
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
%autosetup -p1
# Fix end-of-line coding
sed -i -e 's/\r//' COPYING
autoreconf -fi
%build
cd src
gcc $RPM_OPT_FLAGS $RPM_LD_FLAGS -o unpaper unpaper.c -lm
%configure --disable-silent-rules
%{make_build}
%check
# The F and G tests fail. Because of CPU optimizations, resulting image cannot
# be deterministic. Fixed in upstream by commit:
#
# commit 5bdd7acd09675086114b4006eff50b8fe78f95cc
# Author: Diego Elio Pettenò <flameeyes@flameeyes.eu>
# Date: Tue Nov 11 19:31:40 2014 +0000
# Subject: Rewrite tests to use an image comparison binary instead of md5sum.
#
# Because the patch is huge (test data) and the bug is in the tests, not in
# the tool, I will disable tests for now.
#
# make check %{?_smp_mflags}
%install
install -d $RPM_BUILD_ROOT/%{_bindir}
install -p -m 0755 src/unpaper $RPM_BUILD_ROOT/%{_bindir}
%{make_install}
%files
%license LICENSE
%license COPYING
%{_bindir}/*
%doc doc CHANGELOG README
%doc AUTHORS doc NEWS README.md
%changelog
* Fri Feb 25 2022 Petr Pisar <ppisar@redhat.com> - 6.1-1
- 6.1 bump from Flameeyes fork
- License changed to GPLv2
* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.3-27
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild