From 85f818ab0b1b0b0d58f46a56f28ca32b19fc2245 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 5 Dec 2020 14:23:35 +0100 Subject: [PATCH] Patch the SDK for winegcc debug builds --- meson.build | 1 + tools/patch-vst3-sdk.sh | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 54162984..1aeec32a 100644 --- a/meson.build +++ b/meson.build @@ -106,6 +106,7 @@ host_sources = [ if with_vst3 host_sources += [ + 'src/common/logging/vst3.cpp', 'src/common/serialization/vst3/plugin-factory.cpp', 'src/wine-host/bridges/vst3.cpp', ] diff --git a/tools/patch-vst3-sdk.sh b/tools/patch-vst3-sdk.sh index 7e9edc1f..006a3cbf 100755 --- a/tools/patch-vst3-sdk.sh +++ b/tools/patch-vst3-sdk.sh @@ -19,12 +19,15 @@ if [[ -z $sdk_directory ]]; then exit 1 fi -# TODO: Debug builds fail now because it's using an unimplemented variation of printf - # Make sure all imports use the correct casing find "$sdk_directory" -type f \( -iname '*.h' -or -iname '*.cpp' \) -print0 | xargs -0 sed -i -E 's/^#include <(Windows.h|ShlObj.h)>$/#include <\L\1\E>/' +# Use the proper libc functions instead of the MSVC intrinsics. These are also +# used in `fstring.cpp`, but there we will patch the entire file to use the +# standard POSIX/GCC string formatting facilities. +sed -i 's/\b_vsnprintf\b/vsnprintf/g;s/\b_snprintf\b/snprintf/g' "$sdk_directory/base/source/fdebug.cpp" + # Use the attributes and types from GCC sed -i 's/defined(__MINGW32__)/defined(__WINE__)/g' "$sdk_directory/pluginterfaces/base/ftypes.h" @@ -64,6 +67,10 @@ replace_char16 "using ConverterFacet = std::codecvt_utf8_utf16;" "$sdk replace_char16 "using Converter = std::wstring_convert;" "$sdk_directory/base/source/fstring.cpp" replace_char16 "using Converter = std::wstring_convert, char16_t>;" "$sdk_directory/pluginterfaces/base/ustring.cpp" +# Don't try adding `std::u8string` to an `std::vector`. MSVC +# probably coerces them, but GCC doesn't +sed -i 's/\bgeneric_u8string\b/generic_string/g' "$sdk_directory/public.sdk/source/vst/hosting/module_win32.cpp" + # libstdc++fs doesn't work under Winelib, for whatever reason that might be. # We'll patch the Win32 module loading to use Boost.Filesystem instead. sed -i 's/^#include <\(experimental\/\)\?filesystem>$/#include /' "$sdk_directory/public.sdk/source/vst/hosting/module_win32.cpp" @@ -71,10 +78,6 @@ sed -i 's/^using namespace std\(::experimental\)\?;$/namespace filesystem = boos sed -i 's/\bfile_type::directory\b/file_type::directory_file/g' "$sdk_directory/public.sdk/source/vst/hosting/module_win32.cpp" sed -i 's/\bp\.native ()/p.wstring ()/g' "$sdk_directory/public.sdk/source/vst/hosting/module_win32.cpp" -# Don't try adding `std::u8string` to an `std::vector`. MSVC -# probably coerces them, but GCC doesn't -sed -i 's/\bgeneric_u8string\b/generic_string/g' "$sdk_directory/public.sdk/source/vst/hosting/module_win32.cpp" - # Meson requires this program to output something, or else it will error out # when trying to encode the empty output echo "Successfully patched '$sdk_directory' for winegcc compatibility"