git: bc8d27492221 - main - devel/juce: Add FreeBSD compatibility patches

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Fri, 09 Jun 2023 15:48:03 UTC
The branch main has been updated by yuri:

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

commit bc8d27492221f73768fa7359ce7c6f0ba0d7e2b1
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2023-06-09 07:07:20 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-06-09 15:48:00 +0000

    devel/juce: Add FreeBSD compatibility patches
---
 devel/juce/Makefile                                |  1 +
 ...types_VST3__SDK_pluginterfaces_base_fplatform.h | 46 ++++++++++++++++++++++
 ...ypes_VST3__SDK_pluginterfaces_base_funknown.cpp | 29 ++++++++++++++
 3 files changed, 76 insertions(+)

diff --git a/devel/juce/Makefile b/devel/juce/Makefile
index 2b018c0ab851..173ad4201784 100644
--- a/devel/juce/Makefile
+++ b/devel/juce/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	juce
 DISTVERSION=	7.0.5
+PORTREVISION=	1
 CATEGORIES=	devel
 
 MAINTAINER=	yuri@FreeBSD.org
diff --git a/devel/juce/files/patch-modules_juce__audio__processors_format__types_VST3__SDK_pluginterfaces_base_fplatform.h b/devel/juce/files/patch-modules_juce__audio__processors_format__types_VST3__SDK_pluginterfaces_base_fplatform.h
new file mode 100644
index 000000000000..010ec0eed47a
--- /dev/null
+++ b/devel/juce/files/patch-modules_juce__audio__processors_format__types_VST3__SDK_pluginterfaces_base_fplatform.h
@@ -0,0 +1,46 @@
+--- modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/fplatform.h.orig	2023-01-25 11:45:10 UTC
++++ modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/fplatform.h
+@@ -139,6 +139,43 @@
+ 		#define SMTG_HAS_NOEXCEPT 1
+ 	#endif
+ //-----------------------------------------------------------------------------
++// BSD
++//-----------------------------------------------------------------------------
++#elif __FreeBSD__
++	#define SMTG_OS_LINUX	1 // atomic operations need to be implemented
++	#define SMTG_OS_MACOS	0
++	#define SMTG_OS_WINDOWS	0
++	#define SMTG_OS_IOS		0
++	#define SMTG_OS_OSX		0
++
++	#include <sys/endian.h>
++	#if __BYTE_ORDER == __LITTLE_ENDIAN
++		#define BYTEORDER kLittleEndian
++	#else
++		#define BYTEORDER kBigEndian
++	#endif
++
++	#define COM_COMPATIBLE	0
++	#define PLUGIN_API
++	#define SMTG_PTHREADS	1
++
++	#define SMTG_EXPORT_SYMBOL __attribute__ ((visibility ("default")))
++
++	#if __LP64__
++		#define SMTG_PLATFORM_64 1
++	#else
++		#define SMTG_PLATFORM_64 0
++	#endif
++	#ifdef __cplusplus
++		#include <cstddef>
++		#define SMTG_CPP11 (__cplusplus >= 201103L)
++		#ifndef SMTG_CPP11
++			#error unsupported compiler
++		#endif
++		#define SMTG_CPP11_STDLIBSUPPORT 1
++		#define SMTG_HAS_NOEXCEPT 1
++	#endif
++//-----------------------------------------------------------------------------
+ // Mac and iOS
+ //-----------------------------------------------------------------------------
+ #elif __APPLE__
diff --git a/devel/juce/files/patch-modules_juce__audio__processors_format__types_VST3__SDK_pluginterfaces_base_funknown.cpp b/devel/juce/files/patch-modules_juce__audio__processors_format__types_VST3__SDK_pluginterfaces_base_funknown.cpp
new file mode 100644
index 000000000000..c8583d61d146
--- /dev/null
+++ b/devel/juce/files/patch-modules_juce__audio__processors_format__types_VST3__SDK_pluginterfaces_base_funknown.cpp
@@ -0,0 +1,29 @@
+--- modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/funknown.cpp.orig	2023-03-05 05:39:00 UTC
++++ modules/juce_audio_processors/format_types/VST3_SDK/pluginterfaces/base/funknown.cpp
+@@ -44,7 +44,7 @@
+ #endif // !SMTG_USE_STDATOMIC_H
+ #endif // SMTG_OS_MACOS
+ 
+-#if SMTG_OS_LINUX
++#if SMTG_OS_LINUX && !JUCE_BSD
+ #if !defined (SMTG_USE_STDATOMIC_H)
+ #if defined (__ANDROID__) || defined(_LIBCPP_VERSION)
+ #define SMTG_USE_STDATOMIC_H 1
+@@ -100,7 +100,7 @@ int32 PLUGIN_API atomicAdd (int32& var, int32 d)
+ 	return OSAtomicAdd32Barrier (d, (int32_t*)&var);
+ #elif defined(__ANDROID__)
+ 	return atomic_fetch_add ((atomic_int*)&var, d) + d;
+-#elif SMTG_OS_LINUX
++#elif SMTG_OS_LINUX && !JUCE_BSD
+ 	__gnu_cxx::__atomic_add (&var, d);
+ 	return var;
+ #else
+@@ -177,7 +177,7 @@ bool FUID::generate ()
+ 	}
+ 	return false;
+ 
+-#elif SMTG_OS_LINUX
++#elif SMTG_OS_LINUX && !JUCE_BSD
+ 	srand ((size_t)this);
+ 	for (int32 i = 0; i < 16; i++)
+ 		data[i] = static_cast<unsigned char>(rand ());