biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / applications / video / ccextractor / default.nix
blob3814f921fa240a91c58287c38975aa08349d7618
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , pkg-config
5 , cmake
6 , libiconv
7 , zlib
8 , enableOcr ? true
9 , makeWrapper
10 , tesseract4
11 , leptonica
12 , ffmpeg_4
15 stdenv.mkDerivation rec {
16   pname = "ccextractor";
17   version = "0.93";
19   src = fetchFromGitHub {
20     owner = "CCExtractor";
21     repo = pname;
22     rev = "v${version}";
23     sha256 = "sha256-usVAKBkdd8uz9cD5eLd0hnwGonOJLscRdc+iWDlNXVc=";
24   };
26   postPatch = ''
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)'
32   '';
34   cmakeDir = "../src";
36   nativeBuildInputs = [ pkg-config cmake makeWrapper ];
38   buildInputs = [ zlib ]
39     ++ lib.optional (!stdenv.isLinux) libiconv
40     ++ lib.optionals enableOcr [ leptonica tesseract4 ffmpeg_4 ];
42   cmakeFlags = [
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/"
50   '';
52   meta = with lib; {
53     homepage = "https://www.ccextractor.org";
54     description = "Tool that produces subtitles from closed caption data in videos";
55     longDescription = ''
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.
59     '';
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";
70   };