File JUCE7-Projucer-Link-stdc-fs-to-vst3_helper-if-necessary.patch of Package JUCE7_06

From 3d39e70393d629c39b9ae38aa17ed1b461b24a11 Mon Sep 17 00:00:00 2001
From: reuk <reuk@users.noreply.github.com>
Date: Mon, 18 Sep 2023 13:19:11 +0100
Subject: [PATCH] Projucer: Link stdc++fs to vst3_helper if necessary

---
 .../Source/ProjectSaving/jucer_ProjectExport_Make.h  | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h
index d4be74ed19ba..c8834c71cfff 100644
--- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h
+++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h
@@ -358,6 +358,8 @@ class MakefileProjectExporter  : public ProjectExporter
                 out << " $(JUCE_OUTDIR)/$(JUCE_TARGET_LV2_MANIFEST_HELPER)";
             else if (type == VST3PlugIn)
                 out << " $(JUCE_OUTDIR)/$(JUCE_TARGET_VST3_MANIFEST_HELPER)";
+            else if (type == VST3Helper)
+                out << " $(JUCE_OBJDIR)/cxxfs.cmd";
 
             out << newLine;
 
@@ -399,6 +401,9 @@ class MakefileProjectExporter  : public ProjectExporter
 
                 out << "$(JUCE_LDFLAGS) $(shell cat $(JUCE_OBJDIR)/execinfo.cmd) ";
 
+                if (type == VST3Helper)
+                    out << "$(shell cat $(JUCE_OBJDIR)/cxxfs.cmd) ";
+
                 if (getTargetFileType() == sharedLibraryOrDLL || getTargetFileType() == pluginBundle
                         || type == GUIApp || type == StandalonePlugIn)
                     out << "$(JUCE_LDFLAGS_" << getTargetVarName() << ") ";
@@ -1224,6 +1229,13 @@ class MakefileProjectExporter  : public ProjectExporter
             << "\t$(V_AT)printf \"int main() { return 0; }\" | $(CXX) -x c++ -o $(@D)/execinfo.x -lexecinfo - >/dev/null 2>&1 && printf -- \"-lexecinfo\" > \"$@\" || touch \"$@\"" << newLine
             << newLine;
 
+        // stdc++fs is only needed for some compilers
+        out << "$(JUCE_OBJDIR)/cxxfs.cmd:" << newLine
+            << "\t-$(V_AT)mkdir -p $(@D)" << newLine
+            << "\t-@if [ -z \"$(V_AT)\" ]; then echo \"Checking if we need to link stdc++fs\"; fi" << newLine
+            << "\t$(V_AT)printf \"int main() { return 0; }\" | $(CXX) -x c++ -o $(@D)/cxxfs.x -lstdc++fs - >/dev/null 2>&1 && printf -- \"-lstdc++fs\" > \"$@\" || touch \"$@\"" << newLine
+            << newLine;
+
         if (linuxSubprocessHelperProperties.shouldUseLinuxSubprocessHelper())
             writeSubprocessHelperTargets (out);
 
openSUSE Build Service is sponsored by