mirror of
https://github.com/LizardByte/Sunshine.git
synced 2026-08-07 10:20:46 +00:00
build(deps): migrate ffmpeg prebuild to downloaded archive (#4699)
This commit is contained in:
@@ -38,7 +38,6 @@ jobs:
|
|||||||
- name: Release Setup
|
- name: Release Setup
|
||||||
id: release-setup
|
id: release-setup
|
||||||
uses: LizardByte/actions/actions/release_setup@ce5d2be83ba14f30062762579f46d074892c5dd0 # v2026.203.15239
|
uses: LizardByte/actions/actions/release_setup@ce5d2be83ba14f30062762579f46d074892c5dd0 # v2026.203.15239
|
||||||
|
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
[submodule "third-party/build-deps"]
|
[submodule "third-party/build-deps"]
|
||||||
path = third-party/build-deps
|
path = third-party/build-deps
|
||||||
url = https://github.com/LizardByte/build-deps.git
|
url = https://github.com/LizardByte/build-deps.git
|
||||||
branch = dist
|
branch = master
|
||||||
[submodule "third-party/doxyconfig"]
|
[submodule "third-party/doxyconfig"]
|
||||||
path = third-party/doxyconfig
|
path = third-party/doxyconfig
|
||||||
url = https://github.com/LizardByte/doxyconfig.git
|
url = https://github.com/LizardByte/doxyconfig.git
|
||||||
|
|||||||
@@ -27,52 +27,7 @@ pkg_check_modules(MINIUPNP miniupnpc REQUIRED)
|
|||||||
include_directories(SYSTEM ${MINIUPNP_INCLUDE_DIRS})
|
include_directories(SYSTEM ${MINIUPNP_INCLUDE_DIRS})
|
||||||
|
|
||||||
# ffmpeg pre-compiled binaries
|
# ffmpeg pre-compiled binaries
|
||||||
if(NOT DEFINED FFMPEG_PREPARED_BINARIES)
|
include("${CMAKE_MODULE_PATH}/dependencies/ffmpeg.cmake")
|
||||||
if(WIN32)
|
|
||||||
set(FFMPEG_PLATFORM_LIBRARIES mfplat ole32 strmiids mfuuid vpl)
|
|
||||||
elseif(FREEBSD)
|
|
||||||
# numa is not available on FreeBSD
|
|
||||||
set(FFMPEG_PLATFORM_LIBRARIES va va-drm va-x11 X11)
|
|
||||||
elseif(UNIX AND NOT APPLE)
|
|
||||||
set(FFMPEG_PLATFORM_LIBRARIES numa va va-drm va-x11 X11)
|
|
||||||
endif()
|
|
||||||
set(FFMPEG_PREPARED_BINARIES
|
|
||||||
"${CMAKE_SOURCE_DIR}/third-party/build-deps/dist/${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
|
|
||||||
|
|
||||||
# check if the directory exists
|
|
||||||
if(NOT EXISTS "${FFMPEG_PREPARED_BINARIES}")
|
|
||||||
message(FATAL_ERROR
|
|
||||||
"FFmpeg pre-compiled binaries not found at ${FFMPEG_PREPARED_BINARIES}. \
|
|
||||||
Please consider contributing to the LizardByte/build-deps repository. \
|
|
||||||
Optionally, you can use the FFMPEG_PREPARED_BINARIES option to specify the path to the \
|
|
||||||
system-installed FFmpeg libraries")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(EXISTS "${FFMPEG_PREPARED_BINARIES}/lib/libhdr10plus.a")
|
|
||||||
set(HDR10_PLUS_LIBRARY
|
|
||||||
"${FFMPEG_PREPARED_BINARIES}/lib/libhdr10plus.a")
|
|
||||||
endif()
|
|
||||||
set(FFMPEG_LIBRARIES
|
|
||||||
"${FFMPEG_PREPARED_BINARIES}/lib/libavcodec.a"
|
|
||||||
"${FFMPEG_PREPARED_BINARIES}/lib/libswscale.a"
|
|
||||||
"${FFMPEG_PREPARED_BINARIES}/lib/libavutil.a"
|
|
||||||
"${FFMPEG_PREPARED_BINARIES}/lib/libcbs.a"
|
|
||||||
"${FFMPEG_PREPARED_BINARIES}/lib/libSvtAv1Enc.a"
|
|
||||||
"${FFMPEG_PREPARED_BINARIES}/lib/libx264.a"
|
|
||||||
"${FFMPEG_PREPARED_BINARIES}/lib/libx265.a"
|
|
||||||
${HDR10_PLUS_LIBRARY}
|
|
||||||
${FFMPEG_PLATFORM_LIBRARIES})
|
|
||||||
else()
|
|
||||||
set(FFMPEG_LIBRARIES
|
|
||||||
"${FFMPEG_PREPARED_BINARIES}/lib/libavcodec.a"
|
|
||||||
"${FFMPEG_PREPARED_BINARIES}/lib/libswscale.a"
|
|
||||||
"${FFMPEG_PREPARED_BINARIES}/lib/libavutil.a"
|
|
||||||
"${FFMPEG_PREPARED_BINARIES}/lib/libcbs.a"
|
|
||||||
${FFMPEG_PLATFORM_LIBRARIES})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(FFMPEG_INCLUDE_DIRS
|
|
||||||
"${FFMPEG_PREPARED_BINARIES}/include")
|
|
||||||
|
|
||||||
# platform specific dependencies
|
# platform specific dependencies
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
|||||||
@@ -0,0 +1,166 @@
|
|||||||
|
#
|
||||||
|
# Loads FFmpeg pre-compiled binaries from GitHub releases or a user-specified path
|
||||||
|
#
|
||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
|
# ffmpeg pre-compiled binaries
|
||||||
|
if(NOT DEFINED FFMPEG_PREPARED_BINARIES)
|
||||||
|
# Set platform-specific libraries
|
||||||
|
if(WIN32)
|
||||||
|
set(FFMPEG_PLATFORM_LIBRARIES mfplat ole32 strmiids mfuuid vpl)
|
||||||
|
elseif(FREEBSD)
|
||||||
|
# numa is not available on FreeBSD
|
||||||
|
set(FFMPEG_PLATFORM_LIBRARIES va va-drm va-x11 X11)
|
||||||
|
elseif(UNIX AND NOT APPLE)
|
||||||
|
set(FFMPEG_PLATFORM_LIBRARIES numa va va-drm va-x11 X11)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Determine download location
|
||||||
|
set(FFMPEG_DOWNLOAD_DIR "${CMAKE_BINARY_DIR}/_deps")
|
||||||
|
|
||||||
|
# Get the current commit/tag from the build-deps submodule
|
||||||
|
execute_process(
|
||||||
|
COMMAND git -C "${CMAKE_SOURCE_DIR}/third-party/build-deps" describe --tags --exact-match
|
||||||
|
OUTPUT_VARIABLE FFMPEG_RELEASE_TAG
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
ERROR_QUIET
|
||||||
|
)
|
||||||
|
|
||||||
|
# If no exact tag match, try to get the commit hash and look for a tag
|
||||||
|
if(NOT FFMPEG_RELEASE_TAG)
|
||||||
|
execute_process(
|
||||||
|
COMMAND git -C "${CMAKE_SOURCE_DIR}/third-party/build-deps" rev-parse HEAD
|
||||||
|
OUTPUT_VARIABLE BUILD_DEPS_COMMIT
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
ERROR_QUIET
|
||||||
|
)
|
||||||
|
|
||||||
|
# Try to find a tag that points to this commit
|
||||||
|
execute_process(
|
||||||
|
COMMAND git -C "${CMAKE_SOURCE_DIR}/third-party/build-deps" tag --points-at ${BUILD_DEPS_COMMIT}
|
||||||
|
OUTPUT_VARIABLE FFMPEG_RELEASE_TAG
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
ERROR_QUIET
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set GitHub release URL
|
||||||
|
set(FFMPEG_GITHUB_REPO "LizardByte/build-deps")
|
||||||
|
if(FFMPEG_RELEASE_TAG)
|
||||||
|
set(FFMPEG_RELEASE_URL "https://github.com/${FFMPEG_GITHUB_REPO}/releases/download/${FFMPEG_RELEASE_TAG}")
|
||||||
|
set(FFMPEG_VERSION_DIR "${FFMPEG_DOWNLOAD_DIR}/ffmpeg-${FFMPEG_RELEASE_TAG}")
|
||||||
|
message(STATUS "Using FFmpeg from build-deps tag: ${FFMPEG_RELEASE_TAG}")
|
||||||
|
else()
|
||||||
|
set(FFMPEG_RELEASE_URL "https://github.com/${FFMPEG_GITHUB_REPO}/releases/latest/download")
|
||||||
|
set(FFMPEG_VERSION_DIR "${FFMPEG_DOWNLOAD_DIR}/ffmpeg-latest")
|
||||||
|
message(STATUS "Using FFmpeg from latest build-deps release")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set extraction directory and prepared binaries path
|
||||||
|
set(FFMPEG_EXTRACT_DIR "${FFMPEG_DOWNLOAD_DIR}")
|
||||||
|
set(FFMPEG_PREPARED_BINARIES "${FFMPEG_EXTRACT_DIR}/ffmpeg")
|
||||||
|
|
||||||
|
# Set the archive filename based on architecture
|
||||||
|
set(FFMPEG_ARCHIVE_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}-ffmpeg.tar.gz")
|
||||||
|
set(FFMPEG_ARCHIVE_PATH "${FFMPEG_VERSION_DIR}/${FFMPEG_ARCHIVE_NAME}")
|
||||||
|
set(FFMPEG_DOWNLOAD_URL "${FFMPEG_RELEASE_URL}/${FFMPEG_ARCHIVE_NAME}")
|
||||||
|
|
||||||
|
# Check if already downloaded and extracted
|
||||||
|
if(NOT EXISTS "${FFMPEG_PREPARED_BINARIES}/lib/libavcodec.a")
|
||||||
|
# Check if we need to download the archive
|
||||||
|
if(NOT EXISTS "${FFMPEG_ARCHIVE_PATH}")
|
||||||
|
message(STATUS "Downloading FFmpeg binaries from ${FFMPEG_DOWNLOAD_URL}")
|
||||||
|
|
||||||
|
# Download the archive
|
||||||
|
file(DOWNLOAD
|
||||||
|
"${FFMPEG_DOWNLOAD_URL}"
|
||||||
|
"${FFMPEG_ARCHIVE_PATH}"
|
||||||
|
SHOW_PROGRESS
|
||||||
|
STATUS FFMPEG_DOWNLOAD_STATUS
|
||||||
|
TIMEOUT 300
|
||||||
|
)
|
||||||
|
|
||||||
|
# Check download status
|
||||||
|
list(GET FFMPEG_DOWNLOAD_STATUS 0 FFMPEG_DOWNLOAD_STATUS_CODE)
|
||||||
|
list(GET FFMPEG_DOWNLOAD_STATUS 1 FFMPEG_DOWNLOAD_STATUS_MESSAGE)
|
||||||
|
|
||||||
|
if(NOT FFMPEG_DOWNLOAD_STATUS_CODE EQUAL 0)
|
||||||
|
message(FATAL_ERROR "Failed to download FFmpeg binaries: ${FFMPEG_DOWNLOAD_STATUS_MESSAGE}")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(STATUS "Using cached FFmpeg archive at ${FFMPEG_ARCHIVE_PATH}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Extract the archive
|
||||||
|
message(STATUS "Extracting FFmpeg binaries to ${FFMPEG_EXTRACT_DIR}")
|
||||||
|
file(ARCHIVE_EXTRACT # cmake-lint: disable=E1126
|
||||||
|
INPUT "${FFMPEG_ARCHIVE_PATH}"
|
||||||
|
DESTINATION "${FFMPEG_EXTRACT_DIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Verify extraction
|
||||||
|
if(NOT EXISTS "${FFMPEG_PREPARED_BINARIES}/lib/libavcodec.a")
|
||||||
|
message(FATAL_ERROR "FFmpeg extraction failed or unexpected directory structure")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "FFmpeg binaries successfully downloaded and extracted")
|
||||||
|
else()
|
||||||
|
message(STATUS "Using existing FFmpeg binaries at ${FFMPEG_PREPARED_BINARIES}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set FFmpeg libraries
|
||||||
|
if(EXISTS "${FFMPEG_PREPARED_BINARIES}/lib/libhdr10plus.a")
|
||||||
|
set(HDR10_PLUS_LIBRARY "${FFMPEG_PREPARED_BINARIES}/lib/libhdr10plus.a")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(FFMPEG_LIBRARIES
|
||||||
|
"${FFMPEG_PREPARED_BINARIES}/lib/libavcodec.a"
|
||||||
|
"${FFMPEG_PREPARED_BINARIES}/lib/libswscale.a"
|
||||||
|
"${FFMPEG_PREPARED_BINARIES}/lib/libavutil.a"
|
||||||
|
"${FFMPEG_PREPARED_BINARIES}/lib/libcbs.a"
|
||||||
|
"${FFMPEG_PREPARED_BINARIES}/lib/libSvtAv1Enc.a"
|
||||||
|
"${FFMPEG_PREPARED_BINARIES}/lib/libx264.a"
|
||||||
|
"${FFMPEG_PREPARED_BINARIES}/lib/libx265.a"
|
||||||
|
${HDR10_PLUS_LIBRARY}
|
||||||
|
${FFMPEG_PLATFORM_LIBRARIES}
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
# User provided FFMPEG_PREPARED_BINARIES path
|
||||||
|
message(STATUS "Using user-specified FFmpeg binaries at ${FFMPEG_PREPARED_BINARIES}")
|
||||||
|
|
||||||
|
# Set platform-specific libraries
|
||||||
|
if(WIN32)
|
||||||
|
set(FFMPEG_PLATFORM_LIBRARIES mfplat ole32 strmiids mfuuid vpl)
|
||||||
|
elseif(FREEBSD)
|
||||||
|
set(FFMPEG_PLATFORM_LIBRARIES va va-drm va-x11 X11)
|
||||||
|
elseif(UNIX AND NOT APPLE)
|
||||||
|
set(FFMPEG_PLATFORM_LIBRARIES numa va va-drm va-x11 X11)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set base FFmpeg libraries (always required)
|
||||||
|
set(FFMPEG_LIBRARIES
|
||||||
|
"${FFMPEG_PREPARED_BINARIES}/lib/libavcodec.a"
|
||||||
|
"${FFMPEG_PREPARED_BINARIES}/lib/libswscale.a"
|
||||||
|
"${FFMPEG_PREPARED_BINARIES}/lib/libavutil.a"
|
||||||
|
"${FFMPEG_PREPARED_BINARIES}/lib/libcbs.a"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Add optional libraries if they exist (e.g., from prebuilt packages)
|
||||||
|
if(EXISTS "${FFMPEG_PREPARED_BINARIES}/lib/libSvtAv1Enc.a")
|
||||||
|
list(APPEND FFMPEG_LIBRARIES "${FFMPEG_PREPARED_BINARIES}/lib/libSvtAv1Enc.a")
|
||||||
|
endif()
|
||||||
|
if(EXISTS "${FFMPEG_PREPARED_BINARIES}/lib/libx264.a")
|
||||||
|
list(APPEND FFMPEG_LIBRARIES "${FFMPEG_PREPARED_BINARIES}/lib/libx264.a")
|
||||||
|
endif()
|
||||||
|
if(EXISTS "${FFMPEG_PREPARED_BINARIES}/lib/libx265.a")
|
||||||
|
list(APPEND FFMPEG_LIBRARIES "${FFMPEG_PREPARED_BINARIES}/lib/libx265.a")
|
||||||
|
endif()
|
||||||
|
if(EXISTS "${FFMPEG_PREPARED_BINARIES}/lib/libhdr10plus.a")
|
||||||
|
list(APPEND FFMPEG_LIBRARIES "${FFMPEG_PREPARED_BINARIES}/lib/libhdr10plus.a")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Add platform libraries
|
||||||
|
list(APPEND FFMPEG_LIBRARIES ${FFMPEG_PLATFORM_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(FFMPEG_INCLUDE_DIRS "${FFMPEG_PREPARED_BINARIES}/include")
|
||||||
@@ -46,6 +46,9 @@ modules:
|
|||||||
# Caching is configured until here, not including CUDA, since it is too large for GitHub cache
|
# Caching is configured until here, not including CUDA, since it is too large for GitHub cache
|
||||||
- "modules/cuda.json"
|
- "modules/cuda.json"
|
||||||
|
|
||||||
|
# FFmpeg prebuilt binaries
|
||||||
|
- "modules/ffmpeg.json"
|
||||||
|
|
||||||
- name: sunshine
|
- name: sunshine
|
||||||
builddir: true
|
builddir: true
|
||||||
build-options:
|
build-options:
|
||||||
@@ -66,6 +69,7 @@ modules:
|
|||||||
- -DBUILD_WERROR=ON
|
- -DBUILD_WERROR=ON
|
||||||
- -DCMAKE_BUILD_TYPE=Release
|
- -DCMAKE_BUILD_TYPE=Release
|
||||||
- -DCMAKE_CUDA_COMPILER=/app/cuda/bin/nvcc
|
- -DCMAKE_CUDA_COMPILER=/app/cuda/bin/nvcc
|
||||||
|
- -DFFMPEG_PREPARED_BINARIES=/app/ffmpeg
|
||||||
- -DSUNSHINE_ASSETS_DIR=share/sunshine
|
- -DSUNSHINE_ASSETS_DIR=share/sunshine
|
||||||
- -DSUNSHINE_BUILD_FLATPAK=ON
|
- -DSUNSHINE_BUILD_FLATPAK=ON
|
||||||
- -DSUNSHINE_EXECUTABLE_PATH=/app/bin/sunshine
|
- -DSUNSHINE_EXECUTABLE_PATH=/app/bin/sunshine
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"name": "ffmpeg-prebuilt",
|
||||||
|
"buildsystem": "simple",
|
||||||
|
"build-commands": [
|
||||||
|
"mkdir -p /app/ffmpeg",
|
||||||
|
"tar -xzf ffmpeg.tar.gz -C /app/ffmpeg --strip-components=1"
|
||||||
|
],
|
||||||
|
"sources": [
|
||||||
|
{
|
||||||
|
"type": "file",
|
||||||
|
"url": "https://github.com/LizardByte/build-deps/releases/download/v2026.209.233149/Linux-x86_64-ffmpeg.tar.gz",
|
||||||
|
"sha256": "bb2375992213bda08b666643495297c3fcdd08cf08600cf4dfd42eee52556e55",
|
||||||
|
"dest-filename": "ffmpeg.tar.gz",
|
||||||
|
"only-arches": [
|
||||||
|
"x86_64"
|
||||||
|
],
|
||||||
|
"x-checker-data": {
|
||||||
|
"type": "json",
|
||||||
|
"url": "https://api.github.com/repos/LizardByte/build-deps/releases/latest",
|
||||||
|
"version-query": ".tag_name",
|
||||||
|
"url-query": ".assets[] | select(.name==\"Linux-x86_64-ffmpeg.tar.gz\") | .browser_download_url"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "file",
|
||||||
|
"url": "https://github.com/LizardByte/build-deps/releases/download/v2026.209.233149/Linux-aarch64-ffmpeg.tar.gz",
|
||||||
|
"sha256": "841f8ac4586ee1465a357a2ad3eab6cfb2a1677188508eefe150596fd0024ad9",
|
||||||
|
"dest-filename": "ffmpeg.tar.gz",
|
||||||
|
"only-arches": [
|
||||||
|
"aarch64"
|
||||||
|
],
|
||||||
|
"x-checker-data": {
|
||||||
|
"type": "json",
|
||||||
|
"url": "https://api.github.com/repos/LizardByte/build-deps/releases/latest",
|
||||||
|
"version-query": ".tag_name",
|
||||||
|
"url-query": ".assets[] | select(.name==\"Linux-aarch64-ffmpeg.tar.gz\") | .browser_download_url"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Vendored
+1
-1
Submodule third-party/build-deps updated: 4f5e8b264e...d4b980b189
Reference in New Issue
Block a user