-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
ccextractor: 0.93 -> 0.94-unstable-2024-08-12 #331615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
83b327f
ccextractor: move to `pkgs/by-name`
emilazy c3a8cb1
ccextractor: format with `nixfmt-rfc-style`
emilazy b546361
ccextractor: modernize
emilazy 9800258
ccextractor: adopt
emilazy 9562b3d
ccextractor: 0.93 -> 0.94-unstable-2024-08-12
emilazy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,157 @@ | ||
| { | ||
| lib, | ||
| stdenv, | ||
| fetchFromGitHub, | ||
| writeTextFile, | ||
|
|
||
| pkg-config, | ||
| cmake, | ||
| ninja, | ||
| cargo, | ||
| rustc, | ||
| corrosion, | ||
| rustPlatform, | ||
|
|
||
| gpac, | ||
| protobufc, | ||
| libpng, | ||
| zlib, | ||
| utf8proc, | ||
| freetype, | ||
| ffmpeg_7, | ||
| libarchive, | ||
| curl, | ||
| libiconv, | ||
|
|
||
| enableOcr ? true, | ||
| leptonica, | ||
| tesseract, | ||
| }: | ||
|
|
||
| stdenv.mkDerivation (finalAttrs: { | ||
| pname = "ccextractor"; | ||
| version = "0.94-unstable-2024-08-12"; | ||
|
|
||
| src = fetchFromGitHub { | ||
| owner = "CCExtractor"; | ||
| repo = "ccextractor"; | ||
| rev = "92f2ce0fa026b01fb07db6751210e6bd8c8944d3"; | ||
| hash = "sha256-bp7T9uJK4bauR2Co4lKqqnM6oGa3WZ+1toEKmzOx4mI="; | ||
| }; | ||
|
|
||
| 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 | ||
| ninja | ||
| cargo | ||
| rustc | ||
| corrosion | ||
| rustPlatform.cargoSetupHook | ||
| rustPlatform.bindgenHook | ||
| ]; | ||
|
|
||
| buildInputs = | ||
| [ | ||
| gpac | ||
| protobufc | ||
| libpng | ||
| zlib | ||
| utf8proc | ||
| freetype | ||
| ffmpeg_7 | ||
| libarchive | ||
| curl | ||
| libiconv | ||
| ] | ||
| ++ lib.optionals enableOcr [ | ||
| leptonica | ||
| tesseract | ||
| ]; | ||
|
|
||
| cmakeFlags = | ||
| [ | ||
| # 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 [ | ||
| (lib.cmakeBool "WITH_OCR" true) | ||
| (lib.cmakeBool "WITH_HARDSUBX" true) | ||
| ]; | ||
|
|
||
| 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 = { | ||
| 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 | ||
| closed captions data. CCExtractor is portable, small, and very fast. | ||
| It works on Linux, Windows, and OSX. | ||
| ''; | ||
| platforms = lib.platforms.unix; | ||
| sourceProvenance = [ lib.sourceTypes.fromSource ]; | ||
| license = lib.licenses.gpl2Only; | ||
| maintainers = [ lib.maintainers.emily ]; | ||
| mainProgram = "ccextractor"; | ||
| }; | ||
| }) | ||
14 changes: 14 additions & 0 deletions
14
pkgs/by-name/cc/ccextractor/remove-default-commit-hash.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| 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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the explicit link, we can way easier click on that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the changelog depends on the version, there’s no way to make this a direct link. To quote the Nixpkgs manual: