2021-08-05 21:33:18 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pkg-config
|
|
|
|
, cmake
|
|
|
|
, libiconv
|
|
|
|
, zlib
|
|
|
|
, enableOcr ? true
|
|
|
|
, makeWrapper
|
|
|
|
, tesseract4
|
|
|
|
, leptonica
|
2023-03-27 19:17:25 +00:00
|
|
|
, ffmpeg_4
|
2021-08-05 21:33:18 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "ccextractor";
|
2021-08-18 13:19:15 +00:00
|
|
|
version = "0.93";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "CCExtractor";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-08-18 13:19:15 +00:00
|
|
|
sha256 = "sha256-usVAKBkdd8uz9cD5eLd0hnwGonOJLscRdc+iWDlNXVc=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
postPatch = ''
|
|
|
|
# https://github.com/CCExtractor/ccextractor/issues/1467
|
|
|
|
sed -i '/allheaders.h/a#include <leptonica/pix_internal.h>' src/lib_ccx/ocr.c
|
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2021-12-06 16:07:01 +00:00
|
|
|
substituteInPlace src/CMakeLists.txt \
|
|
|
|
--replace 'add_definitions(-DGPAC_CONFIG_LINUX)' 'add_definitions(-DGPAC_CONFIG_DARWIN)'
|
|
|
|
'';
|
|
|
|
|
|
|
|
cmakeDir = "../src";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
nativeBuildInputs = [ pkg-config cmake makeWrapper ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
buildInputs = [ zlib ]
|
|
|
|
++ lib.optional (!stdenv.isLinux) libiconv
|
2023-03-27 19:17:25 +00:00
|
|
|
++ lib.optionals enableOcr [ leptonica tesseract4 ffmpeg_4 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
# file RPATH_CHANGE could not write new RPATH:
|
|
|
|
"-DCMAKE_SKIP_BUILD_RPATH=ON"
|
|
|
|
] ++ lib.optionals enableOcr [ "-DWITH_OCR=on" "-DWITH_HARDSUBX=on" ];
|
2021-08-05 21:33:18 +00:00
|
|
|
|
|
|
|
postInstall = lib.optionalString enableOcr ''
|
|
|
|
wrapProgram "$out/bin/ccextractor" \
|
|
|
|
--set TESSDATA_PREFIX "${tesseract4}/share/"
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://www.ccextractor.org";
|
|
|
|
description = "Tool that produces subtitles from closed caption data in videos";
|
|
|
|
longDescription = ''
|
|
|
|
A tool that analyzes video files and produces independent subtitle files from
|
|
|
|
closed captions data. CCExtractor is portable, small, and very fast.
|
|
|
|
It works on Linux, Windows, and OSX.
|
|
|
|
'';
|
|
|
|
platforms = platforms.unix;
|
2021-08-05 21:33:18 +00:00
|
|
|
# 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;
|
2024-05-15 15:35:15 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "ccextractor";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|