Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Apr 2023 10:43:35 GMT
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-branches@FreeBSD.org
Subject:   git: 590d0f796c28 - 2023Q2 - games/veloren-weekly: unbreak build on i386
Message-ID:  <202304191043.33JAhZ1Z029993@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch 2023Q2 has been updated by jbeich:

URL: https://cgit.FreeBSD.org/ports/commit/?id=590d0f796c288877d94c087bd9b1b552b3ab7be0

commit 590d0f796c288877d94c087bd9b1b552b3ab7be0
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2023-04-18 23:40:34 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2023-04-19 10:43:30 +0000

    games/veloren-weekly: unbreak build on i386
    
    (cherry picked from commit 6f656934f1aac9adb640591967820bf67578a9ca)
---
 games/veloren-weekly/Makefile           |   2 +-
 games/veloren-weekly/files/patch-z-i386 | 233 ++++++++++++++++++++++++++++++++
 2 files changed, 234 insertions(+), 1 deletion(-)

diff --git a/games/veloren-weekly/Makefile b/games/veloren-weekly/Makefile
index c27dcdb84e97..68087eb017b9 100644
--- a/games/veloren-weekly/Makefile
+++ b/games/veloren-weekly/Makefile
@@ -13,7 +13,7 @@ WWW=		https://veloren.net/
 LICENSE=	GPLv3
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-ONLY_FOR_ARCHS=	aarch64 amd64
+ONLY_FOR_ARCHS=	aarch64 amd64 i386
 # https://gitlab.com/veloren/veloren/-/issues/1006
 ONLY_FOR_ARCHS_REASON=	unsupported platform by https://github.com/wasmerio/wasmer
 
diff --git a/games/veloren-weekly/files/patch-z-i386 b/games/veloren-weekly/files/patch-z-i386
new file mode 100644
index 000000000000..9d86b1945286
--- /dev/null
+++ b/games/veloren-weekly/files/patch-z-i386
@@ -0,0 +1,233 @@
+https://github.com/rust-lang/libc/pull/3202
+https://github.com/wasmerio/wasmer/pull/3782
+
+error[E0308]: mismatched types
+   --> rtsim/src/gen/mod.rs:30:43
+    |
+30  |         let mut rng = SmallRng::from_seed(seed);
+    |                       ------------------- ^^^^ expected an array with a fixed size of 16 elements, found one with 32 elements
+    |                       |
+    |                       arguments to this function are incorrect
+    |
+note: associated function defined here
+   --> cargo-crates/rand_core-0.6.4/src/lib.rs:319:8
+    |
+319 |     fn from_seed(seed: Self::Seed) -> Self;
+    |        ^^^^^^^^^
+
+--- cargo-crates/libc-0.2.133/src/unix/bsd/freebsdlike/freebsd/x86.rs.orig	1970-01-01 00:00:00 UTC
++++ cargo-crates/libc-0.2.133/src/unix/bsd/freebsdlike/freebsd/x86.rs
+@@ -6,6 +6,41 @@ pub type register_t = i32;
+ pub type suseconds_t = i32;
+ pub type register_t = i32;
+ 
++s_no_extra_traits! {
++    pub struct mcontext_t {
++        pub mc_onstack: register_t,
++        pub mc_gs: register_t,
++        pub mc_fs: register_t,
++        pub mc_es: register_t,
++        pub mc_ds: register_t,
++        pub mc_edi: register_t,
++        pub mc_esi: register_t,
++        pub mc_ebp: register_t,
++        pub mc_isp: register_t,
++        pub mc_ebx: register_t,
++        pub mc_edx: register_t,
++        pub mc_ecx: register_t,
++        pub mc_eax: register_t,
++        pub mc_trapno: register_t,
++        pub mc_err: register_t,
++        pub mc_eip: register_t,
++        pub mc_cs: register_t,
++        pub mc_eflags: register_t,
++        pub mc_esp: register_t,
++        pub mc_ss: register_t,
++        pub mc_len: ::c_int,
++        pub mc_fpformat: ::c_int,
++        pub mc_ownedfp: ::c_int,
++        pub mc_flags: register_t,
++        pub mc_fpstate: [[::c_int; 32]; 4],
++        pub mc_fsbase: register_t,
++        pub mc_gsbase: register_t,
++        pub mc_xfpustate: register_t,
++        pub mc_xfpustate_len: register_t,
++        pub mc_spare2: [::c_int; 4],
++    }
++}
++
+ s! {
+     pub struct stat {
+         pub st_dev: ::dev_t,
+@@ -31,6 +66,15 @@ s! {
+         pub st_birthtime_nsec: ::c_long,
+         __unused: [u8; 8],
+     }
++
++    pub struct ucontext_t {
++        pub uc_sigmask: ::sigset_t,
++        pub uc_mcontext: ::mcontext_t,
++        pub uc_link: *mut ::ucontext_t,
++        pub uc_stack: ::stack_t,
++        pub uc_flags: ::c_int,
++        __spare__: [::c_int; 4],
++    }
+ }
+ 
+ // should be pub(crate), but that requires Rust 1.18.0
+@@ -43,4 +87,115 @@ cfg_if! {
+         pub const _ALIGNBYTES: usize = 4 - 1;
+     }
+ }
++
++cfg_if! {
++    if #[cfg(feature = "extra_traits")] {
++        impl PartialEq for mcontext_t {
++            fn eq(&self, other: &mcontext_t) -> bool {
++                self.mc_onstack == other.mc_onstack &&
++                self.mc_gs == other.mc_gs &&
++                self.mc_fs == other.mc_fs &&
++                self.mc_es == other.mc_es &&
++                self.mc_ds == other.mc_ds &&
++                self.mc_edi == other.mc_edi &&
++                self.mc_esi == other.mc_esi &&
++                self.mc_ebp == other.mc_ebp &&
++                self.mc_isp == other.mc_isp &&
++                self.mc_ebx == other.mc_ebx &&
++                self.mc_edx == other.mc_edx &&
++                self.mc_ecx == other.mc_ecx &&
++                self.mc_eax == other.mc_eax &&
++                self.mc_trapno == other.mc_trapno &&
++                self.mc_err == other.mc_err &&
++                self.mc_eip == other.mc_eip &&
++                self.mc_cs == other.mc_cs &&
++                self.mc_eflags == other.mc_eflags &&
++                self.mc_esp == other.mc_esp &&
++                self.mc_ss == other.mc_ss &&
++                self.mc_len == other.mc_len &&
++                self.mc_fpformat == other.mc_fpformat &&
++                self.mc_ownedfp == other.mc_ownedfp &&
++                self.mc_flags == other.mc_flags &&
++                self.mc_fpstate.iter().zip(other.mc_fpstate.iter()).all(|(a, b)| a == b) &&
++                self.mc_fsbase == other.mc_fsbase &&
++                self.mc_gsbase == other.mc_gsbase &&
++                self.mc_xfpustate == other.mc_xfpustate &&
++                self.mc_xfpustate_len == other.mc_xfpustate_len &&
++                self.mc_spare2.iter().zip(other.mc_spare2.iter()).all(|(a, b)| a == b)
++            }
++        }
++        impl Eq for mcontext_t {}
++        impl ::fmt::Debug for mcontext_t {
++            fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
++                f.debug_struct("mcontext_t")
++                    .field("mc_onstack", &self.mc_onstack)
++                    .field("mc_gs", &self.mc_gs)
++                    .field("mc_fs", &self.mc_fs)
++                    .field("mc_es", &self.mc_es)
++                    .field("mc_ds", &self.mc_ds)
++                    .field("mc_edi", &self.mc_edi)
++                    .field("mc_esi", &self.mc_esi)
++                    .field("mc_ebp", &self.mc_ebp)
++                    .field("mc_isp", &self.mc_isp)
++                    .field("mc_ebx", &self.mc_ebx)
++                    .field("mc_edx", &self.mc_edx)
++                    .field("mc_ecx", &self.mc_ecx)
++                    .field("mc_eax", &self.mc_eax)
++                    .field("mc_trapno", &self.mc_trapno)
++                    .field("mc_err", &self.mc_err)
++                    .field("mc_eip", &self.mc_eip)
++                    .field("mc_cs", &self.mc_cs)
++                    .field("mc_eflags", &self.mc_eflags)
++                    .field("mc_esp", &self.mc_esp)
++                    .field("mc_ss", &self.mc_ss)
++                    .field("mc_len", &self.mc_len)
++                    .field("mc_fpformat", &self.mc_fpformat)
++                    .field("mc_ownedfp", &self.mc_ownedfp)
++                    .field("mc_flags", &self.mc_flags)
++                    .field("mc_fpstate", &self.mc_fpstate)
++                    .field("mc_fsbase", &self.mc_fsbase)
++                    .field("mc_gsbase", &self.mc_gsbase)
++                    .field("mc_xfpustate", &self.mc_xfpustate)
++                    .field("mc_xfpustate_len", &self.mc_xfpustate_len)
++                    .field("mc_spare2", &self.mc_spare2)
++                    .finish()
++            }
++        }
++        impl ::hash::Hash for mcontext_t {
++            fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
++                self.mc_onstack.hash(state);
++                self.mc_gs.hash(state);
++                self.mc_fs.hash(state);
++                self.mc_es.hash(state);
++                self.mc_ds.hash(state);
++                self.mc_edi.hash(state);
++                self.mc_esi.hash(state);
++                self.mc_ebp.hash(state);
++                self.mc_isp.hash(state);
++                self.mc_ebx.hash(state);
++                self.mc_edx.hash(state);
++                self.mc_ecx.hash(state);
++                self.mc_eax.hash(state);
++                self.mc_trapno.hash(state);
++                self.mc_err.hash(state);
++                self.mc_eip.hash(state);
++                self.mc_cs.hash(state);
++                self.mc_eflags.hash(state);
++                self.mc_esp.hash(state);
++                self.mc_ss.hash(state);
++                self.mc_len.hash(state);
++                self.mc_fpformat.hash(state);
++                self.mc_ownedfp.hash(state);
++                self.mc_flags.hash(state);
++                self.mc_fpstate.hash(state);
++                self.mc_fsbase.hash(state);
++                self.mc_gsbase.hash(state);
++                self.mc_xfpustate.hash(state);
++                self.mc_xfpustate_len.hash(state);
++                self.mc_spare2.hash(state);
++            }
++        }
++    }
++}
++
+ pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4
+--- cargo-crates/wasmer-vm-2.3.0/src/trap/traphandlers.rs.orig	1970-01-01 00:00:00 UTC
++++ cargo-crates/wasmer-vm-2.3.0/src/trap/traphandlers.rs
+@@ -271,7 +271,10 @@ cfg_if::cfg_if! {
+                 ))] {
+                     pc = context.uc_mcontext.gregs[libc::REG_EIP as usize] as usize;
+                     sp = context.uc_mcontext.gregs[libc::REG_ESP as usize] as usize;
+-                } else if #[cfg(all(target_os = "freebsd", any(target_arch = "x86", target_arch = "x86_64")))] {
++                } else if #[cfg(all(target_os = "freebsd", target_arch = "x86"))] {
++                    pc = context.uc_mcontext.mc_eip as usize;
++                    sp = context.uc_mcontext.mc_esp as usize;
++                } else if #[cfg(all(target_os = "freebsd", target_arch = "x86_64"))] {
+                     pc = context.uc_mcontext.mc_rip as usize;
+                     sp = context.uc_mcontext.mc_rsp as usize;
+                 } else if #[cfg(all(target_vendor = "apple", target_arch = "x86_64"))] {
+@@ -337,6 +340,13 @@ cfg_if::cfg_if! {
+                     (*context.uc_mcontext).__ss.__rbp = rbp;
+                     (*context.uc_mcontext).__ss.__rdi = rdi;
+                     (*context.uc_mcontext).__ss.__rsi = rsi;
++                } else if #[cfg(all(target_os = "freebsd", target_arch = "x86"))] {
++                    let TrapHandlerRegs { eip, esp, ebp, ecx, edx } = regs;
++                    context.uc_mcontext.mc_eip = eip as libc::register_t;
++                    context.uc_mcontext.mc_esp = esp as libc::register_t;
++                    context.uc_mcontext.mc_ebp = ebp as libc::register_t;
++                    context.uc_mcontext.mc_ecx = ecx as libc::register_t;
++                    context.uc_mcontext.mc_edx = edx as libc::register_t;
+                 } else if #[cfg(all(target_os = "freebsd", target_arch = "x86_64"))] {
+                     let TrapHandlerRegs { rip, rsp, rbp, rdi, rsi } = regs;
+                     context.uc_mcontext.mc_rip = rip as libc::register_t;
+--- rtsim/src/gen/mod.rs.orig	2023-04-14 03:41:36 UTC
++++ rtsim/src/gen/mod.rs
+@@ -23,6 +23,9 @@ impl Data {
+ 
+ impl Data {
+     pub fn generate(settings: &WorldSettings, world: &World, index: IndexRef) -> Self {
++#[cfg(target_pointer_width = "32")]
++        let mut seed = [0; 16];
++#[cfg(not(target_pointer_width = "32"))]
+         let mut seed = [0; 32];
+         seed.iter_mut()
+             .zip(&mut index.seed.to_le_bytes())



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202304191043.33JAhZ1Z029993>