git: 673838eec302 - main - audio/qtractor: Add VST3 audio plugin support

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Mon, 18 Apr 2022 17:20:06 UTC
The branch main has been updated by yuri:

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

commit 673838eec302b99090361b1f4612c07fb530db56
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-04-18 17:13:47 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-04-18 17:20:02 +0000

    audio/qtractor: Add VST3 audio plugin support
---
 audio/qtractor/Makefile | 32 ++++++++++++++++++++++++++------
 audio/qtractor/distinfo |  4 +++-
 2 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/audio/qtractor/Makefile b/audio/qtractor/Makefile
index 7d912ddba9a7..977dd91f8e0d 100644
--- a/audio/qtractor/Makefile
+++ b/audio/qtractor/Makefile
@@ -3,8 +3,11 @@ DISTVERSIONPREFIX=	qtractor_
 DISTVERSION=	0_9_26
 PORTREVISION=	1
 CATEGORIES=	audio
-MASTER_SITES=	https://github.com/rncbc/qtractor/archive/refs/tags/
-DISTNAME=	${PORTNAME}_${DISTVERSION}
+MASTER_SITES=	https://github.com/rncbc/qtractor/archive/refs/tags/ \
+		https://download.steinberg.net/sdk_downloads/:vst3sdk
+DISTFILES=	${PORTNAME}_${DISTVERSION}${EXTRACT_SUFX} \
+		${VST3_SDK_ARCHIVE}:vst3sdk
+EXTRACT_ONLY=	${PORTNAME}_${DISTVERSION}${EXTRACT_SUFX}
 
 MAINTAINER=	yuri@FreeBSD.org
 COMMENT=	Audio/MIDI multi-track sequencer
@@ -41,17 +44,34 @@ USE_QT=		core gui widgets xml buildtools_build linguisttools_build qmake_build
 WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTNAME}_${DISTVERSION}
 
 OPTIONS_DEFINE=		VST3
-#OPTIONS_DEFAULT=	VST3
+OPTIONS_DEFAULT=	VST3
 
 VST3_DESC=		Enable VST3 plug-in support
+VST3_USES=		xorg
+VST3_USE=		XORG=xcb
 VST3_CMAKE_BOOL=	CONFIG_VST3
-#VST3_CMAKE_ON=		-DCONFIG_VST3SDK=${LOCALBASE}/include/vst3sdk
-VST3_BUILD_DEPENDS=	vst3sdk>0:audio/vst3sdk
-VST3_BROKEN=		https://github.com/rncbc/qtractor/issues/331
+VST3_CMAKE_ON=		-DCONFIG_VST3SDK=${WRKDIR}/VST_SDK/vst3sdk
+#VST3_BUILD_DEPENDS=	vst3sdk>0:audio/vst3sdk # this is supposed to work instead of bundled archive, but it doesn't for some reason, see https://github.com/rncbc/qtractor/issues/331
+VST3_SDK_ARCHIVE=	vst-sdk_3.7.4_build-25_2021-12-16.zip
+
+post-extract-VST3-on:
+	@cd ${WRKDIR} && unzip -qq ${DISTDIR}/${VST3_SDK_ARCHIVE}
 
 post-patch:
 	@${REINPLACE_CMD} \
 		's|the ALSA Sequencer kernel module (snd-seq-midi)|alsa-seq-server (installed by audio/alsa-seq-server)|' \
 		${WRKSRC}/src/qtractorMainForm.cpp
 
+post-patch-VST3-on:
+	@${REINPLACE_CMD} -e ' \
+		s,__linux__,__linux__ || __FreeBSD__,; \
+		s,endian.h,sys/endian.h, \
+		' \
+		${WRKDIR}/VST_SDK/vst3sdk/pluginterfaces/base/fplatform.h
+	@${REINPLACE_CMD} -e ' \
+		s,stdatomic.h,atomic,; \
+		s,atomic_int_least32_t,std::atomic_int_least32_t, \
+		' \
+		${WRKDIR}/VST_SDK/vst3sdk/pluginterfaces/base/funknown.cpp
+
 .include <bsd.port.mk>
diff --git a/audio/qtractor/distinfo b/audio/qtractor/distinfo
index 4e4f1040d788..4478f638dfa8 100644
--- a/audio/qtractor/distinfo
+++ b/audio/qtractor/distinfo
@@ -1,3 +1,5 @@
-TIMESTAMP = 1649530830
+TIMESTAMP = 1650296821
 SHA256 (qtractor_0_9_26.tar.gz) = bf1f89a805166e99ca4b9bfc66f8bb1d71a258bf611b1e9e90613cd46799e6a4
 SIZE (qtractor_0_9_26.tar.gz) = 1801843
+SHA256 (vst-sdk_3.7.4_build-25_2021-12-16.zip) = 49b0e46345af323ab84be9df065653b2a6531745dea6f3ac3fb47915df9f3a81
+SIZE (vst-sdk_3.7.4_build-25_2021-12-16.zip) = 104869292