diff options
| author | Long Nguyen <nguyen.long.908132@gmail.com> | 2020-12-02 05:13:58 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-01 14:13:58 -0800 |
| commit | 02f6b897753e7370f09193805a947e928ef4a1ab (patch) | |
| tree | 2d33be71c963f0ee437f80be59ebf90ba1694aa6 /ports/ffmpeg | |
| parent | 326e8c815666cacd2bd67bd79af6e74011708107 (diff) | |
| download | vcpkg-02f6b897753e7370f09193805a947e928ef4a1ab.tar.gz vcpkg-02f6b897753e7370f09193805a947e928ef4a1ab.zip | |
[many ports] mingw support (#14556)
* [vcpkg_configure_make] Only rename import libs on MSVC
* [x264] Only rename import libs on MSVC
* [x265] Add libc++ and libstdc++ as system libs
* [ffmpeg] mingw support
* [libvpx] Set AS environment variable
* [vcpkg_common_definition] Fix a mistake in the prefix and suffix variables
* [vcpkg_configure_make] Strip leading -l from lib list before joining
* [mp3lame] Use vcpkg_configure_make + mingw support
* [x265] Escape the pluses
* [ffmpeg] Add compiler flags for mingw
* [ffmpeg] Add WINVER define in mf_utils.c
* [ffmpeg] Remove unnecessary patch in 0003-fic-windowsinclude.patch
* [mp3lame] Add missing dollar sign
Co-authored-by: Matthias C. M. Troffaes <matthias.troffaes@gmail.com>
* [x265] Remove static lib when building shared with mingw
* [libogg] Change library name to libogg on mingw
* [libogg] Bump port version
* [x265] Remove -l(std)c++ flag in pkgconfig file
* [vcpkg_configure_make] Try to fix huge diff
* [mp3lame] Add comment on deprecated function lame_init_old
Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
Co-authored-by: Matthias C. M. Troffaes <matthias.troffaes@gmail.com>
Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
Diffstat (limited to 'ports/ffmpeg')
| -rw-r--r-- | ports/ffmpeg/0003-fix-windowsinclude.patch | 15 | ||||
| -rw-r--r-- | ports/ffmpeg/0013-define-WINVER.patch | 15 | ||||
| -rw-r--r-- | ports/ffmpeg/portfile.cmake | 76 |
3 files changed, 61 insertions, 45 deletions
diff --git a/ports/ffmpeg/0003-fix-windowsinclude.patch b/ports/ffmpeg/0003-fix-windowsinclude.patch index 8fe6a5474..8ac04c865 100644 --- a/ports/ffmpeg/0003-fix-windowsinclude.patch +++ b/ports/ffmpeg/0003-fix-windowsinclude.patch @@ -11,18 +11,3 @@ index 9cfbc45..e3447e6 100644 #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/0013-define-WINVER.patch b/ports/ffmpeg/0013-define-WINVER.patch new file mode 100644 index 000000000..295a738e7 --- /dev/null +++ b/ports/ffmpeg/0013-define-WINVER.patch @@ -0,0 +1,15 @@ +diff --color -Naur src_old/libavcodec/mf_utils.c src/libavcodec/mf_utils.c +--- src_old/libavcodec/mf_utils.c 2020-07-11 05:26:17.000000000 +0700 ++++ src/libavcodec/mf_utils.c 2020-11-13 12:55:57.226976400 +0700 +@@ -22,6 +22,11 @@ + #define _WIN32_WINNT 0x0602 + #endif + ++#if !defined(WINVER) || WINVER < 0x0602 ++#undef WINVER ++#define WINVER 0x0602 ++#endif ++ + #include "mf_utils.h" + #include "libavutil/pixdesc.h" + diff --git a/ports/ffmpeg/portfile.cmake b/ports/ffmpeg/portfile.cmake index cbe8df318..9ba7de91b 100644 --- a/ports/ffmpeg/portfile.cmake +++ b/ports/ffmpeg/portfile.cmake @@ -16,6 +16,7 @@ vcpkg_from_github( 0010-Fix-x264-detection.patch 0011-Fix-x265-detection.patch 0012-Fix-ssl-110-detection.patch + 0013-define-WINVER.patch ) if (SOURCE_PATH MATCHES " ") @@ -25,7 +26,7 @@ endif() vcpkg_find_acquire_program(YASM) get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY) -if(VCPKG_TARGET_IS_WINDOWS) +if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) #We're assuming that if we're building for Windows we're using MSVC set(INCLUDE_VAR "INCLUDE") set(LIB_PATH_VAR "LIB") @@ -60,7 +61,15 @@ if(VCPKG_TARGET_IS_WINDOWS) endif() set(SHELL ${MSYS_ROOT}/usr/bin/bash.exe) - set(OPTIONS "--toolchain=msvc ${OPTIONS}") + if(VCPKG_TARGET_IS_MINGW) + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") + set(OPTIONS "--target-os=mingw32 ${OPTIONS}") + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + set(OPTIONS "--target-os=mingw64 ${OPTIONS}") + endif() + else() + set(OPTIONS "--toolchain=msvc ${OPTIONS}") + endif() else() set(SHELL /bin/sh) endif() @@ -375,7 +384,9 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") endif() endif() -if(VCPKG_TARGET_IS_WINDOWS) +if(VCPKG_TARGET_IS_MINGW) + set(OPTIONS "${OPTIONS} --extra_cflags=-D_WIN32_WINNT=0x0601") +elseif(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") @@ -442,36 +453,41 @@ endif() if(VCPKG_TARGET_IS_WINDOWS) file(GLOB DEF_FILES ${CURRENT_PACKAGES_DIR}/lib/*.def ${CURRENT_PACKAGES_DIR}/debug/lib/*.def) - - if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") - set(LIB_MACHINE_ARG /machine:ARM) - elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") - set(LIB_MACHINE_ARG /machine:ARM64) - elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") - set(LIB_MACHINE_ARG /machine:x86) - elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") - set(LIB_MACHINE_ARG /machine:x64) - else() - message(FATAL_ERROR "Unsupported target architecture") + + if(NOT VCPKG_TARGET_IS_MINGW) + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") + set(LIB_MACHINE_ARG /machine:ARM) + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + set(LIB_MACHINE_ARG /machine:ARM64) + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") + set(LIB_MACHINE_ARG /machine:x86) + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + set(LIB_MACHINE_ARG /machine:x64) + else() + message(FATAL_ERROR "Unsupported target architecture") + endif() + + foreach(DEF_FILE ${DEF_FILES}) + get_filename_component(DEF_FILE_DIR "${DEF_FILE}" DIRECTORY) + get_filename_component(DEF_FILE_NAME "${DEF_FILE}" NAME) + string(REGEX REPLACE "-[0-9]*\\.def" "${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}" OUT_FILE_NAME "${DEF_FILE_NAME}") + file(TO_NATIVE_PATH "${DEF_FILE}" DEF_FILE_NATIVE) + file(TO_NATIVE_PATH "${DEF_FILE_DIR}/${OUT_FILE_NAME}" OUT_FILE_NATIVE) + message(STATUS "Generating ${OUT_FILE_NATIVE}") + vcpkg_execute_required_process( + COMMAND lib.exe /def:${DEF_FILE_NATIVE} /out:${OUT_FILE_NATIVE} ${LIB_MACHINE_ARG} + WORKING_DIRECTORY ${CURRENT_PACKAGES_DIR} + LOGNAME libconvert-${TARGET_TRIPLET} + ) + endforeach() endif() - - foreach(DEF_FILE ${DEF_FILES}) - get_filename_component(DEF_FILE_DIR "${DEF_FILE}" DIRECTORY) - get_filename_component(DEF_FILE_NAME "${DEF_FILE}" NAME) - string(REGEX REPLACE "-[0-9]*\\.def" "${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}" OUT_FILE_NAME "${DEF_FILE_NAME}") - file(TO_NATIVE_PATH "${DEF_FILE}" DEF_FILE_NATIVE) - file(TO_NATIVE_PATH "${DEF_FILE_DIR}/${OUT_FILE_NAME}" OUT_FILE_NATIVE) - message(STATUS "Generating ${OUT_FILE_NATIVE}") - vcpkg_execute_required_process( - COMMAND lib.exe /def:${DEF_FILE_NATIVE} /out:${OUT_FILE_NATIVE} ${LIB_MACHINE_ARG} - WORKING_DIRECTORY ${CURRENT_PACKAGES_DIR} - LOGNAME libconvert-${TARGET_TRIPLET} - ) - endforeach() - + file(GLOB EXP_FILES ${CURRENT_PACKAGES_DIR}/lib/*.exp ${CURRENT_PACKAGES_DIR}/debug/lib/*.exp) file(GLOB LIB_FILES ${CURRENT_PACKAGES_DIR}/bin/*${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX} ${CURRENT_PACKAGES_DIR}/debug/bin/*${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}) - list(APPEND FILES_TO_REMOVE ${EXP_FILES} ${LIB_FILES} ${DEF_FILES}) + if(VCPKG_TARGET_IS_MINGW) + file(GLOB LIB_FILES_2 ${CURRENT_PACKAGES_DIR}/bin/*.lib ${CURRENT_PACKAGES_DIR}/debug/bin/*.lib) + endif() + list(APPEND FILES_TO_REMOVE ${EXP_FILES} ${LIB_FILES} ${LIB_FILES_2} ${DEF_FILES}) if(FILES_TO_REMOVE) file(REMOVE ${FILES_TO_REMOVE}) endif() |
