Skip to content

Commit

Permalink
dcmtk: fix environ for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
barracuda156 committed Dec 13, 2024
1 parent b2fab58 commit 3369288
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 31 deletions.
7 changes: 5 additions & 2 deletions graphics/dcmtk/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ compiler.cxx_standard 2011
# avoid self-conflict
patchfiles install_path_fix_part2.patch

# https://github.com/DCMTK/dcmtk/pull/112
patchfiles-append 0001-ofstub.cc-fix-environ-for-Apple.patch

configure.cppflags-replace -I${prefix}/include -isystem${prefix}/include

depends_lib path:include/turbojpeg.h:libjpeg-turbo \
Expand All @@ -50,7 +53,7 @@ depends_lib path:include/turbojpeg.h:libjpeg-turbo \
port:tiff \
port:zlib

depends_build-append port:pkgconfig
depends_build-append path:bin/pkg-config:pkgconfig

configure.args-append -DDCMTK_WITH_TIFF=ON \
-DDCMTK_WITH_OPENJPEG=OFF \
Expand Down Expand Up @@ -156,7 +159,7 @@ if {${os.platform} eq "darwin" \
# builds and works only on 10.6 for ppc builds. Make sure
# this patch cannot be applied elsewhere, and also not used
# if legacy_dispatch is chosen.
patchfiles-append 0001-Revert-Fixed-OFSemaphore-for-macOS.patch
patchfiles-append 0002-Revert-Fixed-OFSemaphore-for-macOS.patch
}

default_variants +ssl
Expand Down
25 changes: 25 additions & 0 deletions graphics/dcmtk/files/0001-ofstub.cc-fix-environ-for-Apple.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 881965da18dee93aa38570a0d2fe292c37365bd8 Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <[email protected]>
Date: Fri, 13 Dec 2024 17:03:57 +0800
Subject: [PATCH] ofstub.cc: fix environ for Apple

---
ofstd/libsrc/ofstub.cc | 5 +++++
1 file changed, 5 insertions(+)

diff --git ofstd/libsrc/ofstub.cc ofstd/libsrc/ofstub.cc
index c1df7068e..bba147e26 100644
--- ofstd/libsrc/ofstub.cc
+++ ofstd/libsrc/ofstub.cc
@@ -141,6 +141,11 @@ static OFString getLastErrorString()
return OFString();
}

+#elif defined(__APPLE__)
+
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+
#else /* _WIN32 */

extern char** environ; // required to exist by the Single Unix Specification
29 changes: 0 additions & 29 deletions graphics/dcmtk/files/patch-fix-powerpc.diff

This file was deleted.

0 comments on commit 3369288

Please sign in to comment.