commit 6ed9ae3f794bccdadf8c1228b1af26c805a4548e
Author: Jan Palus <[email protected]>
Date:   Sat Nov 6 22:36:55 2021 +0100

    new

 box64.spec      | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++
 glibc2.34.patch | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 121 insertions(+)
---
diff --git a/box64.spec b/box64.spec
new file mode 100644
index 0000000..bc3bd6f
--- /dev/null
+++ b/box64.spec
@@ -0,0 +1,57 @@
+# Conditional build:
+%bcond_with    rk3326          # target Rockchip RK3326 device
+%bcond_with    rk3399          # target Rockchip RK3399 device
+%bcond_with    rpi4            # target Raspberry Pi 4
+%bcond_with    tegrax1         # target Tegra X1
+
+Summary:       Linux Userspace x86_64 Emulator
+Name:          box64
+Version:       0.1.4
+Release:       1
+License:       MIT
+Group:         Applications
+Source0:       
https://github.com/ptitSeb/box64/archive/v%{version}/%{name}-%{version}.tar.gz
+# Source0-md5: 64d026a02f8e48b802cb321d430684e9
+Patch0:                glibc2.34.patch
+URL:           https://box86.org
+BuildRequires: cmake >= 3.4
+BuildRequires: python3
+BuildRequires: rpmbuild(macros) >= 1.605
+ExclusiveArch: aarch64
+BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%define                _noautostrip    .*x86_64.*
+
+%description
+Box64 lets you run x86_64 Linux programs (such as games) on non-x86_64
+Linux systems, like ARM (host system needs to be 64bit little-endian).
+
+%prep
+%setup -q
+%patch0 -p1
+
+%build
+%cmake -B build \
+       %{?with_rk3326:-DRK3326=ON} \
+       %{?with_rk3399:-DRK3399=ON} \
+       %{?with_rpi4:-DRPI4ARM64=ON} \
+       %{?with_tegrax1:-DTEGRAX1=ON}
+%{__make} -C build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%{__make} -C build install \
+       DESTDIR=$RPM_BUILD_ROOT
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc docs/{CHANGELOG.md,README.md,USAGE.md}
+%{_sysconfdir}/binfmt.d/box64.conf
+%attr(755,root,root) %{_bindir}/box64
+%dir /usr/lib/x86_64-linux-gnu
+%attr(755,root,root) /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
+%attr(755,root,root) /usr/lib/x86_64-linux-gnu/libstdc++.so.6
diff --git a/glibc2.34.patch b/glibc2.34.patch
new file mode 100644
index 0000000..dfd0c3e
--- /dev/null
+++ b/glibc2.34.patch
@@ -0,0 +1,64 @@
+From b1d0dde0b428f5d08a821405e1c04fffe5e38c82 Mon Sep 17 00:00:00 2001
+From: ptitSeb <[email protected]>
+Date: Wed, 20 Oct 2021 22:54:42 +0200
+Subject: [PATCH] Proper fix for link issue on glibc 2.34+ (for #120)
+
+---
+ src/libtools/threads.c | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/src/libtools/threads.c b/src/libtools/threads.c
+index 3105211..8f94692 100755
+--- a/src/libtools/threads.c
++++ b/src/libtools/threads.c
+@@ -8,6 +8,7 @@
+ #include <errno.h>
+ #include <setjmp.h>
+ #include <sys/mman.h>
++#include <dlfcn.h>
+ 
+ #include "debug.h"
+ #include "box64context.h"
+@@ -28,8 +29,12 @@
+ #include "dynablock.h"
+ #endif
+ 
+-void _pthread_cleanup_push_defer(void* buffer, void* routine, void* arg);     
// declare hidden functions
+-void _pthread_cleanup_pop_restore(void* buffer, int exec);
++//void _pthread_cleanup_push_defer(void* buffer, void* routine, void* arg);   
// declare hidden functions
++//void _pthread_cleanup_pop_restore(void* buffer, int exec);
++typedef void (*vFppp_t)(void*, void*, void*);
++typedef void (*vFpi_t)(void*, int);
++static vFppp_t real_pthread_cleanup_push_defer = NULL;
++static vFpi_t real_pthread_cleanup_pop_restore = NULL;
+ void _pthread_cleanup_push(void* buffer, void* routine, void* arg);   // 
declare hidden functions
+ void _pthread_cleanup_pop(void* buffer, int exec);
+ 
+@@ -668,7 +673,7 @@ EXPORT int my_pthread_cond_wait(x64emu_t* emu, 
pthread_cond_t* cond, void* mutex
+ EXPORT void my__pthread_cleanup_push_defer(x64emu_t* emu, void* buffer, void* 
routine, void* arg)
+ {
+     (void)emu;
+-      _pthread_cleanup_push_defer(buffer, findcleanup_routineFct(routine), 
arg);
++      real_pthread_cleanup_push_defer(buffer, 
findcleanup_routineFct(routine), arg);
+ }
+ 
+ EXPORT void my__pthread_cleanup_push(x64emu_t* emu, void* buffer, void* 
routine, void* arg)
+@@ -680,7 +685,7 @@ EXPORT void my__pthread_cleanup_push(x64emu_t* emu, void* 
buffer, void* routine,
+ EXPORT void my__pthread_cleanup_pop_restore(x64emu_t* emu, void* buffer, int 
exec)
+ {
+     (void)emu;
+-      _pthread_cleanup_pop_restore(buffer, exec);
++      real_pthread_cleanup_pop_restore(buffer, exec);
+ }
+ 
+ EXPORT void my__pthread_cleanup_pop(x64emu_t* emu, void* buffer, int exec)
+@@ -1135,6 +1140,9 @@ emu_jmpbuf_t* GetJmpBuf()
+ 
+ void init_pthread_helper()
+ {
++      real_pthread_cleanup_push_defer = (vFppp_t)dlsym(NULL, 
"_pthread_cleanup_push_defer");
++      real_pthread_cleanup_pop_restore = (vFpi_t)dlsym(NULL, 
"_pthread_cleanup_pop_restore");
++
+       InitCancelThread();
+       pthread_key_create(&jmpbuf_key, emujmpbuf_destroy);
+ }
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/box64.git/commitdiff/6ed9ae3f794bccdadf8c1228b1af26c805a4548e

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to