From 3ba545ae890b7bb3a8e3fbb8de7cbbc08266e564 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Thu, 14 Nov 2024 18:13:08 +0800 Subject: [PATCH] gmt5, gmt6: fix common_sighandler patch --- science/gmt5/Portfile | 9 +++-- science/gmt5/files/patch-gmt5-arm64.diff | 11 ------ .../files/patch-gmt5-common_sighandler.diff | 23 ++++++++++++ .../files/patch-gmt6-common_sighandler.diff | 35 +++++++++++++++++++ 4 files changed, 62 insertions(+), 16 deletions(-) delete mode 100644 science/gmt5/files/patch-gmt5-arm64.diff create mode 100644 science/gmt5/files/patch-gmt5-common_sighandler.diff create mode 100644 science/gmt5/files/patch-gmt6-common_sighandler.diff diff --git a/science/gmt5/Portfile b/science/gmt5/Portfile index c6cbe5a6aad9..7bb7317d1218 100644 --- a/science/gmt5/Portfile +++ b/science/gmt5/Portfile @@ -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 @@ -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 \ @@ -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 diff --git a/science/gmt5/files/patch-gmt5-arm64.diff b/science/gmt5/files/patch-gmt5-arm64.diff deleted file mode 100644 index 47c994b7690c..000000000000 --- a/science/gmt5/files/patch-gmt5-arm64.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- src/common_sighandler.c.orig 2019-01-03 15:39:17 -+++ src/common_sighandler.c 2024-07-15 17:48:27 -@@ -58,6 +58,8 @@ - # 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) - # else - # define UC_IP(uc) ((void *) (uc)->uc_mcontext->__ss.__eip) - # endif diff --git a/science/gmt5/files/patch-gmt5-common_sighandler.diff b/science/gmt5/files/patch-gmt5-common_sighandler.diff new file mode 100644 index 000000000000..a6e505ad8187 --- /dev/null +++ b/science/gmt5/files/patch-gmt5-common_sighandler.diff @@ -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__ diff --git a/science/gmt5/files/patch-gmt6-common_sighandler.diff b/science/gmt5/files/patch-gmt6-common_sighandler.diff new file mode 100644 index 000000000000..8b9ac962214d --- /dev/null +++ b/science/gmt5/files/patch-gmt6-common_sighandler.diff @@ -0,0 +1,35 @@ +From 458738d52a9068a140155061757c7fa3bc27cc45 Mon Sep 17 00:00:00 2001 +From: Sergey Fedorov +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__