summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-03-17 10:09:17 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-03-17 10:40:02 -0400
commit2dc2722dc022974684c5f5add577d2241b0b996d (patch)
tree60bc12747d92b882e0f339ecc11a7eaa0870e7c7
parent8832acc24eb8996f0b26988cbe5c456751af79d7 (diff)
downloadguix-patches-2dc2722dc022974684c5f5add577d2241b0b996d.tar
guix-patches-2dc2722dc022974684c5f5add577d2241b0b996d.tar.gz
gnu: ccextractor: Update to 0.94 and fix build.
* gnu/packages/gstreamer.scm (ccextractor): Update to 0.94. [source]: Apply patches. Add FIXME comment. [build-system]: Switch to gnu-build-system. [arguments]: Delete #tests? argument. Delete trailing #t and use gexps. Adjust configure flags accordingly, removing WITH_SHARING (doesn't exist for Autoconf) and adding '--without-rust'. Override check phase. [native-inputs]: Remove labels. Remove python-wrapper and perl. [propagated-inputs]: Remove labels. Remove nanomsg and zlib. Replace leptonica with leptonica-1.80. replace tesseract-ocr with tesseract-ocr-4. * gnu/packages/patches/ccextractor-add-missing-header.patch: New file. * gnu/packages/patches/ccextractor-autoconf-tesseract.patch: Likewise. * gnu/packages/patches/ccextractor-fix-ocr.patch: Likewise. * gnu/local.mk (dist_patch_DATA): Register them.
-rw-r--r--gnu/local.mk3
-rw-r--r--gnu/packages/gstreamer.scm75
-rw-r--r--gnu/packages/patches/ccextractor-add-missing-header.patch33
-rw-r--r--gnu/packages/patches/ccextractor-autoconf-tesseract.patch37
-rw-r--r--gnu/packages/patches/ccextractor-fix-ocr.patch29
5 files changed, 139 insertions, 38 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 0a1a5d077f..2944211e12 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -966,6 +966,9 @@ dist_patch_DATA = \
%D%/packages/patches/calibre-remove-test-sqlite.patch \
%D%/packages/patches/calibre-remove-test-unrar.patch \
%D%/packages/patches/catdoc-CVE-2017-11110.patch \
+ %D%/packages/patches/ccextractor-add-missing-header.patch \
+ %D%/packages/patches/ccextractor-autoconf-tesseract.patch \
+ %D%/packages/patches/ccextractor-fix-ocr.patch \
%D%/packages/patches/chez-scheme-bin-sh.patch \
%D%/packages/patches/circos-remove-findbin.patch \
%D%/packages/patches/cdparanoia-fpic.patch \
diff --git a/gnu/packages/gstreamer.scm b/gnu/packages/gstreamer.scm
index 2bb4d48991..f33a30a02b 100644
--- a/gnu/packages/gstreamer.scm
+++ b/gnu/packages/gstreamer.scm
@@ -10,6 +10,7 @@
;;; Copyright © 2019, 2020 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2020 Liliana Marie Prikler <liliana.prikler@gmail.com>
;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
+;;; Copyright © 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -32,7 +33,6 @@
#:use-module (guix gexp)
#:use-module (guix download)
#:use-module (guix git-download)
- #:use-module (guix build-system cmake)
#:use-module (guix build-system gnu)
#:use-module (guix build-system meson)
#:use-module (guix build-system trivial)
@@ -171,49 +171,48 @@ module for the DMA capture of the video flow.")
(define-public ccextractor
(package
(name "ccextractor")
- (version "0.88")
+ (version "0.94")
(source
(origin
(method git-fetch)
- (uri
- (git-reference
- (url "https://github.com/CCExtractor/ccextractor")
- (commit (string-append "v" version))))
+ (uri (git-reference
+ (url "https://github.com/CCExtractor/ccextractor")
+ (commit (string-append "v" version))))
(file-name (git-file-name name version))
+ ;; FIXME: Delete the 'src/thirdparty directory and unbundle the
+ ;; libraries it contains, such as freetype, libpng, zlib, and others.
+ (patches (search-patches "ccextractor-add-missing-header.patch"
+ "ccextractor-autoconf-tesseract.patch"
+ "ccextractor-fix-ocr.patch"))
(sha256
- (base32 "1sya45hvv4d46bk7541yimmafgvgyhkpsvwfz9kv6pm4yi1lz6nb"))))
- (build-system cmake-build-system)
+ (base32 "1hrk4xlzkvk9pnv0yr4whcsh8h4fzk42mrf30dsr3xzh1lgpfslg"))))
+ (build-system gnu-build-system)
(arguments
- `(#:tests? #f ; No target
- #:configure-flags
- (list
- "-DWITH_FFMPEG=ON"
- "-DWITH_OCR=ON"
- "-DWITH_SHARING=ON"
- "-DWITH_HARDSUBX=ON")
- #:phases
- (modify-phases %standard-phases
- ;; The package is in a sub-dir of this repo.
- (add-after 'unpack 'chdir
- (lambda _
- (chdir "src")
- #t))
- (add-after 'chdir 'fix-build-errors
- (lambda _
- (substitute* "CMakeLists.txt"
- (("libnanomsg")
- "nanomsg"))
- #t)))))
- (native-inputs
- `(("perl" ,perl)
- ("pkg-config" ,pkg-config)
- ("python" ,python-wrapper)))
- (inputs
- `(("ffmeg" ,ffmpeg-3.4)
- ("nanomsg" ,nanomsg)
- ("leptonica" ,leptonica)
- ("ocr" ,tesseract-ocr)
- ("zlib" ,zlib)))
+ (list #:configure-flags
+ #~(list "--enable-ffmpeg"
+ "--enable-ocr"
+ "--enable-hardsubx"
+ ;; Disable Rust support, as there's no rust source included
+ ;; and cargo wants to fetch the crates from the network
+ ;; (see:
+ ;; https://github.com/CCExtractor/ccextractor/issues/1502).
+ "--without-rust")
+ #:phases #~(modify-phases %standard-phases
+ (add-after 'unpack 'chdir
+ (lambda _
+ (chdir "linux")))
+ (add-after 'chdir 'patch-pre-build.sh
+ (lambda _
+ (substitute* "pre-build.sh"
+ (("/usr/bin/env") (which "env")))))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ ;; There is no test suite; simply run the binary
+ ;; to validate there are no obvious problems.
+ (invoke "./ccextractor" "--help")))))))
+ (native-inputs (list autoconf automake pkg-config))
+ (inputs (list ffmpeg-3.4 leptonica-1.80 tesseract-ocr-4))
(synopsis "Closed Caption Extractor")
(description "CCExtractor is a tool that analyzes video files and produces
independent subtitle files from the closed captions data. It is portable, small,
diff --git a/gnu/packages/patches/ccextractor-add-missing-header.patch b/gnu/packages/patches/ccextractor-add-missing-header.patch
new file mode 100644
index 0000000000..6c6c02be51
--- /dev/null
+++ b/gnu/packages/patches/ccextractor-add-missing-header.patch
@@ -0,0 +1,33 @@
+Upstream status: https://github.com/CCExtractor/ccextractor/pull/1505
+
+From 272e0e1410135c3a5de105cecce400c7b2a9ed5b Mon Sep 17 00:00:00 2001
+From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
+Date: Fri, 17 Mar 2023 09:49:29 -0400
+Subject: [PATCH] linux/Makefile.am: Add missing generated header.
+
+This header is generated by the pre-build.sh script. The compilation
+fails if it is missing.
+
+* linux/Makefile.am (ccextractor_SOURCES): Add
+../src/lib_ccx/compile_info_real.h.
+---
+ linux/Makefile.am | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/linux/Makefile.am b/linux/Makefile.am
+index fddc26a5..f83f1eff 100644
+--- a/linux/Makefile.am
++++ b/linux/Makefile.am
+@@ -118,6 +118,7 @@ ccextractor_SOURCES = \
+ ../src/lib_ccx/bitstream.h \
+ ../src/lib_ccx/ccx_common_option.c \
+ ../src/lib_ccx/ccx_common_common.c \
++ ../src/lib_ccx/compile_info_real.h \
+ ../src/lib_ccx/utility.c \
+ ../src/lib_ccx/activity.c \
+ ../src/lib_ccx/asf_functions.c \
+
+base-commit: cb496a711923c984251483776e652ca9c027513c
+--
+2.39.1
+
diff --git a/gnu/packages/patches/ccextractor-autoconf-tesseract.patch b/gnu/packages/patches/ccextractor-autoconf-tesseract.patch
new file mode 100644
index 0000000000..3ce2925acf
--- /dev/null
+++ b/gnu/packages/patches/ccextractor-autoconf-tesseract.patch
@@ -0,0 +1,37 @@
+Upstream status: https://github.com/CCExtractor/ccextractor/pull/1504
+
+From f587050c2b5805ff5feb667736381dcc9991a5d3 Mon Sep 17 00:00:00 2001
+From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
+Date: Fri, 17 Mar 2023 00:57:13 -0400
+Subject: [PATCH] linux/configure.ac: Fix tesseract conditional problem.
+
+For tesseract-ocr's stock pkg-config, it would produce an error due to
+unquoted whitespace:
+
+ $ test ! -z `pkg-config --libs-only-l --silence-errors tesseract`
+ bash: test: syntax error: `-larchive' unexpected
+
+* linux/configure.ac: Use a positive test, and double-quote the $() command
+substitution.
+---
+ linux/configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/linux/configure.ac b/linux/configure.ac
+index 45fc11f3..118ee7fa 100644
+--- a/linux/configure.ac
++++ b/linux/configure.ac
+@@ -149,7 +149,7 @@ AS_IF([ (test x$ocr = xtrue || test x$hardsubx = xtrue) && test ! $HAS_LEPT -gt
+ AM_CONDITIONAL(HARDSUBX_IS_ENABLED, [ test x$hardsubx = xtrue ])
+ AM_CONDITIONAL(OCR_IS_ENABLED, [ test x$ocr = xtrue || test x$hardsubx = xtrue ])
+ AM_CONDITIONAL(FFMPEG_IS_ENABLED, [ test x$ffmpeg = xtrue ])
+-AM_CONDITIONAL(TESSERACT_PRESENT, [ test ! -z `pkg-config --libs-only-l --silence-errors tesseract` ])
++AM_CONDITIONAL(TESSERACT_PRESENT, [ test -n "$(pkg-config --libs-only-l --silence-errors tesseract)" ])
+ AM_CONDITIONAL(TESSERACT_PRESENT_RPI, [ test -d "/usr/include/tesseract" && test `ls -A /usr/include/tesseract | wc -l` -gt 0 ])
+ AM_CONDITIONAL(SYS_IS_LINUX, [ test `uname -s` = "Linux"])
+ AM_CONDITIONAL(SYS_IS_MAC, [ test `uname -s` = "Darwin"])
+
+base-commit: cb496a711923c984251483776e652ca9c027513c
+--
+2.39.1
+
diff --git a/gnu/packages/patches/ccextractor-fix-ocr.patch b/gnu/packages/patches/ccextractor-fix-ocr.patch
new file mode 100644
index 0000000000..9a06026724
--- /dev/null
+++ b/gnu/packages/patches/ccextractor-fix-ocr.patch
@@ -0,0 +1,29 @@
+Extracted from upstream commit 0264e7da2be67182deb031228eb07e6ed4943c81.
+
+diff --git a/src/lib_ccx/ocr.c b/src/lib_ccx/ocr.c
+index 31cc1c5c..73bd4818 100644
+--- a/src/lib_ccx/ocr.c
++++ b/src/lib_ccx/ocr.c
+@@ -331,6 +331,11 @@ char *ocr_bitmap(void *arg, png_color *palette, png_byte *alpha, unsigned char *
+ }
+
+ BOX *crop_points = ignore_alpha_at_edge(copy->alpha, copy->data, w, h, color_pix, &color_pix_out);
++
++ l_int32 x, y, _w, _h;
++
++ boxGetGeometry(crop_points, &x, &y, &_w, &_h);
++
+ // Converting image to grayscale for OCR to avoid issues with transparency
+ cpix_gs = pixConvertRGBToGray(cpix, 0.0, 0.0, 0.0);
+
+@@ -426,8 +431,8 @@ char *ocr_bitmap(void *arg, png_color *palette, png_byte *alpha, unsigned char *
+ {
+ for (int j = x1; j <= x2; j++)
+ {
+- if (copy->data[(crop_points->y + i) * w + (crop_points->x + j)] != firstpixel)
+- histogram[copy->data[(crop_points->y + i) * w + (crop_points->x + j)]]++;
++ if (copy->data[(y + i) * w + (x + j)] != firstpixel)
++ histogram[copy->data[(y + i) * w + (x + j)]]++;
+ }
+ }
+ /* sorted in increasing order of intensity */