Ticket #56114: patch-port-for-vsteffect.diff

File patch-port-for-vsteffect.diff, 6.1 KB (added by RJVB (René Bertin), 6 years ago)
  • audio/audacity/Portfile

    commit ce2958b118a3de0d3a91d138f23b628b7f58a64c
    Author: R.J.V. Bertin <rjvbertin@gmail.com>
    Date:   Wed Mar 21 15:18:48 2018 +0100
    
        port:audacity : address a libstdc++ build problem with VSTEffect and support C++11 everywhere on Mac.
        
    diff --git a/audio/audacity/Portfile b/audio/audacity/Portfile
    index 35216d9e..e9027002 100644
    a b platform darwin { 
    133133                    patch-python.diff                                       \
    134134                    patch-vstcontrolosx.diff \
    135135                    patch-libnyquist-symbol-visibility.diff \
    136                     patch-fix-casts.diff \
     136                    patch-fix-vsteffects.diff \
    137137                    patch-add-MenusMac.diff \
    138138                    patch-skip-gcc-version-test.diff \
    139139                    patch-fix-audiounits.diff
    post-patch { 
    210210                                lib-src/lv2/configure
    211211    reinplace -W ${worksrcpath} "s|/usr/local|${prefix}|g" \
    212212                                src/effects/ladspa/LadspaEffect.cpp \
     213                                src/effects/VST/VSTEffect.cpp \
    213214                                src/export/ExportMP3.cpp \
    214215                                lib-src/lv2/lilv/wscript \
    215216                                lib-src/lv2/lilv/test/lilv_test.c
  • deleted file udio/audacity/files/patch-fix-casts.diff

    diff --git a/audio/audacity/files/patch-fix-casts.diff b/audio/audacity/files/patch-fix-casts.diff
    deleted file mode 100644
    index 7a165ddc..00000000
    + -  
    1 diff --git a/src/effects/VST/VSTEffect.cpp b/src/effects/VST/VSTEffect.cpp
    2 index 3cd95bd1c339ea1a744849562f387161d8be3ea2..b69547e22e6444c676c3eca98754139743da7183 100644
    3 --- a/src/effects/VST/VSTEffect.cpp
    4 +++ b/src/effects/VST/VSTEffect.cpp
    5 @@ -1110,7 +1110,9 @@ void VSTEffect::BundleDeleter::operator() (void* p) const
    6  void VSTEffect::ResourceDeleter::operator() (void *p) const
    7  {
    8     if (mpHandle) {
    9 -      int resource = (int)p;
    10 +      // take a detour to avoid a "fatal warning" about losing data downcasting a void* to int
    11 +      size_t dum = size_t(p);
    12 +      int resource = int(dum);
    13        CFBundleCloseBundleResourceMap(mpHandle->get(), resource);
    14     }
    15  }
  • new file audio/audacity/files/patch-fix-vsteffects.diff

    diff --git a/audio/audacity/files/patch-fix-vsteffects.diff b/audio/audacity/files/patch-fix-vsteffects.diff
    new file mode 100644
    index 00000000..96ca3bce
    - +  
     1diff --git a/src/effects/VST/VSTEffect.cpp b/src/effects/VST/VSTEffect.cpp
     2index 3cd95bd1c339ea1a744849562f387161d8be3ea2..b48eb3d838f1bf6981e5aad3bb860b3eec00c165 100644
     3--- a/src/effects/VST/VSTEffect.cpp
     4+++ b/src/effects/VST/VSTEffect.cpp
     5@@ -1110,14 +1110,23 @@ void VSTEffect::BundleDeleter::operator() (void* p) const
     6 void VSTEffect::ResourceDeleter::operator() (void *p) const
     7 {
     8    if (mpHandle) {
     9-      int resource = (int)p;
     10-      CFBundleCloseBundleResourceMap(mpHandle->get(), resource);
     11+      CFBundleRefNum *resource = reinterpret_cast<CFBundleRefNum*>(p);
     12+      if (resource)
     13+      {
     14+          CFBundleCloseBundleResourceMap(mpHandle->get(), *resource);
     15+          // resource is ours to free
     16+          free(resource);
     17+      }
     18    }
     19 }
     20 #endif
     21 
     22 VSTEffect::VSTEffect(const wxString & path, VSTEffect *master)
     23 :  mPath(path),
     24+#ifdef __WXMAC__
     25+   // mResource must be initialised explicitly when building against libstdc++ instead of libc++
     26+   mResource(ResourceHandle{nullptr, nullptr}),
     27+#endif
     28    mMaster(master)
     29 {
     30    mHost = NULL;
     31@@ -1994,7 +2003,7 @@ bool VSTEffect::Load()
     32    // Start clean
     33    mBundleRef.reset();
     34 
     35-   mResource = ResourceHandle{};
     36+   mResource = ResourceHandle{nullptr, nullptr};
     37 
     38    // Convert the path to a CFSTring
     39    wxCFStringRef path(realPath);
     40@@ -2064,11 +2073,12 @@ bool VSTEffect::Load()
     41    mBundleRef = std::move(bundleRef);
     42 
     43    // Open the resource map ... some plugins (like GRM Tools) need this.
     44-   mResource = ResourceHandle {
     45-      reinterpret_cast<char*>(
     46-         CFBundleOpenBundleResourceMap(mBundleRef.get())),
     47-      ResourceDeleter{&mBundleRef}
     48-   };
     49+   // CFBundleOpenBundleResourceMap() returns a CFBundleRefNum which is
     50+   // an int, so we use a cache variable to avoid having to upcast to a
     51+   // pointer (upcasting is easy, downcasting back to an int less so).
     52+   CFBundleRefNum *resource = new CFBundleRefNum;
     53+   *resource = CFBundleOpenBundleResourceMap(mBundleRef.get());
     54+   mResource = ResourceHandle {resource, ResourceDeleter{&mBundleRef}};
     55 
     56 #elif defined(__WXMSW__)
     57 
     58@@ -2270,7 +2280,7 @@ void VSTEffect::Unload()
     59    if (mModule)
     60    {
     61 #if defined(__WXMAC__)
     62-      mResource = ResourceHandle{};
     63+      mResource = ResourceHandle{nullptr, nullptr};
     64       mBundleRef.reset();
     65 #endif
     66 
     67diff --git a/src/effects/VST/VSTEffect.h b/src/effects/VST/VSTEffect.h
     68index ccf4e12b7ae0279c5900b8517c18a1a7e65aef51..4cad1618c87403a1cf4fa17023bcffe448c2f27f 100644
     69--- a/src/effects/VST/VSTEffect.h
     70+++ b/src/effects/VST/VSTEffect.h
     71@@ -308,7 +308,7 @@ private:
     72       void operator() (void*) const;
     73    };
     74    using ResourceHandle = std::unique_ptr<
     75-      char, ResourceDeleter
     76+      CFBundleRefNum, ResourceDeleter
     77    >;
     78    ResourceHandle mResource;
     79 #endif
  • audio/audacity/files/patch-unordered_map-fixes.diff

    diff --git a/audio/audacity/files/patch-unordered_map-fixes.diff b/audio/audacity/files/patch-unordered_map-fixes.diff
    index a386b6f7..f84a5c9d 100644
    a b diff --git a/src/MemoryX.h b/src/MemoryX.h 
    22index 56e99171a9eb87fe574291d0ec9d086efb0c1fbb..621afa3001ba354f36e80edb86c72a45dca426cb 100644
    33--- a/src/MemoryX.h
    44+++ b/src/MemoryX.h
     5@@ -11,7 +13,7 @@
     6 // std:: containers knowing about rvalue references
     7 #undef __AUDACITY_OLD_STD__
     8 
     9-#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED <= __MAC_10_6
     10+#if 0 //defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED <= __MAC_10_6
     11 
     12 #define __AUDACITY_OLD_STD__
     13 
    514@@ -1177,7 +1179,7 @@ namespace std
    615    namespace tr1
    716    {