mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 09:49:07 +08:00
[ffmpeg] use toolchain (#28758)
* [ffmpeg] setup toolchain more completly. * v db * fix build issues? * only use ld for windows * add SAVE_LOG_FILES * add pkgconf.exe * v db
This commit is contained in:
parent
94bfbda514
commit
c2a2bf5673
@ -2,7 +2,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
export PATH="/usr/bin:$PATH"
|
||||
export PATH="$PATH:/usr/bin"
|
||||
|
||||
command -v cygpath >/dev/null && have_cygpath=1
|
||||
|
||||
@ -91,7 +91,7 @@ OSX_ARCH_COUNT=0@OSX_ARCH_COUNT@
|
||||
build_ffmpeg() {
|
||||
echo "=== CONFIGURING ==="
|
||||
|
||||
sh "$PATH_TO_SRC_DIR/configure" "--prefix=$PATH_TO_PACKAGE_DIR" "--cc=$CC" @CONFIGURE_OPTIONS@ $@
|
||||
sh "$PATH_TO_SRC_DIR/configure" "--prefix=$PATH_TO_PACKAGE_DIR" @CONFIGURE_OPTIONS@ $@
|
||||
|
||||
echo "=== BUILDING ==="
|
||||
|
||||
|
@ -57,8 +57,10 @@ if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" OR VCPKG_TARGET_ARCHITECTURE STREQUA
|
||||
endif()
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
vcpkg_acquire_msys(MSYS_ROOT)
|
||||
vcpkg_acquire_msys(MSYS_ROOT PACKAGES automake1.16)
|
||||
set(SHELL "${MSYS_ROOT}/usr/bin/bash.exe")
|
||||
vcpkg_add_to_path("${MSYS_ROOT}/usr/share/automake-1.16")
|
||||
string(APPEND OPTIONS " --pkg-config=${CURRENT_HOST_INSTALLED_DIR}/tools/pkgconf/pkgconf${VCPKG_HOST_EXECUTABLE_SUFFIX}")
|
||||
else()
|
||||
set(SHELL /bin/sh)
|
||||
endif()
|
||||
@ -84,8 +86,8 @@ endif()
|
||||
|
||||
vcpkg_cmake_get_vars(cmake_vars_file)
|
||||
include("${cmake_vars_file}")
|
||||
|
||||
if(VCPKG_DETECTED_MSVC)
|
||||
string(APPEND OPTIONS " --disable-inline-asm") # clang-cl has inline assembly but this leads to undefined symbols.
|
||||
set(OPTIONS "--toolchain=msvc ${OPTIONS}")
|
||||
# This is required because ffmpeg depends upon optimizations to link correctly
|
||||
string(APPEND VCPKG_COMBINED_C_FLAGS_DEBUG " -O2")
|
||||
@ -97,9 +99,74 @@ endif()
|
||||
string(APPEND VCPKG_COMBINED_C_FLAGS_DEBUG " -I \"${CURRENT_INSTALLED_DIR}/include\"")
|
||||
string(APPEND VCPKG_COMBINED_C_FLAGS_RELEASE " -I \"${CURRENT_INSTALLED_DIR}/include\"")
|
||||
|
||||
set(_csc_PROJECT_PATH ffmpeg)
|
||||
## Setup vcpkg toolchain
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
|
||||
set(ENV_LIB_PATH "$ENV{${LIB_PATH_VAR}}")
|
||||
|
||||
set(prog_env "")
|
||||
|
||||
if(VCPKG_DETECTED_CMAKE_C_COMPILER)
|
||||
get_filename_component(CC_path "${VCPKG_DETECTED_CMAKE_C_COMPILER}" DIRECTORY)
|
||||
get_filename_component(CC_filename "${VCPKG_DETECTED_CMAKE_C_COMPILER}" NAME)
|
||||
set(ENV{CC} "${CC_filename}")
|
||||
string(APPEND OPTIONS " --cc=${CC_filename}")
|
||||
#string(APPEND OPTIONS " --host_cc=${CC_filename}") ffmpeg not yet setup for cross builds?
|
||||
list(APPEND prog_env "${CC_path}")
|
||||
endif()
|
||||
|
||||
if(VCPKG_DETECTED_CMAKE_CXX_COMPILER)
|
||||
get_filename_component(CXX_path "${VCPKG_DETECTED_CMAKE_CXX_COMPILER}" DIRECTORY)
|
||||
get_filename_component(CXX_filename "${VCPKG_DETECTED_CMAKE_CXX_COMPILER}" NAME)
|
||||
set(ENV{CXX} "${CXX_filename}")
|
||||
string(APPEND OPTIONS " --cxx=${CXX_filename}")
|
||||
#string(APPEND OPTIONS " --host_cxx=${CC_filename}")
|
||||
list(APPEND prog_env "${CXX_path}")
|
||||
endif()
|
||||
|
||||
if(VCPKG_DETECTED_CMAKE_RC_COMPILER)
|
||||
get_filename_component(RC_path "${VCPKG_DETECTED_CMAKE_RC_COMPILER}" DIRECTORY)
|
||||
get_filename_component(RC_filename "${VCPKG_DETECTED_CMAKE_RC_COMPILER}" NAME)
|
||||
set(ENV{WINDRES} "${RC_filename}")
|
||||
string(APPEND OPTIONS " --windres=${RC_filename}")
|
||||
list(APPEND prog_env "${RC_path}")
|
||||
endif()
|
||||
|
||||
if(VCPKG_DETECTED_CMAKE_LINKER AND VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
||||
get_filename_component(LD_path "${VCPKG_DETECTED_CMAKE_LINKER}" DIRECTORY)
|
||||
get_filename_component(LD_filename "${VCPKG_DETECTED_CMAKE_LINKER}" NAME)
|
||||
set(ENV{LD} "${LD_filename}")
|
||||
string(APPEND OPTIONS " --ld=${LD_filename}")
|
||||
#string(APPEND OPTIONS " --host_ld=${LD_filename}")
|
||||
list(APPEND prog_env "${LD_path}")
|
||||
endif()
|
||||
|
||||
if(VCPKG_DETECTED_CMAKE_NM)
|
||||
get_filename_component(NM_path "${VCPKG_DETECTED_CMAKE_NM}" DIRECTORY)
|
||||
get_filename_component(NM_filename "${VCPKG_DETECTED_CMAKE_NM}" NAME)
|
||||
set(ENV{NM} "${NM_filename}")
|
||||
string(APPEND OPTIONS " --nm=${NM_filename}")
|
||||
list(APPEND prog_env "${NM_path}")
|
||||
endif()
|
||||
|
||||
if(VCPKG_DETECTED_CMAKE_AR)
|
||||
get_filename_component(AR_path "${VCPKG_DETECTED_CMAKE_AR}" DIRECTORY)
|
||||
get_filename_component(AR_filename "${VCPKG_DETECTED_CMAKE_AR}" NAME)
|
||||
if(AR_filename MATCHES [[^(llvm-)?lib\.exe$]])
|
||||
set(ENV{AR} "ar-lib ${AR_filename}")
|
||||
string(APPEND OPTIONS " --ar='ar-lib ${AR_filename}'")
|
||||
else()
|
||||
set(ENV{AR} "${AR_filename}")
|
||||
string(APPEND OPTIONS " --ar='${AR_filename}'")
|
||||
endif()
|
||||
list(APPEND prog_env "${AR_path}")
|
||||
endif()
|
||||
|
||||
list(REMOVE_DUPLICATES prog_env)
|
||||
vcpkg_add_to_path(PREPEND ${prog_env})
|
||||
|
||||
# More? RANLIB OBJCC STRIP BIN2C
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
|
||||
|
||||
set(FFMPEG_PKGCONFIG_MODULES libavutil)
|
||||
|
||||
@ -471,7 +538,7 @@ if (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_TARGET_ARCHITECTURE STREQU
|
||||
vcpkg_find_acquire_program(GASPREPROCESSOR)
|
||||
foreach(GAS_PATH ${GASPREPROCESSOR})
|
||||
get_filename_component(GAS_ITEM_PATH ${GAS_PATH} DIRECTORY)
|
||||
set(ENV{PATH} "$ENV{PATH}${VCPKG_HOST_PATH_SEPARATOR}${GAS_ITEM_PATH}")
|
||||
vcpkg_add_to_path("${GAS_ITEM_PATH}")
|
||||
endforeach(GAS_PATH)
|
||||
endif()
|
||||
endif()
|
||||
@ -503,15 +570,6 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
set(OPTIONS "${OPTIONS} --pkg-config-flags=--static")
|
||||
endif()
|
||||
|
||||
set(ENV_LIB_PATH "$ENV{${LIB_PATH_VAR}}")
|
||||
|
||||
get_filename_component(CC_path "${VCPKG_DETECTED_CMAKE_C_COMPILER}" DIRECTORY)
|
||||
get_filename_component(CC_filename "${VCPKG_DETECTED_CMAKE_C_COMPILER}" NAME)
|
||||
set(ENV{CC} "${CC_filename}")
|
||||
if(CC_path)
|
||||
vcpkg_add_to_path(PREPEND "${CC_path}")
|
||||
endif()
|
||||
|
||||
message(STATUS "Building Options: ${OPTIONS}")
|
||||
|
||||
# Release build
|
||||
@ -519,7 +577,7 @@ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
message(STATUS "Building Release Options: ${OPTIONS_RELEASE}")
|
||||
set(ENV{${LIB_PATH_VAR}} "${CURRENT_INSTALLED_DIR}/lib${VCPKG_HOST_PATH_SEPARATOR}${ENV_LIB_PATH}")
|
||||
set(ENV{PKG_CONFIG_PATH} "${CURRENT_INSTALLED_DIR}/lib/pkgconfig")
|
||||
message(STATUS "Building ${_csc_PROJECT_PATH} for Release")
|
||||
message(STATUS "Building ${PORT} for Release")
|
||||
file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
|
||||
# We use response files here as the only known way to handle spaces in paths
|
||||
set(crsp "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/cflags.rsp")
|
||||
@ -533,6 +591,7 @@ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
set(ENV{ASFLAGS} "@${crsp}")
|
||||
endif()
|
||||
set(ENV{LDFLAGS} "@${ldrsp}")
|
||||
set(ENV{ARFLAGS} "${VCPKG_COMBINED_STATIC_LINKER_FLAGS_RELEASE}")
|
||||
|
||||
set(BUILD_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
|
||||
set(CONFIGURE_OPTIONS "${OPTIONS} ${OPTIONS_RELEASE}")
|
||||
@ -544,6 +603,7 @@ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
COMMAND "${SHELL}" ./build.sh
|
||||
WORKING_DIRECTORY "${BUILD_DIR}"
|
||||
LOGNAME "build-${TARGET_TRIPLET}-rel"
|
||||
SAVE_LOG_FILES ffbuild/config.log
|
||||
)
|
||||
endif()
|
||||
|
||||
@ -553,7 +613,7 @@ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
set(ENV{${LIB_PATH_VAR}} "${CURRENT_INSTALLED_DIR}/debug/lib${VCPKG_HOST_PATH_SEPARATOR}${ENV_LIB_PATH}")
|
||||
set(ENV{LDFLAGS} "${VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG}")
|
||||
set(ENV{PKG_CONFIG_PATH} "${CURRENT_INSTALLED_DIR}/debug/lib/pkgconfig")
|
||||
message(STATUS "Building ${_csc_PROJECT_PATH} for Debug")
|
||||
message(STATUS "Building ${PORT} for Debug")
|
||||
file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
|
||||
set(crsp "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/cflags.rsp")
|
||||
file(WRITE "${crsp}" "${VCPKG_COMBINED_C_FLAGS_DEBUG}")
|
||||
@ -564,6 +624,7 @@ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
set(ENV{ASFLAGS} "@${crsp}")
|
||||
endif()
|
||||
set(ENV{LDFLAGS} "@${ldrsp}")
|
||||
set(ENV{ARFLAGS} "${VCPKG_COMBINED_STATIC_LINKER_FLAGS_DEBUG}")
|
||||
|
||||
set(BUILD_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
|
||||
set(CONFIGURE_OPTIONS "${OPTIONS} ${OPTIONS_DEBUG}")
|
||||
@ -575,6 +636,7 @@ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
COMMAND "${SHELL}" ./build.sh
|
||||
WORKING_DIRECTORY "${BUILD_DIR}"
|
||||
LOGNAME "build-${TARGET_TRIPLET}-dbg"
|
||||
SAVE_LOG_FILES ffbuild/config.log
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "ffmpeg",
|
||||
"version": "5.0.2",
|
||||
"port-version": 1,
|
||||
"description": [
|
||||
"a library to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created.",
|
||||
"FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations."
|
||||
|
@ -2338,7 +2338,7 @@
|
||||
},
|
||||
"ffmpeg": {
|
||||
"baseline": "5.0.2",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"ffnvcodec": {
|
||||
"baseline": "11.1.5.0",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "8caa5e4f23e22c213044d4d2322a1504076dea7a",
|
||||
"version": "5.0.2",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "819ed2a6da9f2cbbd43eeb9c2b561424a9efb998",
|
||||
"version": "5.0.2",
|
||||
|
Loading…
Reference in New Issue
Block a user