git: 4838430844ed - main - audio/dexed: Add better workaround for broken ENVIRON(7) in shared libraries

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Sun, 16 Oct 2022 23:55:57 UTC
The branch main has been updated by yuri:

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

commit 4838430844ed6d3a86ad82c591af3a575db113ab
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-10-16 23:42:04 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-10-16 23:55:55 +0000

    audio/dexed: Add better workaround for broken ENVIRON(7) in shared libraries
---
 audio/dexed/Makefile                                         |  2 +-
 ...ibs_JUCE_modules_juce__core_native_juce__linux__Files.cpp | 12 +++++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/audio/dexed/Makefile b/audio/dexed/Makefile
index c449fd29c0c1..d50b38503dbb 100644
--- a/audio/dexed/Makefile
+++ b/audio/dexed/Makefile
@@ -2,7 +2,7 @@ PORTNAME=	dexed
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.9.6-16
 DISTVERSIONSUFFIX=	-g1df9a58
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	audio
 PKGNAMESUFFIX=	-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
index 2814210653f1..0d81b4ad053b 100644
--- 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
@@ -1,22 +1,24 @@
 - otherwise it fails with unknown 'environ' symbol, see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263265
 
---- 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.orig	2022-08-15 18:29:17 UTC
 +++ libs/JUCE/modules/juce_core/native/juce_linux_Files.cpp
-@@ -21,7 +21,7 @@
+@@ -21,7 +21,9 @@
  */
  
  #if JUCE_BSD
 -extern char** environ;
-+//extern char** environ;
++//extern char** environ; // this is broken on FreeBSD, see https://reviews.freebsd.org/D30842
++#include <dlfcn.h>
++static char*** environ_ptr = (char***)dlsym(RTLD_DEFAULT, "environ"); // workaround for the above
  #endif
  
  namespace juce
-@@ -230,7 +230,7 @@ bool Process::openDocument (const String& fileName, co
+@@ -229,7 +231,7 @@ bool Process::openDocument (const String& fileName, co
          setsid();
  
          // Child process
 -        execve (argv[0], (char**) argv, environ);
-+        execv (argv[0], (char**) argv);
++        execve (argv[0], (char**) argv, *environ_ptr);
          exit (0);
      }