Loading pkgs/by-name/cc/ccextractor/package.nix +105 −36 Original line number Diff line number Diff line Loading @@ -2,72 +2,146 @@ lib, stdenv, fetchFromGitHub, writeTextFile, pkg-config, cmake, libiconv, ninja, cargo, rustc, corrosion, rustPlatform, gpac, protobufc, libpng, zlib, utf8proc, freetype, ffmpeg_7, libarchive, curl, libiconv, enableOcr ? true, makeWrapper, tesseract4, leptonica, ffmpeg_4, tesseract, }: stdenv.mkDerivation (finalAttrs: { pname = "ccextractor"; version = "0.93"; version = "0.94-unstable-2024-08-12"; src = fetchFromGitHub { owner = "CCExtractor"; repo = "ccextractor"; rev = "v${finalAttrs.version}"; hash = "sha256-usVAKBkdd8uz9cD5eLd0hnwGonOJLscRdc+iWDlNXVc="; rev = "92f2ce0fa026b01fb07db6751210e6bd8c8944d3"; hash = "sha256-bp7T9uJK4bauR2Co4lKqqnM6oGa3WZ+1toEKmzOx4mI="; }; 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 '' substituteInPlace src/CMakeLists.txt \ --replace 'add_definitions(-DGPAC_CONFIG_LINUX)' 'add_definitions(-DGPAC_CONFIG_DARWIN)' ''; patches = [ ./remove-default-commit-hash.patch ./remove-vendored-libraries.patch ] ++ finalAttrs.cargoDeps.patches; cmakeDir = "../src"; cargoRoot = "src/rust"; cargoDeps = rustPlatform.fetchCargoTarball { inherit (finalAttrs) src; sourceRoot = "${finalAttrs.src.name}/${finalAttrs.cargoRoot}"; patches = [ ./use-rsmpeg-0.15.patch ]; patchFlags = [ "-p3" ]; hash = "sha256-jh8hHKAad+tCJGwuGdoJp/TMm/IsMrZmz8aag9lj0BA="; }; nativeBuildInputs = [ pkg-config cmake makeWrapper ninja cargo rustc corrosion rustPlatform.cargoSetupHook rustPlatform.bindgenHook ]; buildInputs = [ zlib ] ++ lib.optional (!stdenv.isLinux) libiconv [ gpac protobufc libpng zlib utf8proc freetype ffmpeg_7 libarchive curl libiconv ] ++ lib.optionals enableOcr [ leptonica tesseract4 ffmpeg_4 tesseract ]; cmakeFlags = [ # file RPATH_CHANGE could not write new RPATH: "-DCMAKE_SKIP_BUILD_RPATH=ON" # The tests are all part of one `cargo test` invocation, so let’s # get the output from it. (lib.cmakeFeature "CMAKE_CTEST_ARGUMENTS" "--verbose") # TODO: This (and the corresponding patch) should probably be # removed for the next stable release. (lib.cmakeFeature "GIT_COMMIT_HASH" finalAttrs.src.rev) ] ++ lib.optionals enableOcr [ "-DWITH_OCR=on" "-DWITH_HARDSUBX=on" (lib.cmakeBool "WITH_OCR" true) (lib.cmakeBool "WITH_HARDSUBX" true) ]; postInstall = lib.optionalString enableOcr '' wrapProgram "$out/bin/ccextractor" \ --set TESSDATA_PREFIX "${tesseract4}/share/" env = { FFMPEG_INCLUDE_DIR = "${lib.getDev ffmpeg_7}/include"; # Upstream’s FFmpeg binding crate needs an explicit path to a shared # object to do dynamic linking. The key word is *an* explicit path; # they don’t support passing more than one. This linker script hack # pulls in all the FFmpeg libraries they bind to. # # See: <https://github.com/CCExtractor/rusty_ffmpeg/pull/69> FFMPEG_DLL_PATH = let ffmpegLibNames = [ "avcodec" "avdevice" "avfilter" "avformat" "avutil" "swresample" "swscale" ]; ffmpegLibDir = "${lib.getLib ffmpeg_7}/lib"; ffmpegLibExt = stdenv.hostPlatform.extensions.library; ffmpegLibPath = ffmpegLibName: "${ffmpegLibDir}/lib${ffmpegLibName}.${ffmpegLibExt}"; ffmpegLinkerScript = writeTextFile { name = "ccextractor-ffmpeg-linker-script"; destination = "/lib/ffmpeg.ld"; text = "INPUT(${lib.concatMapStringsSep " " ffmpegLibPath ffmpegLibNames})"; }; in "${ffmpegLinkerScript}/lib/ffmpeg.ld"; }; doCheck = true; postPatch = lib.optionalString enableOcr '' substituteInPlace src/lib_ccx/ocr.c \ --replace-fail 'getenv("TESSDATA_PREFIX")' '"${tesseract}/share"' ''; meta = with lib; { homepage = "https://www.ccextractor.org"; meta = { homepage = "https://www.ccextractor.org/"; changelog = "${finalAttrs.src.meta.homepage}/blob/${finalAttrs.src.rev}/docs/CHANGES.TXT"; description = "Tool that produces subtitles from closed caption data in videos"; longDescription = '' A tool that analyzes video files and produces independent subtitle files from Loading @@ -75,12 +149,7 @@ stdenv.mkDerivation (finalAttrs: { It works on Linux, Windows, and OSX. ''; platforms = lib.platforms.unix; # 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; sourceProvenance = [ lib.sourceTypes.fromSource ]; license = lib.licenses.gpl2Only; maintainers = [ lib.maintainers.emily ]; mainProgram = "ccextractor"; Loading pkgs/by-name/cc/ccextractor/remove-default-commit-hash.patch 0 → 100644 +14 −0 Original line number Diff line number Diff line diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d7fdda02e3...2738cab631 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -24,9 +24,6 @@ OUTPUT_VARIABLE GIT_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE ) -ELSE(EXISTS "${BASE_PROJ_DIR}/.git") - set(GIT_BRANCH "Unknown") - set(GIT_COMMIT_HASH "Unknown") ENDIF(EXISTS "${BASE_PROJ_DIR}/.git") #Get the date pkgs/by-name/cc/ccextractor/remove-vendored-libraries.patch 0 → 100644 +187 −0 Original line number Diff line number Diff line diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2738cab631...5bb2b7d17a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -48,93 +48,20 @@ include_directories(${PROJECT_SOURCE_DIR}) include_directories(${PROJECT_SOURCE_DIR}/lib_ccx) include_directories(${PROJECT_SOURCE_DIR}/lib_ccx/zvbi) -include_directories(${PROJECT_SOURCE_DIR}/thirdparty) -include_directories(${PROJECT_SOURCE_DIR}/thirdparty/protobuf-c) include_directories(${PROJECT_SOURCE_DIR}/thirdparty/lib_hash) -include_directories(${PROJECT_SOURCE_DIR}/thirdparty/libpng) -# Check if the operating system is macOS (Darwin) -if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - if(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "arm64") - # ARM Macs - include_directories("/opt/homebrew/include") - include_directories(${PROJECT_SOURCE_DIR}/thirdparty/libpng/arm) - aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/libpng/arm SOURCEFILE) - else() - include_directories("/usr/local/include") - endif() -endif() - -include_directories(${PROJECT_SOURCE_DIR}/thirdparty/zlib) -include_directories(${PROJECT_SOURCE_DIR}/thirdparty/freetype/include) aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/lib_hash/ SOURCEFILE) -aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/libpng/ SOURCEFILE) -aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/protobuf-c/ SOURCEFILE) -aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/zlib/ SOURCEFILE) aux_source_directory(${PROJECT_SOURCE_DIR}/lib_ccx/zvbi/ SOURCEFILE) -set(UTF8PROC_SOURCE ${PROJECT_SOURCE_DIR}/thirdparty/utf8proc/utf8proc.c) +set(UTF8PROC_SOURCE) -set(FREETYPE_SOURCE - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/autofit/autofit.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftbase.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftbbox.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftbdf.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftbitmap.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftcid.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftfntfmt.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftfstype.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftgasp.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftglyph.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftgxval.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftinit.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftlcdfil.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftmm.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftotval.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftpatent.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftpfr.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftstroke.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftsynth.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftsystem.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/fttype1.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftwinfnt.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/bdf/bdf.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/bzip2/ftbzip2.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/cache/ftcache.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/cff/cff.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/cid/type1cid.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/gzip/ftgzip.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/lzw/ftlzw.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/pcf/pcf.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/pfr/pfr.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/psaux/psaux.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/pshinter/pshinter.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/psnames/psnames.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/raster/raster.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/sfnt/sfnt.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/smooth/smooth.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/truetype/truetype.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/type1/type1.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/type42/type42.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/winfonts/winfnt.c - ) +set(FREETYPE_SOURCE) #Windows specific libraries and linker flags if(WIN32) include_directories ("${PROJECT_SOURCE_DIR}/thirdparty/win_spec_incld/") include_directories ("${PROJECT_SOURCE_DIR}/thirdparty/win_iconv/") aux_source_directory ("${PROJECT_SOURCE_DIR}/thirdparty/win_iconv/" SOURCEFILE) set (EXTRA_LIBS ${EXTRA_LIBS} ws2_32 winmm Bcrypt) -else (WIN32) - # Adding some platform specific library path - if(UNIX AND NOT APPLE) - link_directories (/usr/local/lib) - endif() - - if(APPLE) - # Homebrew library paths - link_directories(/usr/local/lib) - link_directories(/opt/homebrew/lib) - endif() endif(WIN32) if(MSVC) @@ -212,9 +139,6 @@ pkg_check_modules (NANOMSG REQUIRED libnanomsg) set (EXTRA_LIBS ${EXTRA_LIBS} ${NANOMSG_STATIC_LIBRARIES}) - include_directories ("${PROJECT_SOURCE_DIR}/thirdparty/protobuf-c/") - aux_source_directory ("${PROJECT_SOURCE_DIR}/thirdparty/protobuf-c/" SOURCEFILE) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_SHARING") endif (PKG_CONFIG_FOUND AND WITH_SHARING) diff --git a/src/lib_ccx/CMakeLists.txt b/src/lib_ccx/CMakeLists.txt index 4f329bcaab...a334d20c4d 100644 --- a/src/lib_ccx/CMakeLists.txt +++ b/src/lib_ccx/CMakeLists.txt @@ -13,9 +13,39 @@ find_package(PkgConfig) pkg_check_modules (GPAC REQUIRED gpac) +set (REQUIRES_PRIVATE "libpng libprotobuf-c") + +if (WITH_FFMPEG) + set (REQUIRES_PRIVATE "${REQUIRES_PRIVATE} libavutil") +endif (WITH_FFMPEG) + +if (WITH_HARDSUBX) + set (REQUIRES_PRIVATE "${REQUIRES_PRIVATE} libavcodec libavformat libswscale tesseract lept") +endif (WITH_HARDSUBX) + set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${GPAC_INCLUDE_DIRS}) set (EXTRA_LIBS ${EXTRA_LIBS} ${GPAC_LIBRARIES}) +pkg_check_modules (PROTOBUFC REQUIRED libprotobuf-c) +set (EXTRA_LIBS ${EXTRA_LIBS} ${PROTOBUFC_LIBRARIES}) +set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${PROTOBUFC_INCLUDE_DIRS}/protobuf-c) + +pkg_check_modules (LIBPNG REQUIRED libpng) +set (EXTRA_LIBS ${EXTRA_LIBS} ${LIBPNG_LIBRARIES}) +set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${LIBPNG_INCLUDE_DIRS}) + +pkg_check_modules (ZLIB REQUIRED zlib) +set (EXTRA_LIBS ${EXTRA_LIBS} ${ZLIB_LIBRARIES}) +set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${ZLIB_INCLUDE_DIRS}) + +pkg_check_modules (UTF8PROC REQUIRED libutf8proc) +set (EXTRA_LIBS ${EXTRA_LIBS} ${UTF8PROC_LIBRARIES}) +set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${UTF8PROC_INCLUDE_DIRS}) + +pkg_check_modules (FREETYPE REQUIRED freetype2) +set (EXTRA_LIBS ${EXTRA_LIBS} ${FREETYPE_LIBRARIES}) +set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${FREETYPE_INCLUDE_DIRS}) + if (WITH_FFMPEG) find_package(PkgConfig) @@ -94,7 +124,7 @@ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDISABLE_RUST") endif (WITHOUT_RUST) -file (GLOB HeaderFiles *.h) +file (GLOB_RECURSE HeaderFiles *.h) file (WRITE ccx.pc "prefix=${CMAKE_INSTALL_PREFIX}\n" "includedir=\${prefix}/include\n" "libdir=\${prefix}/lib\n\n" @@ -102,8 +132,8 @@ "Description: Closed Caption Extraction library\n" "Version: 0.75\n" "Cflags: -I\${includedir}/\n" - "Libs: -L\${libdir} -lccx -lpng\n" - "Libs.private: -lpng\n" + "Libs: -L\${libdir} -lccx\n" + "Requires.private: ${REQUIRES_PRIVATE}\n" ) install (TARGETS ccx DESTINATION lib) diff --git a/src/lib_ccx/params.c b/src/lib_ccx/params.c index eb1562e50c...984070a285 100644 --- a/src/lib_ccx/params.c +++ b/src/lib_ccx/params.c @@ -14,7 +14,7 @@ #include "../lib_hash/sha2.h" #include <string.h> #include <stdio.h> -#include <utf8proc/utf8proc.h> +#include <utf8proc.h> #ifdef ENABLE_OCR #include <tesseract/capi.h> pkgs/by-name/cc/ccextractor/use-rsmpeg-0.15.patch 0 → 100644 +43 −0 Original line number Diff line number Diff line diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock index 5c49573775..3e855aa637 100644 --- a/src/rust/Cargo.lock +++ b/src/rust/Cargo.lock @@ -665,11 +665,10 @@ [[package]] name = "rsmpeg" -version = "0.14.2+ffmpeg.6.1" +version = "0.15.1+ffmpeg.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927012cd6ae43519f519741f4a69602ce3a47cf84750784da124dffd03527cc0" +checksum = "d3ffbead667d06e0c77c4363f83d49a3481cc3838bc9a61882aa07b01e3f63e1" dependencies = [ - "libc", "paste", "rusty_ffmpeg", "thiserror", @@ -711,9 +710,9 @@ [[package]] name = "rusty_ffmpeg" -version = "0.13.3+ffmpeg.6.1" +version = "0.14.1+ffmpeg.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "716adffa5f909c8533611b1dab9ab5666bece35687845865b75ed6a990fc239c" +checksum = "40f4db8e3e23d4a3044d53a41aba5324eae70d3e7fe82375ce833521533bc315" dependencies = [ "bindgen 0.69.4", "camino", diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml index 4c1e73dcf0..68502915dc 100644 --- a/src/rust/Cargo.toml +++ b/src/rust/Cargo.toml @@ -15,7 +15,7 @@ env_logger = "0.8.4" iconv = "0.1.1" palette = "0.6.0" -rsmpeg = { version = "0.14.1", optional = true, features = [ +rsmpeg = { version = "0.15.1", optional = true, features = [ "link_system_ffmpeg", ] } tesseract-sys = { version = "0.5.14", optional = true, default-features = false } Loading
pkgs/by-name/cc/ccextractor/package.nix +105 −36 Original line number Diff line number Diff line Loading @@ -2,72 +2,146 @@ lib, stdenv, fetchFromGitHub, writeTextFile, pkg-config, cmake, libiconv, ninja, cargo, rustc, corrosion, rustPlatform, gpac, protobufc, libpng, zlib, utf8proc, freetype, ffmpeg_7, libarchive, curl, libiconv, enableOcr ? true, makeWrapper, tesseract4, leptonica, ffmpeg_4, tesseract, }: stdenv.mkDerivation (finalAttrs: { pname = "ccextractor"; version = "0.93"; version = "0.94-unstable-2024-08-12"; src = fetchFromGitHub { owner = "CCExtractor"; repo = "ccextractor"; rev = "v${finalAttrs.version}"; hash = "sha256-usVAKBkdd8uz9cD5eLd0hnwGonOJLscRdc+iWDlNXVc="; rev = "92f2ce0fa026b01fb07db6751210e6bd8c8944d3"; hash = "sha256-bp7T9uJK4bauR2Co4lKqqnM6oGa3WZ+1toEKmzOx4mI="; }; 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 '' substituteInPlace src/CMakeLists.txt \ --replace 'add_definitions(-DGPAC_CONFIG_LINUX)' 'add_definitions(-DGPAC_CONFIG_DARWIN)' ''; patches = [ ./remove-default-commit-hash.patch ./remove-vendored-libraries.patch ] ++ finalAttrs.cargoDeps.patches; cmakeDir = "../src"; cargoRoot = "src/rust"; cargoDeps = rustPlatform.fetchCargoTarball { inherit (finalAttrs) src; sourceRoot = "${finalAttrs.src.name}/${finalAttrs.cargoRoot}"; patches = [ ./use-rsmpeg-0.15.patch ]; patchFlags = [ "-p3" ]; hash = "sha256-jh8hHKAad+tCJGwuGdoJp/TMm/IsMrZmz8aag9lj0BA="; }; nativeBuildInputs = [ pkg-config cmake makeWrapper ninja cargo rustc corrosion rustPlatform.cargoSetupHook rustPlatform.bindgenHook ]; buildInputs = [ zlib ] ++ lib.optional (!stdenv.isLinux) libiconv [ gpac protobufc libpng zlib utf8proc freetype ffmpeg_7 libarchive curl libiconv ] ++ lib.optionals enableOcr [ leptonica tesseract4 ffmpeg_4 tesseract ]; cmakeFlags = [ # file RPATH_CHANGE could not write new RPATH: "-DCMAKE_SKIP_BUILD_RPATH=ON" # The tests are all part of one `cargo test` invocation, so let’s # get the output from it. (lib.cmakeFeature "CMAKE_CTEST_ARGUMENTS" "--verbose") # TODO: This (and the corresponding patch) should probably be # removed for the next stable release. (lib.cmakeFeature "GIT_COMMIT_HASH" finalAttrs.src.rev) ] ++ lib.optionals enableOcr [ "-DWITH_OCR=on" "-DWITH_HARDSUBX=on" (lib.cmakeBool "WITH_OCR" true) (lib.cmakeBool "WITH_HARDSUBX" true) ]; postInstall = lib.optionalString enableOcr '' wrapProgram "$out/bin/ccextractor" \ --set TESSDATA_PREFIX "${tesseract4}/share/" env = { FFMPEG_INCLUDE_DIR = "${lib.getDev ffmpeg_7}/include"; # Upstream’s FFmpeg binding crate needs an explicit path to a shared # object to do dynamic linking. The key word is *an* explicit path; # they don’t support passing more than one. This linker script hack # pulls in all the FFmpeg libraries they bind to. # # See: <https://github.com/CCExtractor/rusty_ffmpeg/pull/69> FFMPEG_DLL_PATH = let ffmpegLibNames = [ "avcodec" "avdevice" "avfilter" "avformat" "avutil" "swresample" "swscale" ]; ffmpegLibDir = "${lib.getLib ffmpeg_7}/lib"; ffmpegLibExt = stdenv.hostPlatform.extensions.library; ffmpegLibPath = ffmpegLibName: "${ffmpegLibDir}/lib${ffmpegLibName}.${ffmpegLibExt}"; ffmpegLinkerScript = writeTextFile { name = "ccextractor-ffmpeg-linker-script"; destination = "/lib/ffmpeg.ld"; text = "INPUT(${lib.concatMapStringsSep " " ffmpegLibPath ffmpegLibNames})"; }; in "${ffmpegLinkerScript}/lib/ffmpeg.ld"; }; doCheck = true; postPatch = lib.optionalString enableOcr '' substituteInPlace src/lib_ccx/ocr.c \ --replace-fail 'getenv("TESSDATA_PREFIX")' '"${tesseract}/share"' ''; meta = with lib; { homepage = "https://www.ccextractor.org"; meta = { homepage = "https://www.ccextractor.org/"; changelog = "${finalAttrs.src.meta.homepage}/blob/${finalAttrs.src.rev}/docs/CHANGES.TXT"; description = "Tool that produces subtitles from closed caption data in videos"; longDescription = '' A tool that analyzes video files and produces independent subtitle files from Loading @@ -75,12 +149,7 @@ stdenv.mkDerivation (finalAttrs: { It works on Linux, Windows, and OSX. ''; platforms = lib.platforms.unix; # 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; sourceProvenance = [ lib.sourceTypes.fromSource ]; license = lib.licenses.gpl2Only; maintainers = [ lib.maintainers.emily ]; mainProgram = "ccextractor"; Loading
pkgs/by-name/cc/ccextractor/remove-default-commit-hash.patch 0 → 100644 +14 −0 Original line number Diff line number Diff line diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d7fdda02e3...2738cab631 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -24,9 +24,6 @@ OUTPUT_VARIABLE GIT_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE ) -ELSE(EXISTS "${BASE_PROJ_DIR}/.git") - set(GIT_BRANCH "Unknown") - set(GIT_COMMIT_HASH "Unknown") ENDIF(EXISTS "${BASE_PROJ_DIR}/.git") #Get the date
pkgs/by-name/cc/ccextractor/remove-vendored-libraries.patch 0 → 100644 +187 −0 Original line number Diff line number Diff line diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2738cab631...5bb2b7d17a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -48,93 +48,20 @@ include_directories(${PROJECT_SOURCE_DIR}) include_directories(${PROJECT_SOURCE_DIR}/lib_ccx) include_directories(${PROJECT_SOURCE_DIR}/lib_ccx/zvbi) -include_directories(${PROJECT_SOURCE_DIR}/thirdparty) -include_directories(${PROJECT_SOURCE_DIR}/thirdparty/protobuf-c) include_directories(${PROJECT_SOURCE_DIR}/thirdparty/lib_hash) -include_directories(${PROJECT_SOURCE_DIR}/thirdparty/libpng) -# Check if the operating system is macOS (Darwin) -if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - if(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "arm64") - # ARM Macs - include_directories("/opt/homebrew/include") - include_directories(${PROJECT_SOURCE_DIR}/thirdparty/libpng/arm) - aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/libpng/arm SOURCEFILE) - else() - include_directories("/usr/local/include") - endif() -endif() - -include_directories(${PROJECT_SOURCE_DIR}/thirdparty/zlib) -include_directories(${PROJECT_SOURCE_DIR}/thirdparty/freetype/include) aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/lib_hash/ SOURCEFILE) -aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/libpng/ SOURCEFILE) -aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/protobuf-c/ SOURCEFILE) -aux_source_directory(${PROJECT_SOURCE_DIR}/thirdparty/zlib/ SOURCEFILE) aux_source_directory(${PROJECT_SOURCE_DIR}/lib_ccx/zvbi/ SOURCEFILE) -set(UTF8PROC_SOURCE ${PROJECT_SOURCE_DIR}/thirdparty/utf8proc/utf8proc.c) +set(UTF8PROC_SOURCE) -set(FREETYPE_SOURCE - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/autofit/autofit.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftbase.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftbbox.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftbdf.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftbitmap.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftcid.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftfntfmt.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftfstype.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftgasp.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftglyph.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftgxval.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftinit.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftlcdfil.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftmm.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftotval.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftpatent.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftpfr.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftstroke.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftsynth.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftsystem.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/fttype1.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/base/ftwinfnt.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/bdf/bdf.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/bzip2/ftbzip2.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/cache/ftcache.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/cff/cff.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/cid/type1cid.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/gzip/ftgzip.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/lzw/ftlzw.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/pcf/pcf.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/pfr/pfr.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/psaux/psaux.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/pshinter/pshinter.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/psnames/psnames.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/raster/raster.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/sfnt/sfnt.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/smooth/smooth.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/truetype/truetype.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/type1/type1.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/type42/type42.c - ${PROJECT_SOURCE_DIR}/thirdparty/freetype/winfonts/winfnt.c - ) +set(FREETYPE_SOURCE) #Windows specific libraries and linker flags if(WIN32) include_directories ("${PROJECT_SOURCE_DIR}/thirdparty/win_spec_incld/") include_directories ("${PROJECT_SOURCE_DIR}/thirdparty/win_iconv/") aux_source_directory ("${PROJECT_SOURCE_DIR}/thirdparty/win_iconv/" SOURCEFILE) set (EXTRA_LIBS ${EXTRA_LIBS} ws2_32 winmm Bcrypt) -else (WIN32) - # Adding some platform specific library path - if(UNIX AND NOT APPLE) - link_directories (/usr/local/lib) - endif() - - if(APPLE) - # Homebrew library paths - link_directories(/usr/local/lib) - link_directories(/opt/homebrew/lib) - endif() endif(WIN32) if(MSVC) @@ -212,9 +139,6 @@ pkg_check_modules (NANOMSG REQUIRED libnanomsg) set (EXTRA_LIBS ${EXTRA_LIBS} ${NANOMSG_STATIC_LIBRARIES}) - include_directories ("${PROJECT_SOURCE_DIR}/thirdparty/protobuf-c/") - aux_source_directory ("${PROJECT_SOURCE_DIR}/thirdparty/protobuf-c/" SOURCEFILE) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_SHARING") endif (PKG_CONFIG_FOUND AND WITH_SHARING) diff --git a/src/lib_ccx/CMakeLists.txt b/src/lib_ccx/CMakeLists.txt index 4f329bcaab...a334d20c4d 100644 --- a/src/lib_ccx/CMakeLists.txt +++ b/src/lib_ccx/CMakeLists.txt @@ -13,9 +13,39 @@ find_package(PkgConfig) pkg_check_modules (GPAC REQUIRED gpac) +set (REQUIRES_PRIVATE "libpng libprotobuf-c") + +if (WITH_FFMPEG) + set (REQUIRES_PRIVATE "${REQUIRES_PRIVATE} libavutil") +endif (WITH_FFMPEG) + +if (WITH_HARDSUBX) + set (REQUIRES_PRIVATE "${REQUIRES_PRIVATE} libavcodec libavformat libswscale tesseract lept") +endif (WITH_HARDSUBX) + set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${GPAC_INCLUDE_DIRS}) set (EXTRA_LIBS ${EXTRA_LIBS} ${GPAC_LIBRARIES}) +pkg_check_modules (PROTOBUFC REQUIRED libprotobuf-c) +set (EXTRA_LIBS ${EXTRA_LIBS} ${PROTOBUFC_LIBRARIES}) +set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${PROTOBUFC_INCLUDE_DIRS}/protobuf-c) + +pkg_check_modules (LIBPNG REQUIRED libpng) +set (EXTRA_LIBS ${EXTRA_LIBS} ${LIBPNG_LIBRARIES}) +set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${LIBPNG_INCLUDE_DIRS}) + +pkg_check_modules (ZLIB REQUIRED zlib) +set (EXTRA_LIBS ${EXTRA_LIBS} ${ZLIB_LIBRARIES}) +set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${ZLIB_INCLUDE_DIRS}) + +pkg_check_modules (UTF8PROC REQUIRED libutf8proc) +set (EXTRA_LIBS ${EXTRA_LIBS} ${UTF8PROC_LIBRARIES}) +set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${UTF8PROC_INCLUDE_DIRS}) + +pkg_check_modules (FREETYPE REQUIRED freetype2) +set (EXTRA_LIBS ${EXTRA_LIBS} ${FREETYPE_LIBRARIES}) +set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${FREETYPE_INCLUDE_DIRS}) + if (WITH_FFMPEG) find_package(PkgConfig) @@ -94,7 +124,7 @@ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDISABLE_RUST") endif (WITHOUT_RUST) -file (GLOB HeaderFiles *.h) +file (GLOB_RECURSE HeaderFiles *.h) file (WRITE ccx.pc "prefix=${CMAKE_INSTALL_PREFIX}\n" "includedir=\${prefix}/include\n" "libdir=\${prefix}/lib\n\n" @@ -102,8 +132,8 @@ "Description: Closed Caption Extraction library\n" "Version: 0.75\n" "Cflags: -I\${includedir}/\n" - "Libs: -L\${libdir} -lccx -lpng\n" - "Libs.private: -lpng\n" + "Libs: -L\${libdir} -lccx\n" + "Requires.private: ${REQUIRES_PRIVATE}\n" ) install (TARGETS ccx DESTINATION lib) diff --git a/src/lib_ccx/params.c b/src/lib_ccx/params.c index eb1562e50c...984070a285 100644 --- a/src/lib_ccx/params.c +++ b/src/lib_ccx/params.c @@ -14,7 +14,7 @@ #include "../lib_hash/sha2.h" #include <string.h> #include <stdio.h> -#include <utf8proc/utf8proc.h> +#include <utf8proc.h> #ifdef ENABLE_OCR #include <tesseract/capi.h>
pkgs/by-name/cc/ccextractor/use-rsmpeg-0.15.patch 0 → 100644 +43 −0 Original line number Diff line number Diff line diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock index 5c49573775..3e855aa637 100644 --- a/src/rust/Cargo.lock +++ b/src/rust/Cargo.lock @@ -665,11 +665,10 @@ [[package]] name = "rsmpeg" -version = "0.14.2+ffmpeg.6.1" +version = "0.15.1+ffmpeg.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927012cd6ae43519f519741f4a69602ce3a47cf84750784da124dffd03527cc0" +checksum = "d3ffbead667d06e0c77c4363f83d49a3481cc3838bc9a61882aa07b01e3f63e1" dependencies = [ - "libc", "paste", "rusty_ffmpeg", "thiserror", @@ -711,9 +710,9 @@ [[package]] name = "rusty_ffmpeg" -version = "0.13.3+ffmpeg.6.1" +version = "0.14.1+ffmpeg.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "716adffa5f909c8533611b1dab9ab5666bece35687845865b75ed6a990fc239c" +checksum = "40f4db8e3e23d4a3044d53a41aba5324eae70d3e7fe82375ce833521533bc315" dependencies = [ "bindgen 0.69.4", "camino", diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml index 4c1e73dcf0..68502915dc 100644 --- a/src/rust/Cargo.toml +++ b/src/rust/Cargo.toml @@ -15,7 +15,7 @@ env_logger = "0.8.4" iconv = "0.1.1" palette = "0.6.0" -rsmpeg = { version = "0.14.1", optional = true, features = [ +rsmpeg = { version = "0.15.1", optional = true, features = [ "link_system_ffmpeg", ] } tesseract-sys = { version = "0.5.14", optional = true, default-features = false }