mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-27 19:19:01 +08:00
[ffmpeg] Fix build on windows (#40420)
This commit is contained in:
parent
67cd68d6f0
commit
c2a2189c1e
@ -2,19 +2,6 @@
|
||||
|
||||
set -e
|
||||
|
||||
export PATH="$PATH:/usr/bin"
|
||||
|
||||
command -v cygpath >/dev/null && have_cygpath=1
|
||||
|
||||
cygpath() {
|
||||
if [ -n "$have_cygpath" ]; then
|
||||
command cygpath "$@"
|
||||
else
|
||||
eval _p='$'$#
|
||||
printf '%s\n' "$_p"
|
||||
fi
|
||||
}
|
||||
|
||||
move_binary() {
|
||||
SOURCE=$1
|
||||
TARGET=$2
|
||||
@ -70,15 +57,9 @@ merge_binaries() {
|
||||
done
|
||||
}
|
||||
|
||||
export PKG_CONFIG_PATH="$(cygpath -p "${PKG_CONFIG_PATH}")"
|
||||
|
||||
# Export HTTP(S)_PROXY as http(s)_proxy:
|
||||
[ -n "$HTTP_PROXY" ] && export http_proxy="$HTTP_PROXY"
|
||||
[ -n "$HTTPS_PROXY" ] && export https_proxy="$HTTPS_PROXY"
|
||||
|
||||
PATH_TO_BUILD_DIR=$( cygpath "@BUILD_DIR@")
|
||||
PATH_TO_SRC_DIR=$( cygpath "@SOURCE_PATH@")
|
||||
PATH_TO_PACKAGE_DIR=$(cygpath "@INST_PREFIX@")
|
||||
PATH_TO_BUILD_DIR="@BUILD_DIR@"
|
||||
PATH_TO_SRC_DIR="@SOURCE_PATH@"
|
||||
PATH_TO_PACKAGE_DIR="@INST_PREFIX@"
|
||||
|
||||
JOBS=@VCPKG_CONCURRENCY@
|
||||
|
||||
|
@ -32,15 +32,6 @@ endif()
|
||||
|
||||
set(OPTIONS "--enable-pic --disable-doc --enable-debug --enable-runtime-cpudetect --disable-autodetect")
|
||||
|
||||
if(VCPKG_HOST_IS_WINDOWS)
|
||||
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()
|
||||
find_program(SHELL bash)
|
||||
endif()
|
||||
|
||||
if(VCPKG_TARGET_IS_MINGW)
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
|
||||
string(APPEND OPTIONS " --target-os=mingw32")
|
||||
@ -159,6 +150,14 @@ if(VCPKG_DETECTED_CMAKE_STRIP)
|
||||
list(APPEND prog_env "${STRIP_path}")
|
||||
endif()
|
||||
|
||||
if(VCPKG_HOST_IS_WINDOWS)
|
||||
vcpkg_acquire_msys(MSYS_ROOT PACKAGES automake1.16)
|
||||
set(SHELL "${MSYS_ROOT}/usr/bin/bash.exe")
|
||||
list(APPEND prog_env "${MSYS_ROOT}/usr/bin" "${MSYS_ROOT}/usr/share/automake-1.16")
|
||||
else()
|
||||
find_program(SHELL bash)
|
||||
endif()
|
||||
|
||||
list(REMOVE_DUPLICATES prog_env)
|
||||
vcpkg_add_to_path(PREPEND ${prog_env})
|
||||
|
||||
@ -703,7 +702,6 @@ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
set(OPTIONS_RELEASE "${OPTIONS_RELEASE} --extra-ldflags=-L\"${CURRENT_INSTALLED_DIR}/lib\"")
|
||||
endif()
|
||||
message(STATUS "Building Release Options: ${OPTIONS_RELEASE}")
|
||||
set(ENV{PKG_CONFIG_PATH} "${CURRENT_INSTALLED_DIR}/lib/pkgconfig")
|
||||
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
|
||||
@ -748,8 +746,6 @@ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
set(OPTIONS_DEBUG "${OPTIONS_DEBUG} --extra-ldflags=-L\"${CURRENT_INSTALLED_DIR}/debug/lib\"")
|
||||
endif()
|
||||
message(STATUS "Building Debug Options: ${OPTIONS_DEBUG}")
|
||||
set(ENV{LDFLAGS} "${VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG}")
|
||||
set(ENV{PKG_CONFIG_PATH} "${CURRENT_INSTALLED_DIR}/debug/lib/pkgconfig")
|
||||
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")
|
||||
@ -851,31 +847,9 @@ if (VCPKG_TARGET_IS_WINDOWS)
|
||||
foreach(_debug IN LISTS _dirs)
|
||||
foreach(PKGCONFIG_MODULE IN LISTS FFMPEG_PKGCONFIG_MODULES)
|
||||
set(PKGCONFIG_FILE "${CURRENT_PACKAGES_DIR}${_debug}lib/pkgconfig/${PKGCONFIG_MODULE}.pc")
|
||||
# remove redundant cygwin style -libpath entries
|
||||
execute_process(
|
||||
COMMAND "${MSYS_ROOT}/usr/bin/cygpath.exe" -u "${CURRENT_INSTALLED_DIR}"
|
||||
OUTPUT_VARIABLE CYG_INSTALLED_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
vcpkg_replace_string("${PKGCONFIG_FILE}" "-libpath:${CYG_INSTALLED_DIR}${_debug}lib/pkgconfig/../../lib " "" IGNORE_UNCHANGED)
|
||||
# transform libdir, includedir, and prefix paths from cygwin style to windows style
|
||||
file(READ "${PKGCONFIG_FILE}" PKGCONFIG_CONTENT)
|
||||
foreach(PATH_NAME prefix libdir includedir)
|
||||
string(REGEX MATCH "${PATH_NAME}=[^\n]*" PATH_VALUE "${PKGCONFIG_CONTENT}")
|
||||
string(REPLACE "${PATH_NAME}=" "" PATH_VALUE "${PATH_VALUE}")
|
||||
if(NOT PATH_VALUE)
|
||||
message(FATAL_ERROR "failed to find pkgconfig variable ${PATH_NAME}")
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND "${MSYS_ROOT}/usr/bin/cygpath.exe" -w "${PATH_VALUE}"
|
||||
OUTPUT_VARIABLE FIXED_PATH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
file(TO_CMAKE_PATH "${FIXED_PATH}" FIXED_PATH)
|
||||
vcpkg_replace_string("${PKGCONFIG_FILE}" "${PATH_NAME}=${PATH_VALUE}" "${PATH_NAME}=${FIXED_PATH}")
|
||||
endforeach()
|
||||
# list libraries with -l flag (so pkgconf knows they are libraries and not just linker flags)
|
||||
foreach(LIBS_ENTRY Libs Libs.private)
|
||||
foreach(LIBS_ENTRY IN ITEMS Libs Libs.private)
|
||||
string(REGEX MATCH "${LIBS_ENTRY}: [^\n]*" LIBS_VALUE "${PKGCONFIG_CONTENT}")
|
||||
if(NOT LIBS_VALUE)
|
||||
message(FATAL_ERROR "failed to find pkgconfig entry ${LIBS_ENTRY}")
|
||||
@ -883,11 +857,12 @@ if (VCPKG_TARGET_IS_WINDOWS)
|
||||
string(REPLACE "${LIBS_ENTRY}: " "" LIBS_VALUE "${LIBS_VALUE}")
|
||||
if(LIBS_VALUE)
|
||||
set(LIBS_VALUE_OLD "${LIBS_VALUE}")
|
||||
string(REGEX REPLACE "([^ ]+)[.]lib" "-l\\1" LIBS_VALUE "${LIBS_VALUE}")
|
||||
string(REGEX REPLACE " ([^ ]+)[.]lib" " -l\\1" LIBS_VALUE "${LIBS_VALUE}")
|
||||
set(LIBS_VALUE_NEW "${LIBS_VALUE}")
|
||||
vcpkg_replace_string("${PKGCONFIG_FILE}" "${LIBS_ENTRY}: ${LIBS_VALUE_OLD}" "${LIBS_ENTRY}: ${LIBS_VALUE_NEW}" IGNORE_UNCHANGED)
|
||||
string(REPLACE "${LIBS_ENTRY}: ${LIBS_VALUE_OLD}" "${LIBS_ENTRY}: ${LIBS_VALUE_NEW}" PKGCONFIG_CONTENT "${PKGCONFIG_CONTENT}")
|
||||
endif()
|
||||
endforeach()
|
||||
file(WRITE "${PKGCONFIG_FILE}" "${PKGCONFIG_CONTENT}")
|
||||
endforeach()
|
||||
endforeach()
|
||||
endif()
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ffmpeg",
|
||||
"version": "7.0.2",
|
||||
"port-version": 1,
|
||||
"port-version": 2,
|
||||
"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."
|
||||
|
@ -2706,7 +2706,7 @@
|
||||
},
|
||||
"ffmpeg": {
|
||||
"baseline": "7.0.2",
|
||||
"port-version": 1
|
||||
"port-version": 2
|
||||
},
|
||||
"ffnvcodec": {
|
||||
"baseline": "12.1.14.0",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "c79d0466ceabb1aad30e085d2c35ce73a89b289d",
|
||||
"version": "7.0.2",
|
||||
"port-version": 2
|
||||
},
|
||||
{
|
||||
"git-tree": "35e04580b3c51724181a21fb38b75d55e53df9af",
|
||||
"version": "7.0.2",
|
||||
|
Loading…
Reference in New Issue
Block a user