15 stdenv.mkDerivation rec {
16 pname = "ccextractor";
19 src = fetchFromGitHub {
20 owner = "CCExtractor";
23 sha256 = "sha256-usVAKBkdd8uz9cD5eLd0hnwGonOJLscRdc+iWDlNXVc=";
27 # https://github.com/CCExtractor/ccextractor/issues/1467
28 sed -i '/allheaders.h/a#include <leptonica/pix_internal.h>' src/lib_ccx/ocr.c
29 '' + lib.optionalString stdenv.isDarwin ''
30 substituteInPlace src/CMakeLists.txt \
31 --replace 'add_definitions(-DGPAC_CONFIG_LINUX)' 'add_definitions(-DGPAC_CONFIG_DARWIN)'
36 nativeBuildInputs = [ pkg-config cmake makeWrapper ];
38 buildInputs = [ zlib ]
39 ++ lib.optional (!stdenv.isLinux) libiconv
40 ++ lib.optionals enableOcr [ leptonica tesseract4 ffmpeg_4 ];
43 # file RPATH_CHANGE could not write new RPATH:
44 "-DCMAKE_SKIP_BUILD_RPATH=ON"
45 ] ++ lib.optionals enableOcr [ "-DWITH_OCR=on" "-DWITH_HARDSUBX=on" ];
47 postInstall = lib.optionalString enableOcr ''
48 wrapProgram "$out/bin/ccextractor" \
49 --set TESSDATA_PREFIX "${tesseract4}/share/"
53 homepage = "https://www.ccextractor.org";
54 description = "Tool that produces subtitles from closed caption data in videos";
56 A tool that analyzes video files and produces independent subtitle files from
57 closed captions data. CCExtractor is portable, small, and very fast.
58 It works on Linux, Windows, and OSX.
60 platforms = platforms.unix;
61 # undefined reference to `png_do_expand_palette_rgba8_neon'
62 # undefined reference to `png_riffle_palette_neon'
63 # undefined reference to `png_do_expand_palette_rgb8_neon'
64 # undefined reference to `png_init_filter_functions_neon'
65 # during Linking C executable ccextractor
66 broken = stdenv.isAarch64;
67 license = licenses.gpl2Only;
68 maintainers = with maintainers; [ titanous ];
69 mainProgram = "ccextractor";