# Tests are disabled as they require x86_64 libraries to run %bcond_with tests %global forgeurl https://github.com/ptitSeb/box64 %global common_description %{expand: Box64 lets you run x86_64 Linux programs (such as games) on non-x86_64 Linux systems, like ARM (host system needs to be 64-bit little-endian).} Name: box64 Version: 0.2.2 Release: %autorelease Summary: Linux userspace x86_64 emulator with a twist, targeted at ARM64 License: MIT URL: https://box86.org Source: %{forgeurl}/archive/v%{version}/%{name}-%{version}.tar.gz # cmake: Added NO_LIB_INSTALL to not install x86_64 libs Patch: %{forgeurl}/commit/6ff68849f88cbec622fe7a485e301111319ab8d6.patch BuildRequires: cmake BuildRequires: gcc BuildRequires: make BuildRequires: systemd-rpm-macros ExcludeArch: %{ix86} s390x Requires: %{name}-data = %{version}-%{release} %ifarch aarch64 Requires(post): %{_sbindir}/update-alternatives Requires(postun): %{_sbindir}/update-alternatives %endif %description %{common_description} %package data Summary: Common files for %{name} BuildArch: noarch %description data %{common_description} %ifarch aarch64 %package asahi Summary: Apple Silicon version of box64 Requires: %{name}-data = %{version}-%{release} Requires(post): %{_sbindir}/update-alternatives Requires(postun): %{_sbindir}/update-alternatives %description asahi %{common_description} This package contains a version of box64 targeting Apple Silicon systems using a 16k page size. %package rpi3 Summary: %{summary} Requires: %{name}-data = %{version}-%{release} Requires(post): %{_sbindir}/update-alternatives Requires(postun): %{_sbindir}/update-alternatives %description rpi3 %{common_description} This package contains a version of box64 targeting Raspberry Pi 3 systems. %package rpi4 Summary: %{summary} Requires: %{name}-data = %{version}-%{release} Requires(post): %{_sbindir}/update-alternatives Requires(postun): %{_sbindir}/update-alternatives %description rpi4 %{common_description} This package contains a version of box64 targeting Raspberry Pi 4 systems. %endif %prep %autosetup -p1 # Remove prebuild libraries rm -r x64lib # Fix permissions and encoding chmod -x docs/*.md docs/img/*.png sed -i 's/\r$//' docs/*.md # Fix install paths sed -i 's:/etc/binfmt.d:%{_binfmtdir}:g' CMakeLists.txt %build %global common_flags -DNOGIT=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo %ifarch aarch64 # Apple Silicon %cmake %{common_flags} -DM1=ON %cmake_build cp -p %{__cmake_builddir}/%{name} %{name}.asahi rm -r %{__cmake_builddir} # Raspberry PI 3 %cmake %{common_flags} -DRPI3ARM64=ON %cmake_build cp -p %{__cmake_builddir}/%{name} %{name}.rpi3 rm -r %{__cmake_builddir} # Raspberry PI 3 %cmake %{common_flags} -DRPI4ARM64=ON %cmake_build cp -p %{__cmake_builddir}/%{name} %{name}.rpi4 rm -r %{__cmake_builddir} %endif %cmake %{common_flags} -DNO_LIB_INSTALL=ON \ %ifarch aarch64 -DARM_DYNAREC=ON %endif %ifarch ppc64le -DPPC64LE=ON %endif %ifarch x86_64 -DLD80BITS=ON \ -DNOALIGN=ON %endif %cmake_build %install %ifarch x86_64 # Install manually as cmake_install doesn't seem to work on x86_64 install -Dpm0755 -t %{buildroot}%{_bindir} %{__cmake_builddir}/%{name} %else %cmake_install %endif %ifarch aarch64 mv %{buildroot}%{_bindir}/%{name} %{buildroot}%{_bindir}/%{name}.aarch64 touch %{buildroot}%{_bindir}/%{name} chmod +x %{buildroot}%{_bindir}/%{name} install -Dpm0755 -t %{buildroot}%{_bindir} \ %{name}.asahi \ %{name}.rpi3 \ %{name}.rpi4 %post %{_sbindir}/update-alternatives --install %{_bindir}/%{name} \ %{name} %{_bindir}/%{name}.aarch64 20 %postun if [ $1 -eq 0 ] ; then %{_sbindir}/update-alternatives --remove %{name} %{_bindir}/%{name}.aarch64 fi %post asahi %{_sbindir}/update-alternatives --install %{_bindir}/%{name} \ %{name} %{_bindir}/%{name}.asahi 10 %postun asahi if [ $1 -eq 0 ] ; then %{_sbindir}/update-alternatives --remove %{name} %{_bindir}/%{name}.asahi fi %post rpi3 %{_sbindir}/update-alternatives --install %{_bindir}/%{name} \ %{name} %{_bindir}/%{name}.rpi3 10 %postun rpi3 if [ $1 -eq 0 ] ; then %{_sbindir}/update-alternatives --remove %{name} %{_bindir}/%{name}.rpi3 fi %post rpi4 %{_sbindir}/update-alternatives --install %{_bindir}/%{name} \ %{name} %{_bindir}/%{name}.rpi4 10 %postun rpi4 if [ $1 -eq 0 ] ; then %{_sbindir}/update-alternatives --remove %{name} %{_bindir}/%{name}.rpi4 fi %endif %if %{with tests} %check %ctest %endif %files %ifarch aarch64 %ghost %{_bindir}/%{name} %{_bindir}/%{name}.aarch64 %else %{_bindir}/%{name} %endif %ifarch aarch64 %files asahi %ghost %{_bindir}/%{name} %{_bindir}/%{name}.asahi %files rpi3 %ghost %{_bindir}/%{name} %{_bindir}/%{name}.rpi3 %files rpi4 %ghost %{_bindir}/%{name} %{_bindir}/%{name}.rpi4 %endif %files data %license LICENSE %doc docs/*.md docs/img %ifnarch x86_64 %{_binfmtdir}/box64.conf %config(noreplace) %{_sysconfdir}/box64.box64rc %endif %changelog %autochangelog