git: bbdab99505af - main - audio/noise-suppression-for-voice-lv2: Fix build by disabling VST3

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 15 Aug 2023 03:00:47 UTC
The branch main has been updated by yuri:

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

commit bbdab99505af5510df12cbf37c9187594450f083
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2023-08-15 02:21:31 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-08-15 03:00:41 +0000

    audio/noise-suppression-for-voice-lv2: Fix build by disabling VST3
    
    Add options LADSPA and VST3. The VST3 plugin isn;t built any more
    after juce update. Now the new option VST3 is OFF by default.
    
    Reported by:    fallout
---
 audio/noise-suppression-for-voice-lv2/Makefile  | 26 ++++++++++++++++++-------
 audio/noise-suppression-for-voice-lv2/pkg-plist |  4 ++--
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/audio/noise-suppression-for-voice-lv2/Makefile b/audio/noise-suppression-for-voice-lv2/Makefile
index f0b28acad7b0..7027054e169f 100644
--- a/audio/noise-suppression-for-voice-lv2/Makefile
+++ b/audio/noise-suppression-for-voice-lv2/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	noise-suppression-for-voice
 DISTVERSIONPREFIX=	v
 DISTVERSION=	1.03
+PORTREVISION=	1
 CATEGORIES=	audio
 PKGNAMESUFFIX=	-lv2
 
@@ -24,21 +25,32 @@ CXXFLAGS+=	-DJUCE_CUSTOM_VST3_SDK=1
 
 PLIST_SUB=	XARCH=${ARCH:S/amd64/x86_64/}
 
+OPTIONS_DEFINE=		LADSPA VST3
+OPTIONS_DEFAULT=	LADSPA #VST3
+OPTIONS_SUB=		yes
+
+LADSPA_CMAKE_BOOL=	BUILD_LADSPA_PLUGIN
+
+VST3_CMAKE_BOOL=	BUILD_VST3_PLUGIN
+VST3_BROKEN=		fails to build with juce-7.0.6, see https://github.com/werman/noise-suppression-for-voice/issues/177
+
 post-extract: # remove bundled JUCE
 	@${RM} -rf ${WRKSRC}/external/JUCE
 
-post-install: # move plugins to a proper place: workaround for https://github.com/juce-framework/JUCE/issues/1237
-	# LV2 plugin
+post-install: # move plugins to a proper place: workaround for https://github.com/juce-framework/JUCE/issues/1237 and strip binaries
 	@${MV} ${STAGEDIR}${WRKDIR}/.lv2 ${STAGEDIR}${PREFIX}/lib/lv2
-	# VST3 plugin
-	@${MKDIR} ${STAGEDIR}${PREFIX}/lib/vst3
-	@${MV} `${FIND} ${STAGEDIR} -name rnnoise.vst3` ${STAGEDIR}${PREFIX}/lib/vst3
 	# remove empty directories
 	@${FIND} ${STAGEDIR} -type d -empty -delete
 	# strip binaries
-	cd ${STAGEDIR}${PREFIX} && ${STRIP_CMD} \
+	@cd ${STAGEDIR}${PREFIX} && ${STRIP_CMD} \
 		lib/lv2/rnnoise_mono.lv2/librnnoise_mono.so \
-		lib/lv2/rnnoise_stereo.lv2/librnnoise_stereo.so \
+		lib/lv2/rnnoise_stereo.lv2/librnnoise_stereo.so
+
+post-install-VST3-on:
+	@${MKDIR} ${STAGEDIR}${PREFIX}/lib/vst3
+	@${MV} `${FIND} ${STAGEDIR} -name rnnoise.vst3` ${STAGEDIR}${PREFIX}/lib/vst3
+	# strip binaries
+	@cd ${STAGEDIR}${PREFIX} && ${STRIP_CMD} \
 		lib/vst3/rnnoise.vst3/Contents/*/rnnoise.so
 
 # the LADSPA plugin can be used directly from PulseAudio's config file
diff --git a/audio/noise-suppression-for-voice-lv2/pkg-plist b/audio/noise-suppression-for-voice-lv2/pkg-plist
index dcf464e8be5d..a9904af4cd15 100644
--- a/audio/noise-suppression-for-voice-lv2/pkg-plist
+++ b/audio/noise-suppression-for-voice-lv2/pkg-plist
@@ -1,4 +1,4 @@
-lib/ladspa/librnnoise_ladspa.so
+%%LADSPA%%lib/ladspa/librnnoise_ladspa.so
 lib/lv2/rnnoise_mono.lv2/dsp.ttl
 lib/lv2/rnnoise_mono.lv2/librnnoise_mono.so
 lib/lv2/rnnoise_mono.lv2/manifest.ttl
@@ -7,4 +7,4 @@ lib/lv2/rnnoise_stereo.lv2/dsp.ttl
 lib/lv2/rnnoise_stereo.lv2/librnnoise_stereo.so
 lib/lv2/rnnoise_stereo.lv2/manifest.ttl
 lib/lv2/rnnoise_stereo.lv2/ui.ttl
-lib/vst3/rnnoise.vst3/Contents/%%XARCH%%-linux/rnnoise.so
+%%VST3%%lib/vst3/rnnoise.vst3/Contents/%%XARCH%%-linux/rnnoise.so