From 02a26abda5cac9bb4e27aea509192e98cc797fa4 Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Wed, 3 Aug 2022 19:40:07 +0200 Subject: [PATCH] [gstreamer] fix clang-cl builds (#26096) * gstreamer fix clang-cl * v db --- ports/gstreamer/fix-clang-cl-bad.patch | 111 +++++++++++++++++++ ports/gstreamer/fix-clang-cl-base.patch | 22 ++++ ports/gstreamer/fix-clang-cl-good.patch | 22 ++++ ports/gstreamer/fix-clang-cl-gstreamer.patch | 57 ++++++++++ ports/gstreamer/fix-clang-cl-ugly.patch | 13 +++ ports/gstreamer/fix-clang-cl.patch | 22 ++++ ports/gstreamer/portfile.cmake | 11 +- ports/gstreamer/vcpkg.json | 2 +- versions/baseline.json | 2 +- versions/g-/gstreamer.json | 5 + 10 files changed, 260 insertions(+), 7 deletions(-) create mode 100644 ports/gstreamer/fix-clang-cl-bad.patch create mode 100644 ports/gstreamer/fix-clang-cl-base.patch create mode 100644 ports/gstreamer/fix-clang-cl-good.patch create mode 100644 ports/gstreamer/fix-clang-cl-gstreamer.patch create mode 100644 ports/gstreamer/fix-clang-cl-ugly.patch create mode 100644 ports/gstreamer/fix-clang-cl.patch diff --git a/ports/gstreamer/fix-clang-cl-bad.patch b/ports/gstreamer/fix-clang-cl-bad.patch new file mode 100644 index 0000000000..92e96f3c44 --- /dev/null +++ b/ports/gstreamer/fix-clang-cl-bad.patch @@ -0,0 +1,111 @@ +diff --git a/ext/dts/meson.build b/ext/dts/meson.build +index 8ab3fc917..c19aa2264 100644 +--- a/ext/dts/meson.build ++++ b/ext/dts/meson.build +@@ -15,7 +15,7 @@ if not dca_dep.found() + endif + + no_warn_c_args = [] +-if cc.get_id() != 'msvc' ++if cc.get_argument_syntax() != 'msvc' + # autotools didn't use the libdca pkg-config cflags, and they + # can point to a non-existing location (/usr/include/dca) + no_warn_c_args = ['-Wno-missing-include-dirs'] +diff --git a/gst-libs/gst/d3d11/meson.build b/gst-libs/gst/d3d11/meson.build +index 4a844ef75..cd97e8f7a 100644 +--- a/gst-libs/gst/d3d11/meson.build ++++ b/gst-libs/gst/d3d11/meson.build +@@ -174,7 +174,7 @@ endif + + # MinGW 32bits compiler seems to be complaining about redundant-decls + # when ComPtr is in use. Let's just disable the warning +-if cc.get_id() != 'msvc' ++if cc.get_argument_syntax() != 'msvc' + extra_args = cc.get_supported_arguments([ + '-Wno-redundant-decls', + ]) +diff --git a/meson.build b/meson.build +index 7cab556e0..35531110b 100644 +--- a/meson.build ++++ b/meson.build +@@ -45,7 +45,7 @@ endif + + cdata = configuration_data() + +-if cc.get_id() == 'msvc' ++if cc.get_argument_syntax() == 'msvc' + msvc_args = [ + # Ignore several spurious warnings for things gstreamer does very commonly + # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it +diff --git a/sys/asio/meson.build b/sys/asio/meson.build +index 3006d26ce..1afbd0022 100644 +--- a/sys/asio/meson.build ++++ b/sys/asio/meson.build +@@ -15,7 +15,7 @@ endif + + # FIXME: non-msvc is not tested, and unlikely supported yet because of + # tool-chain issue +-if cxx.get_id() != 'msvc' ++if cxx.get_argument_syntax() != 'msvc' + if asio_option.enabled() + error('asio plugin can only be built with MSVC') + else +diff --git a/sys/d3d11/meson.build b/sys/d3d11/meson.build +index 43f213d9c..9c9e9b535 100644 +--- a/sys/d3d11/meson.build ++++ b/sys/d3d11/meson.build +@@ -102,7 +102,7 @@ endif + + # MinGW 32bits compiler seems to be complaining about redundant-decls + # when ComPtr is in use. Let's just disable the warning +-if cc.get_id() != 'msvc' ++if cc.get_argument_syntax() != 'msvc' + extra_mingw_args = cc.get_supported_arguments([ + '-Wno-redundant-decls', + ]) +diff --git a/sys/decklink/meson.build b/sys/decklink/meson.build +index d869e79a4..c7b37a7c6 100644 +--- a/sys/decklink/meson.build ++++ b/sys/decklink/meson.build +@@ -18,7 +18,7 @@ decklink_libs = [] + + if host_system == 'windows' + decklink_sources += ['win/DeckLinkAPIDispatch.cpp', 'win/DeckLinkAPI_i.c'] +- if cxx.get_id() == 'msvc' ++ if cxx.get_argument_syntax() == 'msvc' + # FIXME: Use commsuppwd.lib for debug builds? + comutil_dep = cxx.find_library('comsuppw', required : get_option('decklink')) + if comutil_dep.found() +diff --git a/sys/mediafoundation/meson.build b/sys/mediafoundation/meson.build +index 828954909..af570f9ff 100644 +--- a/sys/mediafoundation/meson.build ++++ b/sys/mediafoundation/meson.build +@@ -48,7 +48,7 @@ if host_system != 'windows' or mf_option.disabled() + subdir_done() + endif + +-if cc.get_id() != 'msvc' ++if cc.get_argument_syntax() != 'msvc' + if mf_option.enabled() + error('mediafoundation plugin can only be built with MSVC') + endif +diff --git a/sys/msdk/meson.build b/sys/msdk/meson.build +index a77160049..7c834d8ed 100644 +--- a/sys/msdk/meson.build ++++ b/sys/msdk/meson.build +@@ -139,13 +139,13 @@ if have_mfx_ver134 + endif + + if host_machine.system() == 'windows' +- if cc.get_id() != 'msvc' and msdk_option.enabled() ++ if cc.get_argument_syntax() != 'msvc' and msdk_option.enabled() + error('msdk plugin can only be built with MSVC') + endif + legacy_stdio_dep = cc.find_library('legacy_stdio_definitions', required: get_option('msdk')) + d3d11_dep = cc.find_library('d3d11', required: get_option('msdk')) + msdk_deps = declare_dependency(dependencies: [d3d11_dep, legacy_stdio_dep]) +- msdk_deps_found = d3d11_dep.found() and legacy_stdio_dep.found() and cc.get_id() == 'msvc' ++ msdk_deps_found = d3d11_dep.found() and legacy_stdio_dep.found() and cc.get_argument_syntax() == 'msvc' + else + libva_dep = dependency('libva', required: get_option('msdk')) + libva_drm_dep = dependency('libva-drm', required: get_option('msdk')) diff --git a/ports/gstreamer/fix-clang-cl-base.patch b/ports/gstreamer/fix-clang-cl-base.patch new file mode 100644 index 0000000000..4c406427dc --- /dev/null +++ b/ports/gstreamer/fix-clang-cl-base.patch @@ -0,0 +1,22 @@ +diff --git a/meson.build b/meson.build +index 495671ebb..fff3ea518 100644 +--- a/meson.build ++++ b/meson.build +@@ -43,7 +43,7 @@ plugins = [] + + cc = meson.get_compiler('c') + +-if cc.get_id() == 'msvc' ++if cc.get_argument_syntax() == 'msvc' + msvc_args = [ + # Ignore several spurious warnings for things gstreamer does very commonly + # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it +@@ -75,7 +75,7 @@ endif + core_conf = configuration_data() + + # Symbol visibility +-if cc.get_id() == 'msvc' ++if cc.get_argument_syntax() == 'msvc' + export_define = '__declspec(dllexport) extern' + elif cc.has_argument('-fvisibility=hidden') + add_project_arguments('-fvisibility=hidden', language: 'c') diff --git a/ports/gstreamer/fix-clang-cl-good.patch b/ports/gstreamer/fix-clang-cl-good.patch new file mode 100644 index 0000000000..d2ed46e83f --- /dev/null +++ b/ports/gstreamer/fix-clang-cl-good.patch @@ -0,0 +1,22 @@ +diff --git a/meson.build b/meson.build +index 64705379f..0c55b9732 100644 +--- a/meson.build ++++ b/meson.build +@@ -30,7 +30,7 @@ plugins = [] + cc = meson.get_compiler('c') + host_system = host_machine.system() + +-if cc.get_id() == 'msvc' ++if cc.get_argument_syntax() == 'msvc' + msvc_args = [ + # Ignore several spurious warnings for things gstreamer does very commonly + # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it +@@ -183,7 +183,7 @@ cdata.set('SIZEOF_OFF_T', cc.sizeof('off_t')) + # Here be fixmes. + # FIXME: check if this is correct + cdata.set('HAVE_CPU_X86_64', host_machine.cpu() == 'amd64') +-cdata.set('HAVE_GCC_ASM', cc.get_id() != 'msvc') ++cdata.set('HAVE_GCC_ASM', cc.get_argument_syntax() != 'msvc') + cdata.set_quoted('VERSION', gst_version) + cdata.set_quoted('PACKAGE_VERSION', gst_version) + cdata.set_quoted('GST_LICENSE', 'LGPL') diff --git a/ports/gstreamer/fix-clang-cl-gstreamer.patch b/ports/gstreamer/fix-clang-cl-gstreamer.patch new file mode 100644 index 0000000000..928a5785fe --- /dev/null +++ b/ports/gstreamer/fix-clang-cl-gstreamer.patch @@ -0,0 +1,57 @@ +diff --git a/gst/parse/meson.build b/gst/parse/meson.build +index 35ed6f2f4..5e38e49ea 100644 +--- a/gst/parse/meson.build ++++ b/gst/parse/meson.build +@@ -16,7 +16,7 @@ else + endif + + flex_cdata.set('FLEX', flex.path()) +-if cc.get_id() == 'msvc' ++if cc.get_argument_syntax() == 'msvc' + flex_cdata.set('FLEX_ARGS', '--nounistd') + else + flex_cdata.set('FLEX_ARGS', '') +diff --git a/meson.build b/meson.build +index 772809e15..70b1eafc5 100644 +--- a/meson.build ++++ b/meson.build +@@ -36,7 +36,7 @@ cc = meson.get_compiler('c') + + cdata = configuration_data() + +-if cc.get_id() == 'msvc' ++if cc.get_argument_syntax() == 'msvc' + msvc_args = [ + # Ignore several spurious warnings for things gstreamer does very commonly + # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it +@@ -61,7 +61,7 @@ endif + + # Symbol visibility + have_visibility_hidden = false +-if cc.get_id() == 'msvc' ++if cc.get_argument_syntax() == 'msvc' + export_define = '__declspec(dllexport) extern' + elif cc.has_argument('-fvisibility=hidden') + add_project_arguments('-fvisibility=hidden', language: 'c') +@@ -313,8 +313,10 @@ static __uint128_t v2 = 10; + static __uint128_t u; + u = v1 / v2; + }''' +-if cc.compiles(uint128_t_src, name : '__uint128_t available') +- cdata.set('HAVE_UINT128_T', 1) ++if cc.get_argument_syntax() != 'msvc' ++ if cc.compiles(uint128_t_src, name : '__uint128_t available') ++ cdata.set('HAVE_UINT128_T', 1) ++ endif + endif + + # All supported platforms have long long now +@@ -322,7 +324,7 @@ cdata.set('HAVE_LONG_LONG', 1) + + # We only want to use the __declspec(dllexport/import) dance in GST_EXPORT when + # building with MSVC +-if cc.get_id() == 'msvc' ++if cc.get_argument_syntax() == 'msvc' + cdata.set('GSTCONFIG_BUILT_WITH_MSVC', 1) + else + cdata.set('GSTCONFIG_BUILT_WITH_MSVC', 0) diff --git a/ports/gstreamer/fix-clang-cl-ugly.patch b/ports/gstreamer/fix-clang-cl-ugly.patch new file mode 100644 index 0000000000..ae83ee4829 --- /dev/null +++ b/ports/gstreamer/fix-clang-cl-ugly.patch @@ -0,0 +1,13 @@ +diff --git a/meson.build b/meson.build +index 14be48c4c..83d019874 100644 +--- a/meson.build ++++ b/meson.build +@@ -31,7 +31,7 @@ if have_cxx + cxx = meson.get_compiler('cpp') + endif + +-if cc.get_id() == 'msvc' ++if cc.get_argument_syntax() == 'msvc' + msvc_args = [ + # Ignore several spurious warnings for things gstreamer does very commonly + # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it diff --git a/ports/gstreamer/fix-clang-cl.patch b/ports/gstreamer/fix-clang-cl.patch new file mode 100644 index 0000000000..d6eded2f57 --- /dev/null +++ b/ports/gstreamer/fix-clang-cl.patch @@ -0,0 +1,22 @@ +diff --git a/meson.build b/meson.build +index 1316366ed..daeaf3cb1 100644 +--- a/meson.build ++++ b/meson.build +@@ -62,7 +62,7 @@ endif + # Ensure that MSVC interprets all source code as UTF-8. Only do this when we're + # not a subproject, because subprojects are not allowed to call + # add_global_arguments(). +-if not meson.is_subproject() and cc.get_id() == 'msvc' ++if not meson.is_subproject() and cc.get_argument_syntax() == 'msvc' + add_global_arguments( + cc.get_supported_arguments(['/utf-8']), # set the input encoding to utf-8 + language: ['c', 'cpp']) +@@ -316,7 +316,7 @@ if get_option('default_library') == 'static' + if cc.has_link_argument(link_arg) + gstfull_link_args += link_arg + link_deps += symbol_map +- elif cc.get_id() == 'msvc' ++ elif cc.get_argument_syntax() == 'msvc' + warning('FIXME: Provide a def file to publish the public symbols') + else + error('Failed to link with version script (' + symbol_map + '), check logs for details') diff --git a/ports/gstreamer/portfile.cmake b/ports/gstreamer/portfile.cmake index 25cfb74b8f..c247ff86e2 100644 --- a/ports/gstreamer/portfile.cmake +++ b/ports/gstreamer/portfile.cmake @@ -4,7 +4,7 @@ vcpkg_from_github( REF 1.19.2 SHA512 d6b8e9fc195a60dfb83fe8a49040c21ca5603e3ada2036d56851e6e61a1cd2653ad45f33e39388bde859dfb4806f4a60d9dbfac5fe41b6d2a8b395c44d4525e3 HEAD_REF master - PATCHES gstreamer-disable-hot-doc.patch + PATCHES gstreamer-disable-hot-doc.patch fix-clang-cl.patch ) vcpkg_from_github( OUT_SOURCE_PATH GST_SOURCE_PATH @@ -12,7 +12,7 @@ vcpkg_from_github( REF 1.19.2 SHA512 6070f1febf2a1bcc6e68f1e03c1b76891db210773065696e26fac20f0bd3ff47e1634222a49f93a10f6e47717ff21084c9ae0feed6a20facb9650aeb879cc380 HEAD_REF master - PATCHES gstreamer-disable-no-unused.patch + PATCHES gstreamer-disable-no-unused.patch fix-clang-cl-gstreamer.patch ) if(VCPKG_TARGET_IS_WINDOWS) list(APPEND PLUGIN_BASE_PATCHES plugins-base-use-zlib.patch plugin-base-disable-no-unused.patch) @@ -25,7 +25,7 @@ vcpkg_from_github( REF 1.19.2 SHA512 d2005e6a3bda5f08395b131347e8f4054c2469e04e65d1acc1a1572bf10d81d4dad4e43d6a8600346b6175a2310f81157a0cd27398ef69b5363b16346febfb39 HEAD_REF master - PATCHES ${PLUGIN_BASE_PATCHES} + PATCHES ${PLUGIN_BASE_PATCHES} fix-clang-cl-base.patch ) vcpkg_from_github( OUT_SOURCE_PATH GST_PLUGIN_GOOD_SOURCE_PATH @@ -33,7 +33,7 @@ vcpkg_from_github( REF 1.19.2 SHA512 71e9f36d407db3b75d9a68f6447093aa011b2b586b06e0a1bb79c7db37c9114de505699e99a4dad06d8d9c742e91f48dd35457283babe440f88a9e40d3da465b HEAD_REF master - PATCHES ${PLUGIN_GOOD_PATCHES} + PATCHES ${PLUGIN_GOOD_PATCHES} fix-clang-cl-good.patch ) vcpkg_from_github( OUT_SOURCE_PATH GST_PLUGIN_BAD_SOURCE_PATH @@ -41,6 +41,7 @@ vcpkg_from_github( REF 1.19.2 SHA512 f63ca3abf380bba92dca4ac3a51cba5ea95093693cf64d167a7a9c0bf6341c35a74fd42332673dbd1581ea70da0a35026aa3e2ce99b5e573268ccb55b5491c1d HEAD_REF master + PATCHES fix-clang-cl-bad.patch ) vcpkg_from_github( OUT_SOURCE_PATH GST_PLUGIN_UGLY_SOURCE_PATH @@ -48,7 +49,7 @@ vcpkg_from_github( REF 1.19.2 SHA512 70dcd4a36d3bd35f680eaa3c980842fbb57f55f17d1453c6a95640709b1b33a263689bf54caa367154267d281e5474686fedaa980de24094de91886a57b6547a HEAD_REF master - PATCHES ${PLUGIN_UGLY_PATCHES} + PATCHES ${PLUGIN_UGLY_PATCHES} fix-clang-cl-ugly.patch ) vcpkg_from_gitlab( GITLAB_URL https://gitlab.freedesktop.org diff --git a/ports/gstreamer/vcpkg.json b/ports/gstreamer/vcpkg.json index 43bfd15e65..0c7b5d83d1 100644 --- a/ports/gstreamer/vcpkg.json +++ b/ports/gstreamer/vcpkg.json @@ -1,7 +1,7 @@ { "name": "gstreamer", "version": "1.19.2", - "port-version": 5, + "port-version": 6, "description": "GStreamer open-source multimedia framework core library", "homepage": "https://gstreamer.freedesktop.org/", "license": "LGPL-2.0", diff --git a/versions/baseline.json b/versions/baseline.json index f9a9391151..2f48652617 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2726,7 +2726,7 @@ }, "gstreamer": { "baseline": "1.19.2", - "port-version": 5 + "port-version": 6 }, "gtest": { "baseline": "1.12.1", diff --git a/versions/g-/gstreamer.json b/versions/g-/gstreamer.json index 4accf168ca..f475f0a1ba 100644 --- a/versions/g-/gstreamer.json +++ b/versions/g-/gstreamer.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "245207bd8010181848ffaad5822f2492f2cb2b38", + "version": "1.19.2", + "port-version": 6 + }, { "git-tree": "0524a22dbda0c09201b9c677b6f72dbce870d6df", "version": "1.19.2",