Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gmt5, gmt6: fix common_sighandler patch #26601

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions science/gmt5/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ subport gmt6 {
epoch 1
}
categories science
platforms darwin
maintainers {me.com:remko.scharroo @remkos} openmaintainer
license GPL-3
description The Generic Mapping Tools
Expand All @@ -42,10 +41,14 @@ if {${subport} eq "gmt5"} {
checksums rmd160 900befd66ec4a9aea75c53d99ed83f7e25163e35\
sha256 078d4997507cb15344c74a874568985e45bdbd6d3a72d330c74c47f4c0359bb1 \
size 59175704

patchfiles patch-gmt5-common_sighandler.diff
} else {
checksums rmd160 3e47113d134bde756b98906a4704b3151902c4d1 \
sha256 4022adb44033f9c1d5a4d275b69506449e4d486efe2218313f3ff7a6c6c3141e \
size 58696516

patchfiles patch-gmt6-common_sighandler.diff
}

depends_lib port:curl \
Expand All @@ -54,10 +57,6 @@ depends_lib port:curl \
port:gshhg-gmt \
port:netcdf

if {${subport} eq "gmt5"} {
patchfiles patch-gmt5-arm64.diff
}

default_variants +gdal +pcre
if {![variant_isset lgpl]} {
default_variants-append +nonfree
Expand Down
11 changes: 0 additions & 11 deletions science/gmt5/files/patch-gmt5-arm64.diff

This file was deleted.

23 changes: 23 additions & 0 deletions science/gmt5/files/patch-gmt5-common_sighandler.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--- src/common_sighandler.c.orig 2019-01-03 15:39:17
+++ src/common_sighandler.c 2024-07-15 17:48:27
@@ -58,11 +58,19 @@
# if __DARWIN_UNIX03
# ifdef __x86_64__
# define UC_IP(uc) ((void *) (uc)->uc_mcontext->__ss.__rip)
+# elif defined(__arm64__) /* Apple Silicon, e.g. M1 */
+# define UC_IP(uc) ((void *) (uc)->uc_mcontext->__ss.__pc)
+# elif defined(__POWERPC__) /* Both ppc and ppc64 */
+# define UC_IP(uc) ((void *) (uc)->uc_mcontext->__ss.__srr0)
# else
# define UC_IP(uc) ((void *) (uc)->uc_mcontext->__ss.__eip)
# endif
# else
-# define UC_IP(uc) ((void *) (uc)->uc_mcontext->ss.eip)
+# ifdef __ppc__
+# define UC_IP(uc) ((void *) (uc)->uc_mcontext->ss.srr0)
+# else
+# define UC_IP(uc) ((void *) (uc)->uc_mcontext->ss.eip)
+# endif
# endif
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# ifdef __x86_64__
35 changes: 35 additions & 0 deletions science/gmt5/files/patch-gmt6-common_sighandler.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From 458738d52a9068a140155061757c7fa3bc27cc45 Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <[email protected]>
Date: Thu, 18 Jul 2024 22:36:57 +0800
Subject: [PATCH] gmt_common_sighandler.c: fix ucontext for Apple

---
src/gmt_common_sighandler.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git src/gmt_common_sighandler.c src/gmt_common_sighandler.c
index b6eaf7c95..f21d0ae58 100644
--- src/gmt_common_sighandler.c
+++ src/gmt_common_sighandler.c
@@ -80,13 +80,19 @@ GMT_LOCAL void backtrace_symbols_fd(void *const *buffer, int size, int fd) {
# if __DARWIN_UNIX03
# ifdef __x86_64__
# define UC_IP(uc) ((void *) (uc)->uc_mcontext->__ss.__rip)
-# elif __arm64__ /* Apple Silicon, e.g. M1 */
+# elif defined(__arm64__) /* Apple Silicon, e.g. M1 */
# define UC_IP(uc) ((void *) (uc)->uc_mcontext->__ss.__pc)
+# elif defined(__POWERPC__) /* Both ppc and ppc64 */
+# define UC_IP(uc) ((void *) (uc)->uc_mcontext->__ss.__srr0)
# else
# define UC_IP(uc) ((void *) (uc)->uc_mcontext->__ss.__eip)
# endif
# else
-# define UC_IP(uc) ((void *) (uc)->uc_mcontext->ss.eip)
+# ifdef __ppc__
+# define UC_IP(uc) ((void *) (uc)->uc_mcontext->ss.srr0)
+# else
+# define UC_IP(uc) ((void *) (uc)->uc_mcontext->ss.eip)
+# endif
# endif
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# ifdef __x86_64__
Loading