Skip to content

Commit 2e429f1

Browse files
committed
fix(ffmpeg): only do git fetch for dependencies we're actually building
Gentoo uses the system-wide versions, so these directories are empty, causing git to fail. Signed-off-by: James Le Cuirot <chewi@gentoo.org>
1 parent cee2d5d commit 2e429f1

5 files changed

Lines changed: 17 additions & 9 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ option(BUILD_FFMPEG_VULKAN_PATCHES "Apply FFmpeg Vulkan patches" ON)
4040

4141
# common includes
4242
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/apply_git_patch.cmake)
43+
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/git_fetch_tags.cmake)
4344
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/unix_path.cmake)
4445

4546
# CPM

cmake/ffmpeg/_main.cmake

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
# x265.pc will not be installed if their cmake cannot detect the latest tag
2-
# SVT-AV1 cannot determine version if the git history is not available
3-
foreach(repo "x265_git" "SVT-AV1")
4-
execute_process(
5-
COMMAND git -C "${CMAKE_CURRENT_SOURCE_DIR}/third-party/FFmpeg/${repo}" fetch --tags --depth=1
6-
COMMAND_ERROR_IS_FATAL ANY
7-
)
8-
endforeach()
9-
101
# the destination directory needs to be same level down as the original source directory
112
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/third-party/FFmpeg DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
123
PATTERN "Vulkan-Loader/tests" EXCLUDE) # vulkan loader test files contain emojis in file names which can fail

cmake/ffmpeg/svt_av1.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# SVT-AV1 cannot determine version if the git history is not available
2+
GIT_FETCH_TAGS("third-party/FFmpeg/SVT-AV1")
3+
14
set(SVT_AV1_GENERATED_SRC_PATH ${CMAKE_CURRENT_BINARY_DIR}/FFmpeg/SVT-AV1)
25

36
if(BUILD_FFMPEG_ALL_PATCHES OR BUILD_FFMPEG_SVT_AV1_PATCHES)

cmake/ffmpeg/x265.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# x265.pc will not be installed if their cmake cannot detect the latest tag
2+
GIT_FETCH_TAGS("third-party/FFmpeg/x265_git")
3+
14
set(X265_GENERATED_SRC_PATH ${CMAKE_CURRENT_BINARY_DIR}/FFmpeg/x265_git)
25

36
file(GLOB X265_GIT_FILES ${CMAKE_CURRENT_SOURCE_DIR}/patches/FFmpeg/x265_git/*.patch)

cmake/git_fetch_tags.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This macro fetches tags for the given git repository
2+
# Arguments are path to git repository
3+
4+
# GIT_FETCH_TAGS: args = `repo_path`
5+
macro(GIT_FETCH_TAGS repo_path)
6+
execute_process(
7+
COMMAND git -C "${CMAKE_CURRENT_SOURCE_DIR}/${repo_path}" fetch --tags --depth=1
8+
COMMAND_ERROR_IS_FATAL ANY
9+
)
10+
endmacro()

0 commit comments

Comments
 (0)