git: 96656498bcbd - main - audio/dexed: Add VST3 option that installs VST3 plugin

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Wed, 13 Apr 2022 19:31:38 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=96656498bcbd2217fc940afde62aed131426dbda

commit 96656498bcbd2217fc940afde62aed131426dbda
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-04-13 19:31:01 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-04-13 19:31:36 +0000

    audio/dexed: Add VST3 option that installs VST3 plugin
---
 audio/dexed/Makefile                                 | 16 ++++++++++++++++
 audio/dexed/files/patch-Source_CMakeLists.txt        | 13 -------------
 ..._modules_juce__core_native_juce__linux__Files.cpp | 20 ++++++++++++++++++++
 3 files changed, 36 insertions(+), 13 deletions(-)

diff --git a/audio/dexed/Makefile b/audio/dexed/Makefile
index 4dcd9042cff8..0ea8282a75d9 100644
--- a/audio/dexed/Makefile
+++ b/audio/dexed/Makefile
@@ -2,6 +2,7 @@ PORTNAME=	dexed
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.9.6-16
 DISTVERSIONSUFFIX=	-g1df9a58
+PORTREVISION=	1
 CATEGORIES=	audio
 PKGNAMESUFFIX=	-synth
 
@@ -39,7 +40,22 @@ DOS2UNIX_GLOB=	*.cpp *.h
 
 PLIST_FILES=	bin/Dexed
 
+OPTIONS_DEFINE=		VST3
+OPTIONS_DEFAULT=	VST3
+
+VST3_DESC=		Build the VST3 plugin
+VST3_BUILD_DEPENDS=	vst3sdk>0:audio/vst3sdk
+VST3_CXXFLAGS=		-DJUCE_CUSTOM_VST3_SDK=1 -fPIC
+VST3_PLIST_FILES=	lib/vst/Dexed.so
+
+post-patch-VST3-off:
+	@${REINPLACE_CMD} -e 's/FORMATS AU VST3 Standalone/FORMATS AU Standalone/' ${WRKSRC}/Source/CMakeLists.txt
+
 do-install: # workaround for https://github.com/asb2m10/dexed/issues/342
 	${INSTALL_PROGRAM} ${BUILD_WRKSRC}/Source/Dexed_artefacts/Release/Standalone/Dexed ${STAGEDIR}${PREFIX}/bin
 
+do-install-VST3-on:
+	${MKDIR} ${STAGEDIR}${PREFIX}/lib/vst
+	${INSTALL_LIB} ${BUILD_WRKSRC}/Source/Dexed_artefacts/Release/VST3/Dexed.vst3/Contents/x86_64-linux/Dexed.so ${STAGEDIR}${PREFIX}/lib/vst
+
 .include <bsd.port.mk>
diff --git a/audio/dexed/files/patch-Source_CMakeLists.txt b/audio/dexed/files/patch-Source_CMakeLists.txt
deleted file mode 100644
index b7cc65d9758c..000000000000
--- a/audio/dexed/files/patch-Source_CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-- disable the VST3 plugin, pending https://github.com/asb2m10/dexed/issues/340
-
---- Source/CMakeLists.txt.orig	2022-04-13 02:18:02 UTC
-+++ Source/CMakeLists.txt
-@@ -13,7 +13,7 @@ juce_add_plugin("${BaseTargetName}"
-         COPY_PLUGIN_AFTER_BUILD FALSE
-         PLUGIN_MANUFACTURER_CODE DGSB
-         PLUGIN_CODE Dexd
--        FORMATS AU VST3 Standalone
-+        FORMATS AU Standalone
-         PRODUCT_NAME "Dexed"
-         DESCRIPTION "Dexed FM Synth"
- )
diff --git a/audio/dexed/files/patch-libs_JUCE_modules_juce__core_native_juce__linux__Files.cpp b/audio/dexed/files/patch-libs_JUCE_modules_juce__core_native_juce__linux__Files.cpp
new file mode 100644
index 000000000000..e0eb95270cda
--- /dev/null
+++ b/audio/dexed/files/patch-libs_JUCE_modules_juce__core_native_juce__linux__Files.cpp
@@ -0,0 +1,20 @@
+--- libs/JUCE/modules/juce_core/native/juce_linux_Files.cpp.orig	2022-04-13 18:55:08 UTC
++++ libs/JUCE/modules/juce_core/native/juce_linux_Files.cpp
+@@ -21,7 +21,7 @@
+ */
+ 
+ #if JUCE_BSD
+-extern char** environ;
++//extern char** environ;
+ #endif
+ 
+ namespace juce
+@@ -230,7 +230,7 @@ bool Process::openDocument (const String& fileName, co
+         setsid();
+ 
+         // Child process
+-        execve (argv[0], (char**) argv, environ);
++        execv (argv[0], (char**) argv);
+         exit (0);
+     }
+