diff options
| author | Matthias C. M. Troffaes <matthias.troffaes@gmail.com> | 2021-04-14 21:46:12 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-14 13:46:12 -0700 |
| commit | b1e352c60e706098ac3b5421856ae012eeeb832e (patch) | |
| tree | cb0cfde4f1c93bb06acca541142601c168673ed4 | |
| parent | 3639676313a3e8b6fe1e94b9e7917b71d32511e3 (diff) | |
| download | vcpkg-b1e352c60e706098ac3b5421856ae012eeeb832e.tar.gz vcpkg-b1e352c60e706098ac3b5421856ae012eeeb832e.zip | |
[ffmpeg] no longer hardcode version strings in FindFFMPEG script (#17236)
* [ffmpeg] no longer hardcode version strings in FindFFMPEG script
* [ffmpeg] bump port version
* [ffmpeg] x-add-version
* [ffmpeg] use OUTPUT_VARIABLE for extract_version_from_component
* [ffmpeg] x-add-version
* Apply suggestions from code review
* [ffmpeg] fix minor typo
* [ffmpeg] fix another minor typo
* [ffmpeg] x-add-version
Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
| -rw-r--r-- | ports/ffmpeg/CONTROL | 2 | ||||
| -rw-r--r-- | ports/ffmpeg/FindFFMPEG.cmake.in | 18 | ||||
| -rw-r--r-- | ports/ffmpeg/portfile.cmake | 56 | ||||
| -rw-r--r-- | versions/baseline.json | 2 | ||||
| -rw-r--r-- | versions/f-/ffmpeg.json | 5 |
5 files changed, 72 insertions, 11 deletions
diff --git a/ports/ffmpeg/CONTROL b/ports/ffmpeg/CONTROL index 2548dc301..6c0b0ca21 100644 --- a/ports/ffmpeg/CONTROL +++ b/ports/ffmpeg/CONTROL @@ -1,6 +1,6 @@ Source: ffmpeg Version: 4.3.2 -Port-Version: 2 +Port-Version: 3 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. diff --git a/ports/ffmpeg/FindFFMPEG.cmake.in b/ports/ffmpeg/FindFFMPEG.cmake.in index 8be51419e..407dc5e19 100644 --- a/ports/ffmpeg/FindFFMPEG.cmake.in +++ b/ports/ffmpeg/FindFFMPEG.cmake.in @@ -105,7 +105,7 @@ function(find_platform_dependent_optional_libraries) set(FFMPEG_PLATFORM_DEPENDENT_LIBS ${FFMPEG_PLATFORM_DEPENDENT_LIBS} PARENT_SCOPE) endfunction() -set(FFMPEG_VERSION "4.3.2") +set(FFMPEG_VERSION "@FFMPEG_VERSION@") find_dependency(Threads) if(UNIX) @@ -409,28 +409,28 @@ FFMPEG_FIND(libavutil avutil avutil.h) if (FFMPEG_libavutil_FOUND) list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS) list(REMOVE_DUPLICATES FFMPEG_LIBRARY_DIRS) - set(FFMPEG_libavutil_VERSION "56.51.100" CACHE STRING "") + set(FFMPEG_libavutil_VERSION "@LIBAVUTIL_VERSION@" CACHE STRING "") if(FFMPEG_libavcodec_FOUND) - set(FFMPEG_libavcodec_VERSION "58.91.100" CACHE STRING "") + set(FFMPEG_libavcodec_VERSION "@LIBAVCODEC_VERSION@" CACHE STRING "") endif() if(FFMPEG_libavdevice_FOUND) - set(FFMPEG_libavdevice_VERSION "58.10.100" CACHE STRING "") + set(FFMPEG_libavdevice_VERSION "@LIBAVDEVICE_VERSION@" CACHE STRING "") endif() if(FFMPEG_libavfilter_FOUND) - set(FFMPEG_libavfilter_VERSION "7.85.100" CACHE STRING "") + set(FFMPEG_libavfilter_VERSION "@LIBAVFILTER_VERSION@" CACHE STRING "") endif() if(FFMPEG_libavformat_FOUND) - set(FFMPEG_libavformat_VERSION "58.45.100" CACHE STRING "") + set(FFMPEG_libavformat_VERSION "@LIBAVFORMAT_VERSION@" CACHE STRING "") endif() if(FFMPEG_libavresample_FOUND) - set(FFMPEG_libavresample_VERSION "4.0.0" CACHE STRING "") + set(FFMPEG_libavresample_VERSION "@LIBAVRESAMPLE_VERSION@" CACHE STRING "") endif() if(FFMPEG_libswresample_FOUND) - set(FFMPEG_libswresample_VERSION "3.7.100" CACHE STRING "") + set(FFMPEG_libswresample_VERSION "@LIBSWRESAMPLE_VERSION@" CACHE STRING "") endif() if(FFMPEG_libswscale_FOUND) - set(FFMPEG_libswscale_VERSION "5.7.100" CACHE STRING "") + set(FFMPEG_libswscale_VERSION "@LIBSWSCALE_VERSION@" CACHE STRING "") endif() list(APPEND FFMPEG_LIBRARIES diff --git a/ports/ffmpeg/portfile.cmake b/ports/ffmpeg/portfile.cmake index b5b5c49e2..23769742a 100644 --- a/ports/ffmpeg/portfile.cmake +++ b/ports/ffmpeg/portfile.cmake @@ -675,6 +675,62 @@ endif() vcpkg_fixup_pkgconfig() +# Handle version strings + +function(extract_regex_from_file out) + cmake_parse_arguments(PARSE_ARGV 1 "arg" "" "FILE;REGEX" "") + file(READ "${arg_FILE}" contents) + if (contents MATCHES "${arg_REGEX}") + if(NOT CMAKE_MATCH_COUNT EQUAL 1) + message(FATAL_ERROR "Could not identify match group in regular expression \"${arg_REGEX}\"") + endif() + else() + message(FATAL_ERROR "Could not find line matching \"${arg_REGEX}\" in file \"${arg_FILE}\"") + endif() + set("${out}" "${CMAKE_MATCH_1}" PARENT_SCOPE) +endfunction() + +function(extract_version_from_component out) + cmake_parse_arguments(PARSE_ARGV 1 "arg" "" "COMPONENT" "") + string(TOLOWER "${arg_COMPONENT}" component_lower) + string(TOUPPER "${arg_COMPONENT}" component_upper) + extract_regex_from_file(major_version + FILE "${SOURCE_PATH}/${component_lower}/version.h" + REGEX "#define ${component_upper}_VERSION_MAJOR[ ]+([0-9]+)" + ) + extract_regex_from_file(minor_version + FILE "${SOURCE_PATH}/${component_lower}/version.h" + REGEX "#define ${component_upper}_VERSION_MINOR[ ]+([0-9]+)" + ) + extract_regex_from_file(micro_version + FILE "${SOURCE_PATH}/${component_lower}/version.h" + REGEX "#define ${component_upper}_VERSION_MICRO[ ]+([0-9]+)" + ) + set("${out}" "${major_version}.${minor_version}.${micro_version}" PARENT_SCOPE) +endfunction() + +extract_regex_from_file(FFMPEG_VERSION + FILE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/libavutil/ffversion.h" + REGEX "#define FFMPEG_VERSION[ ]+\"(.+)\"" +) + +extract_version_from_component(LIBAVUTIL_VERSION + COMPONENT libavutil) +extract_version_from_component(LIBAVCODEC_VERSION + COMPONENT libavcodec) +extract_version_from_component(LIBAVDEVICE_VERSION + COMPONENT libavdevice) +extract_version_from_component(LIBAVFILTER_VERSION + COMPONENT libavfilter) +extract_version_from_component( LIBAVFORMAT_VERSION + COMPONENT libavformat) +extract_version_from_component(LIBAVRESAMPLE_VERSION + COMPONENT libavresample) +extract_version_from_component(LIBSWRESAMPLE_VERSION + COMPONENT libswresample) +extract_version_from_component(LIBSWSCALE_VERSION + COMPONENT libswscale) + # Handle copyright file(STRINGS ${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-rel-out.log LICENSE_STRING REGEX "License: .*" LIMIT_COUNT 1) if(LICENSE_STRING STREQUAL "License: LGPL version 2.1 or later") diff --git a/versions/baseline.json b/versions/baseline.json index 1505f651b..5b043cf59 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -1942,7 +1942,7 @@ }, "ffmpeg": { "baseline": "4.3.2", - "port-version": 2 + "port-version": 3 }, "ffnvcodec": { "baseline": "10.0.26.0", diff --git a/versions/f-/ffmpeg.json b/versions/f-/ffmpeg.json index 5f9ff52e6..7ff9ab8d0 100644 --- a/versions/f-/ffmpeg.json +++ b/versions/f-/ffmpeg.json @@ -1,6 +1,11 @@ { "versions": [ { + "git-tree": "d70a90e893854dbcb0efbe740f286baf47adafef", + "version-string": "4.3.2", + "port-version": 3 + }, + { "git-tree": "95a584d785f17bb9158d505bedfda26aa1c52db1", "version-string": "4.3.2", "port-version": 2 |
