diff options
Diffstat (limited to 'ports/ffmpeg')
| -rw-r--r-- | ports/ffmpeg/0001-create-lib-libraries.patch (renamed from ports/ffmpeg/create-lib-libraries.patch) | 17 | ||||
| -rw-r--r-- | ports/ffmpeg/0002-detect-openssl.patch (renamed from ports/ffmpeg/detect-openssl.patch) | 18 | ||||
| -rw-r--r-- | ports/ffmpeg/0003-fix-windowsinclude.patch | 28 | ||||
| -rw-r--r-- | ports/ffmpeg/0004-fix-debug-build.patch | 30 | ||||
| -rw-r--r-- | ports/ffmpeg/0005-fix-libvpx-linking.patch (renamed from ports/ffmpeg/fix_libvpx_windows_linking.patch) | 32 | ||||
| -rw-r--r-- | ports/ffmpeg/CONTROL | 9 | ||||
| -rw-r--r-- | ports/ffmpeg/FindFFMPEG.cmake | 13 | ||||
| -rw-r--r-- | ports/ffmpeg/FindFFMPEG.cmake.in | 174 | ||||
| -rw-r--r-- | ports/ffmpeg/configure_opencv.patch | 11 | ||||
| -rw-r--r-- | ports/ffmpeg/fix_windowsinclude-in-ffmpegexe-1.patch | 11 | ||||
| -rw-r--r-- | ports/ffmpeg/fix_windowsinclude-in-ffmpegexe-2.patch | 14 | ||||
| -rw-r--r-- | ports/ffmpeg/portfile.cmake | 116 | ||||
| -rw-r--r-- | ports/ffmpeg/vcpkg-cmake-wrapper.cmake | 8 |
13 files changed, 334 insertions, 147 deletions
diff --git a/ports/ffmpeg/create-lib-libraries.patch b/ports/ffmpeg/0001-create-lib-libraries.patch index ccad5ff8c..493e24c1b 100644 --- a/ports/ffmpeg/create-lib-libraries.patch +++ b/ports/ffmpeg/0001-create-lib-libraries.patch @@ -1,18 +1,8 @@ -From 5f7c72d6c93fb1f4a730e2315fff6e5eb9bb95c8 Mon Sep 17 00:00:00 2001 -From: Anonymous Maarten <anonymous.maarten@gmail.com> -Date: Wed, 27 Sep 2017 15:50:40 +0200 -Subject: [PATCH] configure: create .lib static libraries using MSVC compiler - (instead of .a) - ---- - configure | 2 ++ - 1 file changed, 2 insertions(+) - diff --git a/configure b/configure -index ba38a73906..0a3f308323 100755 +index 34c2adb..1c8008a 100755 --- a/configure +++ b/configure -@@ -4890,15 +4890,17 @@ +@@ -5352,15 +5352,17 @@ case $target_os in ;; win32|win64) disable symver @@ -33,6 +23,3 @@ index ba38a73906..0a3f308323 100755 SLIBPREF="" SLIBSUF=".dll" SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)' --- -2.14.1.windows.1 - diff --git a/ports/ffmpeg/detect-openssl.patch b/ports/ffmpeg/0002-detect-openssl.patch index affd37d15..87a7656c8 100644 --- a/ports/ffmpeg/detect-openssl.patch +++ b/ports/ffmpeg/0002-detect-openssl.patch @@ -1,22 +1,14 @@ -From 18de5c60ae0a987680681d5a0602009b428504fa Mon Sep 17 00:00:00 2001 -From: Gilles Khouzam <gillesk@microsoft.com> -Date: Mon, 19 Jun 2017 16:33:38 -0700 -Subject: [PATCH] Add better detection for Openssl on Windows. - -Look for libeay32 and ssleay32 as another detection mechanism ---- - configure | 1 + - 1 file changed, 1 insertion(+) - diff --git a/configure b/configure -index a1818dc..1cf2a7c 100755 +index 1c8008a..bd2de34 100755 --- a/configure +++ b/configure -@@ -6127,6 +6127,7 @@ +@@ -6360,7 +6360,8 @@ enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OP check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto || check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 || check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || +- die "ERROR: openssl not found"; } + check_lib openssl openssl/ssl.h SSL_library_init -llibeay32 -lssleay32 || - die "ERROR: openssl not found"; } ++ die "ERROR: openssl not found"; } + enabled pocketsphinx && require_pkg_config pocketsphinx pocketsphinx pocketsphinx/pocketsphinx.h ps_init enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create && require_pkg_config rockchip_mpp "rockchip_mpp >= 1.3.7" rockchip/rk_mpi.h mpp_create && diff --git a/ports/ffmpeg/0003-fix-windowsinclude.patch b/ports/ffmpeg/0003-fix-windowsinclude.patch new file mode 100644 index 000000000..8fe6a5474 --- /dev/null +++ b/ports/ffmpeg/0003-fix-windowsinclude.patch @@ -0,0 +1,28 @@ +diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c +index 9cfbc45..e3447e6 100644 +--- a/fftools/cmdutils.c ++++ b/fftools/cmdutils.c +@@ -63,6 +63,8 @@ + #include <sys/resource.h> + #endif + #ifdef _WIN32 ++#define _WIN32_WINNT 0x0502 ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #endif + +diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c +index 01f0410..dbb0736 100644 +--- a/fftools/ffmpeg.c ++++ b/fftools/ffmpeg.c +@@ -23,6 +23,10 @@ + * multimedia converter based on the FFmpeg libraries + */ + ++#define _WIN32_WINNT 0x0502 // Must be less than 0x0600, because otherwise WinSock2.h defines "pollfd" which then gets redefined in "os_support.h". ++#define WIN32_LEAN_AND_MEAN ++ ++ + #include "config.h" + #include <ctype.h> + #include <string.h> diff --git a/ports/ffmpeg/0004-fix-debug-build.patch b/ports/ffmpeg/0004-fix-debug-build.patch new file mode 100644 index 000000000..6fe0780db --- /dev/null +++ b/ports/ffmpeg/0004-fix-debug-build.patch @@ -0,0 +1,30 @@ +diff --git a/configure b/configure +index bd2de34..fba948a 100755 +--- a/configure ++++ b/configure +@@ -3993,6 +3993,9 @@ for opt do + --libfuzzer=*) + libfuzzer_path="$optval" + ;; ++ --debug) ++ enable debug_configure ++ ;; + *) + optname="${opt%%=*}" + optname="${optname#--}" +@@ -6152,8 +6155,13 @@ fi + + enabled zlib && { check_pkg_config zlib zlib "zlib.h" zlibVersion || + check_lib zlib zlib.h zlibVersion -lz; } +-enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2 +-enabled lzma && check_lib lzma lzma.h lzma_version_number -llzma ++if enabled debug_configure; then ++ enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2d ++ enabled lzma && check_lib lzma lzma.h lzma_version_number -llzmad ++else ++ enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2 ++ enabled lzma && check_lib lzma lzma.h lzma_version_number -llzma ++fi + + # On some systems dynamic loading requires no extra linker flags + check_lib libdl dlfcn.h "dlopen dlsym" || check_lib libdl dlfcn.h "dlopen dlsym" -ldl diff --git a/ports/ffmpeg/fix_libvpx_windows_linking.patch b/ports/ffmpeg/0005-fix-libvpx-linking.patch index 805cd7e78..dac5e5928 100644 --- a/ports/ffmpeg/fix_libvpx_windows_linking.patch +++ b/ports/ffmpeg/0005-fix-libvpx-linking.patch @@ -1,8 +1,8 @@ -diff --git "a/configure" "b/configure" -index c8be177..2fef830 100644 ---- "a/configure" -+++ "b/configure" -@@ -5098,6 +5098,8 @@ case "$arch" in +diff --git a/configure b/configure +index fba948a..50eea9b 100755 +--- a/configure ++++ b/configure +@@ -5207,6 +5207,8 @@ case "$arch" in ;; esac @@ -11,7 +11,7 @@ index c8be177..2fef830 100644 # OS specific case $target_os in aix) -@@ -5269,6 +5271,15 @@ case $target_os in +@@ -5379,6 +5381,15 @@ case $target_os in enabled x86_64 && objformat="win64" || objformat="win32" ranlib=: enable dos_paths @@ -27,29 +27,27 @@ index c8be177..2fef830 100644 ;; cygwin*) target_os=cygwin -@@ -6153,21 +6164,21 @@ enabled libvorbis && require_pkg_config libvorbis vorbis vorbis/codec.h +@@ -6290,19 +6301,19 @@ enabled libvorbis && require_pkg_config libvorbis vorbis vorbis/codec.h enabled libvpx && { enabled libvpx_vp8_decoder && { check_pkg_config libvpx_vp8_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx || -- check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_dec_init_ver VPX_IMG_FMT_HIGHBITDEPTH" -lvpx || -+ check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_dec_init_ver VPX_IMG_FMT_HIGHBITDEPTH" -l$libvpx_name || - die "ERROR: libvpx decoder version must be >=1.4.0"; +- check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp8_dx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs" ++ check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp8_dx VPX_IMG_FMT_HIGHBITDEPTH" "-l$libvpx_name $libm_extralibs $pthreads_extralibs" } enabled libvpx_vp8_encoder && { check_pkg_config libvpx_vp8_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx || -- check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_IMG_FMT_HIGHBITDEPTH" -lvpx || -+ check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_IMG_FMT_HIGHBITDEPTH" -l$libvpx_name || - die "ERROR: libvpx encoder version must be >=1.4.0"; +- check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp8_cx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs" ++ check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp8_cx VPX_IMG_FMT_HIGHBITDEPTH" "-l$libvpx_name $libm_extralibs $pthreads_extralibs" } enabled libvpx_vp9_decoder && { check_pkg_config libvpx_vp9_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx || -- check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs" -+ check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx VPX_IMG_FMT_HIGHBITDEPTH" "-l$libvpx_name $libm_extralibs" +- check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs" ++ check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx VPX_IMG_FMT_HIGHBITDEPTH" "-l$libvpx_name $libm_extralibs $pthreads_extralibs" } enabled libvpx_vp9_encoder && { check_pkg_config libvpx_vp9_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx || -- check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs" -+ check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VPX_IMG_FMT_HIGHBITDEPTH" "-l$libvpx_name $libm_extralibs" +- check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs" ++ check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VPX_IMG_FMT_HIGHBITDEPTH" "-l$libvpx_name $libm_extralibs $pthreads_extralibs" } if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder; then die "libvpx enabled but no supported decoders found" diff --git a/ports/ffmpeg/CONTROL b/ports/ffmpeg/CONTROL index 209bb2306..e8f12f97e 100644 --- a/ports/ffmpeg/CONTROL +++ b/ports/ffmpeg/CONTROL @@ -1,12 +1,14 @@ Source: ffmpeg -Version: 4.1-6 +Version: 4.2-1 +Build-Depends: zlib Homepage: https://ffmpeg.org 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. +Default-Features: avresample Feature: ffmpeg Description: build the ffmpeg.exe application - + Feature: ffserver Description: ffserver appplication support in ffmpeg @@ -45,3 +47,6 @@ Description: allow nonfree and unredistributable libraries Feature: gpl Description: allow GPL licensed libraries + +Feature: avresample +Description: Libav audio resampling library support in ffmpeg diff --git a/ports/ffmpeg/FindFFMPEG.cmake b/ports/ffmpeg/FindFFMPEG.cmake deleted file mode 100644 index f8e65f53a..000000000 --- a/ports/ffmpeg/FindFFMPEG.cmake +++ /dev/null @@ -1,13 +0,0 @@ -include(FindPackageHandleStandardArgs) - -find_path(FFMPEG_INCLUDE_DIRS NAMES libavcodec/avcodec.h) -unset(FFMPEG_LIBRARIES) -foreach(FFMPEG_SUBLIBRARY avformat avdevice avcodec avutil swscale) - find_library(FFMPEG_lib${FFMPEG_SUBLIBRARY}_LIBRARY NAMES ${FFMPEG_SUBLIBRARY}) - list(APPEND FFMPEG_LIBRARIES ${FFMPEG_lib${FFMPEG_SUBLIBRARY}_LIBRARY}) -endforeach() -if(WIN32) - list(APPEND FFMPEG_LIBRARIES wsock32 ws2_32 Secur32) -endif() - -find_package_handle_standard_args(FFMPEG REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS) diff --git a/ports/ffmpeg/FindFFMPEG.cmake.in b/ports/ffmpeg/FindFFMPEG.cmake.in new file mode 100644 index 000000000..d5139220b --- /dev/null +++ b/ports/ffmpeg/FindFFMPEG.cmake.in @@ -0,0 +1,174 @@ +# Distributed under the OSI-approved BSD 3-Clause License. +# +#.rst: +# FindFFMPEG +# -------- +# +# Find the FFPMEG libraries +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# The following variables will be defined: +# +# ``FFMPEG_FOUND`` +# True if FFMPEG found on the local system +# +# ``FFMPEG_INCLUDE_DIRS`` +# Location of FFMPEG header files +# +# ``FFMPEG_LIBRARY_DIRS`` +# Location of FFMPEG libraries +# +# ``FFMPEG_LIBRARIES`` +# List of the FFMPEG libraries found +# +# + +include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake) +include(${CMAKE_ROOT}/Modules/CMakeFindDependencyMacro.cmake) + +set(FFMPEG_VERSION "4.2") + +find_dependency(Threads) +if(UNIX) + list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS -pthread -lvdpau -lX11) +endif() + +if(@ENABLE_BZIP2@) + find_dependency(BZip2) + get_target_property(BZip2_LIBRARY_RELEASE BZip2::BZip2 IMPORTED_LOCATION_RELEASE) + get_target_property(BZip2_LIBRARY_DEBUG BZip2::BZip2 IMPORTED_LOCATION_DEBUG) + list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${BZip2_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${BZip2_LIBRARY_RELEASE}>") +endif() + +if(@ENABLE_LZMA@) + find_dependency(LibLZMA) + list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS "$<$<CONFIG:Debug>:${LibLZMA_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${LibLZMA_LIBRARY_RELEASE}>") +endif() + +# Platform dependent libraries required by FFMPEG +if(WIN32) + if(NOT CYGWIN) + list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS wsock32 ws2_32 Secur32 bcrypt) + endif() +else() + list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS m) +endif() + +macro(FFMPEG_FIND varname shortname headername) + if(NOT FFMPEG_${varname}_INCLUDE_DIRS) + find_path(FFMPEG_${varname}_INCLUDE_DIRS NAMES lib${shortname}/${headername} ${headername} PATH_SUFFIXES ffmpeg) + endif() + if(NOT FFMPEG_${varname}_LIBRARY) + find_library(FFMPEG_${varname}_LIBRARY_RELEASE NAMES ${shortname} PATH_SUFFIXES ffmpeg ffmpeg/lib) + get_filename_component(FFMPEG_${varname}_LIBRARY_RELEASE_DIR ${FFMPEG_${varname}_LIBRARY_RELEASE} DIRECTORY) + find_library(FFMPEG_${varname}_LIBRARY_DEBUG NAMES ${shortname}d ${shortname} PATHS debug PATH_SUFFIXES ffmpeg ffmpeg/lib ffmpeg/debug/lib debug/ffmpeg/lib) + get_filename_component(FFMPEG_${varname}_LIBRARY_DEBUG_DIR ${FFMPEG_${varname}_LIBRARY_DEBUG} DIRECTORY) + select_library_configurations(FFMPEG_${varname}) + endif() + if (FFMPEG_${varname}_LIBRARY AND FFMPEG_${varname}_INCLUDE_DIRS) + set(FFMPEG_${varname}_FOUND 1) + list(APPEND FFMPEG_LIBRARY_DIRS ${FFMPEG_${varname}_LIBRARY_RELEASE_DIR} ${FFMPEG_${varname}_LIBRARY_DEBUG_DIR}) + endif() +endmacro(FFMPEG_FIND) + +macro(FFMPEG_FIND_GENEX varname shortname headername) + if(NOT FFMPEG_${varname}_INCLUDE_DIRS) + find_path(FFMPEG_${varname}_INCLUDE_DIRS NAMES lib${shortname}/${headername} ${headername} PATH_SUFFIXES ffmpeg) + endif() + if(NOT FFMPEG_${varname}_LIBRARY) + find_library(FFMPEG_${varname}_LIBRARY_RELEASE NAMES ${shortname} PATH_SUFFIXES ffmpeg ffmpeg/lib) + get_filename_component(FFMPEG_${varname}_LIBRARY_RELEASE_DIR ${FFMPEG_${varname}_LIBRARY_RELEASE} DIRECTORY) + find_library(FFMPEG_${varname}_LIBRARY_DEBUG NAMES ${shortname}d ${shortname} PATHS debug PATH_SUFFIXES ffmpeg ffmpeg/lib ffmpeg/debug/lib debug/ffmpeg/lib) + get_filename_component(FFMPEG_${varname}_LIBRARY_DEBUG_DIR ${FFMPEG_${varname}_LIBRARY_DEBUG} DIRECTORY) + set(FFMPEG_${varname}_LIBRARY "$<$<CONFIG:Debug>:${FFMPEG_${varname}_LIBRARY_DEBUG}>$<$<CONFIG:Release>:${FFMPEG_${varname}_LIBRARY_RELEASE}>" CACHE STRING "") + set(FFMPEG_${varname}_LIBRARIES ${FFMPEG_${varname}_LIBRARY} CACHE STRING "") + endif() + if (FFMPEG_${varname}_LIBRARY AND FFMPEG_${varname}_INCLUDE_DIRS) + set(FFMPEG_${varname}_FOUND 1) + list(APPEND FFMPEG_LIBRARY_DIRS ${FFMPEG_${varname}_LIBRARY_RELEASE_DIR} ${FFMPEG_${varname}_LIBRARY_DEBUG_DIR}) + endif() +endmacro(FFMPEG_FIND_GENEX) + +if(WIN32) + FFMPEG_FIND_GENEX(libzlib zlib zlib.h) +else() + FFMPEG_FIND_GENEX(libzlib z zlib.h) +endif() + +if(APPLE) + find_library(VT_UNIT VideoToolbox) + if (NOT VT_UNIT) + message(FATAL_ERROR "VideoToolbox not found") + endif() + find_library(AT_UNIT AudioToolbox) + if (NOT AT_UNIT) + message(FATAL_ERROR "AudioToolbox not found") + endif() + find_library(SEC_UNIT Security) + if (NOT SEC_UNIT) + message(FATAL_ERROR "Security not found") + endif() + find_library(CF_UNIT CoreFoundation) + if (NOT CF_UNIT) + message(FATAL_ERROR "CoreFoundation not found") + endif() + find_library(CM_UNIT CoreMedia) + if (NOT CM_UNIT) + message(FATAL_ERROR "CoreMedia not found") + endif() + find_library(CV_UNIT CoreVideo) + if (NOT CV_UNIT) + message(FATAL_ERROR "CoreVideo not found") + endif() + find_package(Iconv QUIET) + list(APPEND FFMPEG_PLATFORM_DEPENDENT_LIBS ${VT_UNIT} ${AT_UNIT} ${SEC_UNIT} ${CF_UNIT} ${CM_UNIT} ${CV_UNIT} ${Iconv_LIBRARIES}) +endif() + +FFMPEG_FIND(libavcodec avcodec avcodec.h) +FFMPEG_FIND(libavdevice avdevice avdevice.h) +FFMPEG_FIND(libavfilter avfilter avfilter.h) +FFMPEG_FIND(libavformat avformat avformat.h) +FFMPEG_FIND(libavresample avresample avresample.h) +FFMPEG_FIND(libavutil avutil avutil.h) +FFMPEG_FIND(libswresample swresample swresample.h) +FFMPEG_FIND(libswscale swscale swscale.h) + +if (FFMPEG_libavcodec_FOUND AND FFMPEG_libavdevice_FOUND AND FFMPEG_libavfilter_FOUND AND FFMPEG_libavformat_FOUND AND FFMPEG_libavutil_FOUND AND FFMPEG_libswresample_FOUND AND FFMPEG_libswscale_FOUND AND FFMPEG_libzlib_FOUND) + list(APPEND FFMPEG_INCLUDE_DIRS ${FFMPEG_libavformat_INCLUDE_DIRS} ${FFMPEG_libavdevice_INCLUDE_DIRS} ${FFMPEG_libavcodec_INCLUDE_DIRS} ${FFMPEG_libavutil_INCLUDE_DIRS} ${FFMPEG_libswscale_INCLUDE_DIRS}) + list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS) + list(REMOVE_DUPLICATES FFMPEG_LIBRARY_DIRS) + + set(FFMPEG_libavcodec_VERSION "${FFMPEG_VERSION}" CACHE STRING "") + set(FFMPEG_libavdevice_VERSION "${FFMPEG_VERSION}" CACHE STRING "") + set(FFMPEG_libavfilter_VERSION "${FFMPEG_VERSION}" CACHE STRING "") + set(FFMPEG_libavformat_VERSION "${FFMPEG_VERSION}" CACHE STRING "") + if(FFMPEG_libavresample_FOUND) + set(FFMPEG_libavresample_VERSION "${FFMPEG_VERSION}" CACHE STRING "") + endif() + set(FFMPEG_libavutil_VERSION "${FFMPEG_VERSION}" CACHE STRING "") + set(FFMPEG_libswresample_VERSION "${FFMPEG_VERSION}" CACHE STRING "") + set(FFMPEG_libswscale_VERSION "${FFMPEG_VERSION}" CACHE STRING "") + + list(APPEND FFMPEG_LIBRARIES + ${FFMPEG_libavformat_LIBRARY} + ${FFMPEG_libavdevice_LIBRARY} + ${FFMPEG_libavcodec_LIBRARY} + ${FFMPEG_libavutil_LIBRARY} + ${FFMPEG_libswscale_LIBRARY} + ${FFMPEG_libavfilter_LIBRARY} + ${FFMPEG_libswresample_LIBRARY} + ${FFMPEG_libavresample_LIBRARY} + ${FFMPEG_libzlib_LIBRARY} + ${FFMPEG_PLATFORM_DEPENDENT_LIBS} + ) + set(FFMPEG_LIBRARY ${FFMPEG_LIBRARIES}) + + set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "") + set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "") + set(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBRARY_DIRS} CACHE STRING "") +endif() + +find_package_handle_standard_args(FFMPEG REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_LIBRARY_DIRS FFMPEG_INCLUDE_DIRS) diff --git a/ports/ffmpeg/configure_opencv.patch b/ports/ffmpeg/configure_opencv.patch deleted file mode 100644 index ac5c82797..000000000 --- a/ports/ffmpeg/configure_opencv.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/configure
-+++ b/configure
-@@ -6110,7 +6110,7 @@ enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec
- enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
- enabled libopencv && { check_headers opencv2/core/core_c.h &&
- { check_pkg_config libopencv opencv opencv2/core/core_c.h cvCreateImageHeader ||
-- require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
-+ require opencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core341 -lopencv_imgproc341; } ||
- require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
- enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
- enabled libopenjpeg && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
diff --git a/ports/ffmpeg/fix_windowsinclude-in-ffmpegexe-1.patch b/ports/ffmpeg/fix_windowsinclude-in-ffmpegexe-1.patch deleted file mode 100644 index 09ee1219f..000000000 --- a/ports/ffmpeg/fix_windowsinclude-in-ffmpegexe-1.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/fftools/cmdutils.c 2017-07-29 19:49:29.000000000 +0200 -+++ b/fftools/cmdutils.c 2018-09-02 20:31:42.509408400 +0200 -@@ -62,6 +62,8 @@ - #include <sys/resource.h> - #endif - #ifdef _WIN32 -+#define _WIN32_WINNT 0x0600 -+#define WIN32_LEAN_AND_MEAN - #include <windows.h> - #endif - diff --git a/ports/ffmpeg/fix_windowsinclude-in-ffmpegexe-2.patch b/ports/ffmpeg/fix_windowsinclude-in-ffmpegexe-2.patch deleted file mode 100644 index 69d725e2a..000000000 --- a/ports/ffmpeg/fix_windowsinclude-in-ffmpegexe-2.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/fftools/ffmpeg.c 2017-07-29 19:49:29.000000000 +0200 -+++ b/fftools/ffmpeg.c 2018-09-02 20:32:27.666725200 +0200 -@@ -23,6 +23,11 @@ - * multimedia converter based on the FFmpeg libraries - */ - -+#define _WIN32_WINNT 0x0502 // Must be less than 0x0600, because otherwise WinSock2.h defines "pollfd" which then gets redefined in "os_support.h". -+ // I suppose that "HAVE_STRUCT_POLLFD" should be 1, but it happens to be 0. Sorry, this is somewhat beyond me. -+#define WIN32_LEAN_AND_MEAN -+ -+ - #include "config.h" - #include <ctype.h> - #include <string.h> diff --git a/ports/ffmpeg/portfile.cmake b/ports/ffmpeg/portfile.cmake index 1ce53a996..71bea6e95 100644 --- a/ports/ffmpeg/portfile.cmake +++ b/ports/ffmpeg/portfile.cmake @@ -1,21 +1,17 @@ include(vcpkg_common_functions) -vcpkg_download_distfile(ARCHIVE - URLS "http://ffmpeg.org/releases/ffmpeg-4.1.tar.bz2" - FILENAME "ffmpeg-4.1.tar.bz2" - SHA512 ccf6d07268dc47e08ca619eb182a003face2a8ee73ec1a28157330dd7de1df88939def1fc1c7e6b6ac7b59752cdad84657d589b2fafb73e14e5ef03fb6e33417 -) - -vcpkg_extract_source_archive_ex( +vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH - ARCHIVE ${ARCHIVE} + REPO ffmpeg/ffmpeg + REF n4.2 + SHA512 9fa56364696f91e2bf4287954d26f0c35b3f8aad241df3fbd3c9fc617235d8c83b28ddcac88436383b2eb273f690322e6f349e2f9c64d02f0058a4b76fa55035 + HEAD_REF master PATCHES - create-lib-libraries.patch - detect-openssl.patch - configure_opencv.patch - fix_windowsinclude-in-ffmpegexe-1.patch - fix_windowsinclude-in-ffmpegexe-2.patch - fix_libvpx_windows_linking.patch + 0001-create-lib-libraries.patch + 0002-detect-openssl.patch + 0003-fix-windowsinclude.patch + 0004-fix-debug-build.patch + 0005-fix-libvpx-linking.patch ) if (${SOURCE_PATH} MATCHES " ") @@ -25,7 +21,7 @@ endif() vcpkg_find_acquire_program(YASM) get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY) -if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") +if(VCPKG_TARGET_IS_WINDOWS) set(SEP ";") #We're assuming that if we're building for Windows we're using MSVC set(INCLUDE_VAR "INCLUDE") @@ -36,7 +32,7 @@ else() set(LIB_PATH_VAR "LIBRARY_PATH") endif() -if (WIN32) +if(VCPKG_TARGET_IS_WINDOWS) set(ENV{PATH} "$ENV{PATH};${YASM_EXE_PATH}") set(BUILD_SCRIPT ${CMAKE_CURRENT_LIST_DIR}\\build.sh) @@ -113,18 +109,26 @@ else() set(OPTIONS "${OPTIONS} --disable-opencl") endif() +set (ENABLE_LZMA OFF) if("lzma" IN_LIST FEATURES) set(OPTIONS "${OPTIONS} --enable-lzma") + set (ENABLE_LZMA ON) #necessary for configuring FFMPEG CMake Module else() set(OPTIONS "${OPTIONS} --disable-lzma") endif() +set (ENABLE_BZIP2 OFF) if("bzip2" IN_LIST FEATURES) set(OPTIONS "${OPTIONS} --enable-bzlib") + set (ENABLE_BZIP2 ON) #necessary for configuring FFMPEG CMake Module else() set(OPTIONS "${OPTIONS} --disable-bzlib") endif() +if("avresample" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} --enable-avresample") +endif() + set(OPTIONS_CROSS "") if (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") @@ -147,11 +151,10 @@ if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") set(OPTIONS_CROSS " --enable-cross-compile --target-os=win32 --arch=${VCPKG_TARGET_ARCHITECTURE}") endif() -set(OPTIONS_DEBUG "") # Note: --disable-optimizations can't be used due to http://ffmpeg.org/pipermail/libav-user/2013-March/003945.html +set(OPTIONS_DEBUG "--debug") # Note: --disable-optimizations can't be used due to http://ffmpeg.org/pipermail/libav-user/2013-March/003945.html set(OPTIONS_RELEASE "") set(OPTIONS "${OPTIONS} ${OPTIONS_CROSS}") -set(OPTIONS "${OPTIONS} --extra-cflags=-DHAVE_UNISTD_H=0") if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") set(OPTIONS "${OPTIONS} --disable-static --enable-shared") @@ -160,9 +163,8 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") endif() endif() -message(STATUS "Building Options: ${OPTIONS}") - -if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") +if(VCPKG_TARGET_IS_WINDOWS) + set(OPTIONS "${OPTIONS} --extra-cflags=-DHAVE_UNISTD_H=0") if(VCPKG_CRT_LINKAGE STREQUAL "dynamic") set(OPTIONS_DEBUG "${OPTIONS_DEBUG} --extra-cflags=-MDd --extra-cxxflags=-MDd") set(OPTIONS_RELEASE "${OPTIONS_RELEASE} --extra-cflags=-MD --extra-cxxflags=-MD") @@ -173,33 +175,46 @@ if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore endif() set(ENV_LIB_PATH "$ENV{${LIB_PATH_VAR}}") -set(ENV{${LIB_PATH_VAR}} "${CURRENT_INSTALLED_DIR}/lib${SEP}${ENV_LIB_PATH}") - -message(STATUS "Building ${_csc_PROJECT_PATH} for Release") -file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) -vcpkg_execute_required_process( - COMMAND ${BASH} --noprofile --norc "${BUILD_SCRIPT}" - "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" # BUILD DIR - "${SOURCE_PATH}" # SOURCE DIR - "${CURRENT_PACKAGES_DIR}" # PACKAGE DIR - "${OPTIONS} ${OPTIONS_RELEASE}" - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel - LOGNAME build-${TARGET_TRIPLET}-rel -) -set(ENV{${LIB_PATH_VAR}} "${CURRENT_INSTALLED_DIR}/debug/lib${SEP}${ENV_LIB_PATH}") - -message(STATUS "Building ${_csc_PROJECT_PATH} for Debug") -file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) -vcpkg_execute_required_process( - COMMAND ${BASH} --noprofile --norc "${BUILD_SCRIPT}" - "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" # BUILD DIR - "${SOURCE_PATH}" # SOURCE DIR - "${CURRENT_PACKAGES_DIR}/debug" # PACKAGE DIR - "${OPTIONS} ${OPTIONS_DEBUG}" - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg - LOGNAME build-${TARGET_TRIPLET}-dbg -) +message(STATUS "Building Options: ${OPTIONS}") + +# Relase build +if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL release) + message(STATUS "Building Relase Options: ${OPTIONS_RELEASE}") + set(ENV{${LIB_PATH_VAR}} "${CURRENT_INSTALLED_DIR}/lib${SEP}${ENV_LIB_PATH}") + set(ENV{CFLAGS} "${VCPKG_C_FLAGS} ${VCPKG_C_FLAGS_RELEASE}") + set(ENV{LDFLAGS} "${VCPKG_LINKER_FLAGS}") + message(STATUS "Building ${_csc_PROJECT_PATH} for Release") + file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) + vcpkg_execute_required_process( + COMMAND ${BASH} --noprofile --norc "${BUILD_SCRIPT}" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" # BUILD DIR + "${SOURCE_PATH}" # SOURCE DIR + "${CURRENT_PACKAGES_DIR}" # PACKAGE DIR + "${OPTIONS} ${OPTIONS_RELEASE}" + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel + LOGNAME build-${TARGET_TRIPLET}-rel + ) +endif() + +# Debug build +if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug) + message(STATUS "Building Debug Options: ${OPTIONS_DEBUG}") + set(ENV{${LIB_PATH_VAR}} "${CURRENT_INSTALLED_DIR}/debug/lib${SEP}${ENV_LIB_PATH}") + set(ENV{CFLAGS} "${VCPKG_C_FLAGS} ${VCPKG_C_FLAGS_DEBUG}") + set(ENV{LDFLAGS} "${VCPKG_LINKER_FLAGS}") + message(STATUS "Building ${_csc_PROJECT_PATH} for Debug") + file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) + vcpkg_execute_required_process( + COMMAND ${BASH} --noprofile --norc "${BUILD_SCRIPT}" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" # BUILD DIR + "${SOURCE_PATH}" # SOURCE DIR + "${CURRENT_PACKAGES_DIR}/debug" # PACKAGE DIR + "${OPTIONS} ${OPTIONS_DEBUG}" + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg + LOGNAME build-${TARGET_TRIPLET}-dbg + ) +endif() file(GLOB DEF_FILES ${CURRENT_PACKAGES_DIR}/lib/*.def ${CURRENT_PACKAGES_DIR}/debug/lib/*.def) @@ -243,8 +258,7 @@ vcpkg_copy_pdbs() # Handle copyright # TODO: Examine build log and confirm that this license matches the build output -file(COPY ${SOURCE_PATH}/COPYING.LGPLv2.1 DESTINATION ${CURRENT_PACKAGES_DIR}/share/ffmpeg) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/ffmpeg/COPYING.LGPLv2.1 ${CURRENT_PACKAGES_DIR}/share/ffmpeg/copyright) +file(INSTALL ${SOURCE_PATH}/COPYING.LGPLv2.1 DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) -# Used by OpenCV -file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindFFMPEG.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/ffmpeg) +configure_file(${CMAKE_CURRENT_LIST_DIR}/FindFFMPEG.cmake.in ${CURRENT_PACKAGES_DIR}/share/${PORT}/FindFFMPEG.cmake @ONLY) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) diff --git a/ports/ffmpeg/vcpkg-cmake-wrapper.cmake b/ports/ffmpeg/vcpkg-cmake-wrapper.cmake new file mode 100644 index 000000000..322387565 --- /dev/null +++ b/ports/ffmpeg/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,8 @@ +set(FFMPEG_PREV_MODULE_PATH ${CMAKE_MODULE_PATH}) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +if(NOT FFMPEG_LIBRARIES) + _find_package(${ARGS}) +endif() + +set(CMAKE_MODULE_PATH ${FFMPEG_PREV_MODULE_PATH}) |
