Control: tags -1 confirmed patch

Hi Jan,

2016-04-25 12:43 GMT+02:00 Jan Gerber <j...@mailb.org>:
> Package: ffmpeg
> Version: 7:3.0.1-3
> Severity: wishlist
>
> Dear Maintainer,
>
> FFmpeg 3.0 introduced a new ocr filter that depends on libtesseract.
> Would be nice to see this enabled in Debian.

I have prepared a patch which may be enough.
It needs testing however. Sebastian, what do you think?

Maybe we could enable some other features as well.

Cheers,
Balint
From 72f545c2900bf65ea44e4f9465b08332c4b0610e Mon Sep 17 00:00:00 2001
From: Balint Reczey <bal...@balintreczey.hu>
Date: Tue, 6 Sep 2016 14:34:25 +0200
Subject: [PATCH] Enable OCR using Tesseract in libavfilter-extra*

Closes: 822555
---
 debian/control                              | 54 ++++++++++++++++++++++++++++-
 debian/libavfilter-extra6.install           |  1 +
 debian/libavfilter-extra6.install.powerpc   |  2 ++
 debian/libavfilter-extra6.lintian-overrides |  9 +++++
 debian/rules                                | 19 +++++-----
 5 files changed, 74 insertions(+), 11 deletions(-)
 create mode 100644 debian/libavfilter-extra6.install
 create mode 100644 debian/libavfilter-extra6.install.powerpc
 create mode 100644 debian/libavfilter-extra6.lintian-overrides

diff --git a/debian/control b/debian/control
index e7bf9d7..2841992 100644
--- a/debian/control
+++ b/debian/control
@@ -68,6 +68,8 @@ Build-Depends:
  libavc1394-dev [linux-any],
 # autodetected: indev 'jack'
  libjack-jackd2-dev,
+# missing dependency of libtesseract-dev #836849
+ libleptonica-dev,
 # autodetected for the tiff decoder
  liblzma-dev,
 # --enable-libmodplug
@@ -108,6 +110,8 @@ Build-Depends:
  libspeex-dev,
 # --enable-libssh
  libssh-gcrypt-dev,
+# --enable-libtesseract (used only in -extra flavor)
+ libtesseract-dev,
 # --enable-libtheora
  libtheora-dev,
 # --enable-libtwolame
@@ -370,13 +374,61 @@ Description: FFmpeg library containing media filters - runtime files
  .
  This package contains the runtime files.
 
+Package: libavfilter-extra6
+Architecture: any
+Section: libs
+Priority: extra
+Multi-Arch: same
+Conflicts: libavfilter6
+Provides: libavfilter-extra
+Pre-Depends:
+ ${misc:Pre-Depends}
+Depends:
+ ${shlibs:Depends},
+ ${misc:Depends}
+Description: FFmpeg library with extra media filters - runtime files
+ FFmpeg is the leading multimedia framework, able to decode, encode, transcode,
+ mux, demux, stream, filter and play pretty much anything that humans and
+ machines have created. It supports the most obscure ancient formats up to the
+ cutting edge.
+ .
+ This library provides a generic audio/video filtering framework containing
+ several filters, sources and sinks.
+ .
+ This package replaces the libavfilter6 package and contains the
+ following additional filters:
+ .
+  * Optical Character Recognition (uses Tesseract)
+ .
+ Because this package links against libraries that are licensed under
+ Apache License 2.0, the resulting binaries are distributed under the
+ GPL version 3 or later.
+
+Package: libavfilter-extra
+Architecture: all
+Section: metapackages
+Priority: extra
+Multi-Arch: foreign
+Depends:
+ libavfilter-extra6,
+ ${misc:Depends}
+Description: FFmpeg library with extra filters (metapackage)
+ FFmpeg is the leading multimedia framework, able to decode, encode, transcode,
+ mux, demux, stream, filter and play pretty much anything that humans and
+ machines have created. It supports the most obscure ancient formats up to the
+ cutting edge.
+ .
+ This metapackage depends on the latest version of the libavfilter variant
+ that offers additional filter support. Application packages can depend
+ on it if they require or suggest this variant in a robust manner.
+
 Package: libavfilter-dev
 Architecture: any
 Section: libdevel
 Multi-Arch: same
 Depends:
  libavcodec-dev (= ${binary:Version}),
- libavfilter6 (= ${binary:Version}),
+ libavfilter6 (= ${binary:Version}) | libavfilter-extra6 (= ${binary:Version}),
  libavformat-dev (= ${binary:Version}),
  libavresample-dev (= ${binary:Version}),
  libavutil-dev (= ${binary:Version}),
diff --git a/debian/libavfilter-extra6.install b/debian/libavfilter-extra6.install
new file mode 100644
index 0000000..1b2648c
--- /dev/null
+++ b/debian/libavfilter-extra6.install
@@ -0,0 +1 @@
+usr/lib/*/libavfilter.so.*
diff --git a/debian/libavfilter-extra6.install.powerpc b/debian/libavfilter-extra6.install.powerpc
new file mode 100644
index 0000000..628ec8f
--- /dev/null
+++ b/debian/libavfilter-extra6.install.powerpc
@@ -0,0 +1,2 @@
+usr/lib/*/libavfilter.so.*
+usr/lib/*/*/libavfilter.so.*
diff --git a/debian/libavfilter-extra6.lintian-overrides b/debian/libavfilter-extra6.lintian-overrides
new file mode 100644
index 0000000..5e6db9b
--- /dev/null
+++ b/debian/libavfilter-extra6.lintian-overrides
@@ -0,0 +1,9 @@
+# According to Debian policy [1], non position independent code is permitted
+# in a shared library on i386 and position independent code may have a
+# performance penalty, especially on i386.
+# Therefore -fPIC is not used by the upstream build system on i386.
+# 1: https://www.debian.org/doc/debian-policy/footnotes.html#f83
+libavfilter-extra6 [i386]: shlib-with-non-pic-code usr/lib/i386*/libavfilter.so.*
+
+# This is intentional, because this package provides an alternative variant with the same soname.
+libavfilter-extra6: package-name-doesnt-match-sonames libavfilter*
diff --git a/debian/rules b/debian/rules
index 7d969c3..1ae2ec7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -18,13 +18,12 @@ include /usr/share/dpkg/architecture.mk
 export DEB_LDFLAGS_MAINT_STRIP=-Wl,-Bsymbolic-functions
 
 # Package name for the extra flavor.
-EXTRA_PKG := $(shell sed -nr 's/^Package:[[:space:]]*(.*extra[0-9]+)[[:space:]]*$$/\1/p' debian/control)
+EXTRA_PKGS := $(shell sed -nr 's/^Package:[[:space:]]*(.*extra[0-9]+)[[:space:]]*$$/\1/p' debian/control)
 FLAVORS = standard extra
 
 # Enable as many features as possible, as long as the result is still GPLv2+ (a GPLv3+ variant is built as libavcodec-extra flavor).
 # The following flags (and build-dependencies) are not added, because they would require a libavformat-extra flavor:
 #   --enable-libsmbclient           (libsmbclient-dev [!hurd-i386 !m68k !sparc64])
-#   --enable-libtesseract
 #   --enable-netcdf
 # The following flags are not added, because the necessary libraries are not in Debian:
 #   --enable-decklink
@@ -52,6 +51,7 @@ CONFIG := --prefix=/usr \
 	--cxx=$(CXX) \
 	--enable-gpl \
 	--enable-shared \
+	--disable-libtesseract \
 	--disable-stripping \
 	--disable-decoder=libopenjpeg \
 	--disable-decoder=libschroedinger \
@@ -104,14 +104,9 @@ CONFIG_standard =
 CONFIG_extra = --enable-version3 \
 	--disable-doc \
 	--disable-programs \
-	--disable-avdevice \
-	--disable-avfilter \
-	--disable-avformat \
-	--disable-avresample \
-	--disable-postproc \
-	--disable-swscale \
 	--enable-libopencore_amrnb \
 	--enable-libopencore_amrwb \
+	--enable-libtesseract \
 	--enable-libvo_amrwbenc
 
 # Disable optimizations if requested.
@@ -236,8 +231,8 @@ ifeq ($(DEB_HOST_ARCH),powerpc)
 endif
 
 override_dh_install:
-	dh_install -N $(EXTRA_PKG)
-	dh_install -p $(EXTRA_PKG) --sourcedir=debian/tmp/extra
+	dh_install $(addprefix -p,$(EXTRA_PKGS)) --sourcedir=debian/tmp/extra
+	dh_install --remaining-packages
 
 override_dh_makeshlibs:
 	set -e && for pkg in $(shell dh_listpackages -a) ; do \
@@ -249,6 +244,10 @@ override_dh_makeshlibs:
 				soversion=$$(echo $$pkg | sed -nr 's/^[^0-9]*([0-9]+)$$/\1/p'); \
 				dh_makeshlibs -p $$pkg -V"libavcodec$$soversion (>= ${DEB_VERSION_EPOCH_UPSTREAM}) | libavcodec-extra$$soversion (>= ${DEB_VERSION_EPOCH_UPSTREAM})" \
 				;; \
+			*avfilter*) \
+				soversion=$$(echo $$pkg | sed -nr 's/^[^0-9]*([0-9]+)$$/\1/p'); \
+				dh_makeshlibs -p $$pkg -V"libavfilter$$soversion (>= ${DEB_VERSION_EPOCH_UPSTREAM}) | libavfilter-extra$$soversion (>= ${DEB_VERSION_EPOCH_UPSTREAM})" \
+				;; \
 			*) \
 				dh_makeshlibs -p $$pkg -V \
 				;; \
-- 
2.1.4

Reply via email to