summary refs log tree commit diff
path: root/pkgs/applications/video
diff options
context:
space:
mode:
authorArtturi <Artturin@artturin.com>2021-08-05 11:25:02 +0300
committerGitHub <noreply@github.com>2021-08-05 10:25:02 +0200
commitcf7212d79d0628eaa3b9f8651814c6603b41cef9 (patch)
tree83da0aa68566671382c42e3dce9ca459da744afc /pkgs/applications/video
parent704d38dcd5ca7bc7b39010a65ffa51a5a827bf60 (diff)
downloadnixpkgs-cf7212d79d0628eaa3b9f8651814c6603b41cef9.tar
nixpkgs-cf7212d79d0628eaa3b9f8651814c6603b41cef9.tar.gz
nixpkgs-cf7212d79d0628eaa3b9f8651814c6603b41cef9.tar.bz2
nixpkgs-cf7212d79d0628eaa3b9f8651814c6603b41cef9.tar.lz
nixpkgs-cf7212d79d0628eaa3b9f8651814c6603b41cef9.tar.xz
nixpkgs-cf7212d79d0628eaa3b9f8651814c6603b41cef9.tar.zst
nixpkgs-cf7212d79d0628eaa3b9f8651814c6603b41cef9.zip
ccextractor: enable ocr and hardsub support (#131849)
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Diffstat (limited to 'pkgs/applications/video')
-rw-r--r--pkgs/applications/video/ccextractor/default.nix39
1 files changed, 32 insertions, 7 deletions
diff --git a/pkgs/applications/video/ccextractor/default.nix b/pkgs/applications/video/ccextractor/default.nix
index d18ca43cbf7..6e47f96253e 100644
--- a/pkgs/applications/video/ccextractor/default.nix
+++ b/pkgs/applications/video/ccextractor/default.nix
@@ -1,7 +1,17 @@
-{ lib, stdenv, fetchFromGitHub, pkg-config, cmake
-, glew, glfw3, leptonica, libiconv, tesseract3, zlib }:
+{ lib
+, stdenv
+, fetchFromGitHub
+, pkg-config
+, cmake
+, libiconv
+, zlib
+, enableOcr ? true
+, makeWrapper
+, tesseract4
+, leptonica
+, ffmpeg
+}:
 
-with lib;
 stdenv.mkDerivation rec {
   pname = "ccextractor";
   version = "0.91";
@@ -15,11 +25,20 @@ stdenv.mkDerivation rec {
 
   sourceRoot = "source/src";
 
-  nativeBuildInputs = [ pkg-config cmake ];
+  nativeBuildInputs = [ pkg-config cmake makeWrapper ];
 
-  buildInputs = [ glew glfw3 leptonica tesseract3 zlib ] ++ lib.optional (!stdenv.isLinux) libiconv;
+  buildInputs = [ zlib ]
+    ++ lib.optional (!stdenv.isLinux) libiconv
+    ++ lib.optionals enableOcr [ leptonica tesseract4 ffmpeg ];
 
-  meta = {
+  cmakeFlags = lib.optionals enableOcr [ "-DWITH_OCR=on" "-DWITH_HARDSUBX=on" ];
+
+  postInstall = lib.optionalString enableOcr ''
+    wrapProgram "$out/bin/ccextractor" \
+      --set TESSDATA_PREFIX "${tesseract4}/share/"
+  '';
+
+  meta = with lib; {
     homepage = "https://www.ccextractor.org";
     description = "Tool that produces subtitles from closed caption data in videos";
     longDescription = ''
@@ -28,7 +47,13 @@ stdenv.mkDerivation rec {
       It works on Linux, Windows, and OSX.
     '';
     platforms = platforms.unix;
-    license = licenses.gpl2;
+    # undefined reference to `png_do_expand_palette_rgba8_neon'
+    # undefined reference to `png_riffle_palette_neon'
+    # undefined reference to `png_do_expand_palette_rgb8_neon'
+    # undefined reference to `png_init_filter_functions_neon'
+    # during Linking C executable ccextractor
+    broken = stdenv.isAarch64;
+    license = licenses.gpl2Only;
     maintainers = with maintainers; [ titanous ];
   };
 }