git: 75a1d429216a - main - editors/lapce: Fix aarch64 build

From: Nuno Teixeira <eduardo_at_FreeBSD.org>
Date: Sun, 15 Jan 2023 13:44:19 UTC
The branch main has been updated by eduardo:

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

commit 75a1d429216aa977d1bf6b1f4a9c5eb4eb474ac8
Author:     Nuno Teixeira <eduardo@FreeBSD.org>
AuthorDate: 2023-01-15 13:40:21 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2023-01-15 13:40:21 +0000

    editors/lapce: Fix aarch64 build
    
    - Fix aarch64 build: wasmtime-runtime-1.0.2 crate
      See: https://github.com/bytecodealliance/wasmtime/issues/5499
    
    PR:             268929
    Tested by:      Robert Clausecker <fuz@fuz.su>
---
 editors/lapce/Makefile                                    |  2 +-
 ...crates_wasmtime-runtime-1.0.2_src_traphandlers_unix.rs | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/editors/lapce/Makefile b/editors/lapce/Makefile
index 054ab47e1960..8130c654882f 100644
--- a/editors/lapce/Makefile
+++ b/editors/lapce/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	lapce
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.2.5	# remove openssl-src-* from CARGO-CRATES each update
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	editors
 
 MAINTAINER=	eduardo@FreeBSD.org
diff --git a/editors/lapce/files/patch-cargo-crates_wasmtime-runtime-1.0.2_src_traphandlers_unix.rs b/editors/lapce/files/patch-cargo-crates_wasmtime-runtime-1.0.2_src_traphandlers_unix.rs
new file mode 100644
index 000000000000..6061e8861b3d
--- /dev/null
+++ b/editors/lapce/files/patch-cargo-crates_wasmtime-runtime-1.0.2_src_traphandlers_unix.rs
@@ -0,0 +1,15 @@
+--- cargo-crates/wasmtime-runtime-1.0.2/src/traphandlers/unix.rs.orig	2023-01-13 13:01:32 UTC
++++ cargo-crates/wasmtime-runtime-1.0.2/src/traphandlers/unix.rs
+@@ -228,6 +228,12 @@ unsafe fn get_pc_and_fp(cx: *mut libc::c_void, _signum
+                 cx.uc_mcontext.mc_rip as *const u8,
+                 cx.uc_mcontext.mc_rbp as usize,
+             )
++        } else if #[cfg(all(target_os = "freebsd", target_arch = "aarch64"))] {
++            let cx = &*(cx as *const libc::mcontext_t);
++            (
++                cx.mc_gpregs.gp_elr as *const u8,
++                cx.mc_gpregs.gp_x[29] as usize,
++            )
+         } else {
+             compile_error!("unsupported platform");
+         }