Initial import; Fixes: RHBZ#2217227

This commit is contained in:
Davide Cavalca 2023-08-23 12:39:12 -07:00
parent 391e13dbb1
commit 4a58e4dc1c
4 changed files with 466 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/box64-0.2.2.tar.gz

View File

@ -0,0 +1,56 @@
From 6ff68849f88cbec622fe7a485e301111319ab8d6 Mon Sep 17 00:00:00 2001
From: ptitSeb <sebastien.chev@gmail.com>
Date: Sun, 26 Mar 2023 10:13:45 +0200
Subject: [PATCH] |CMAKE] Added NO_LIB_INSTALL to not install x86_64 libs (they
will probably need to be installed by some other mean)
---
CMakeLists.txt | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4b131d097..433c29ed8 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -75,6 +75,7 @@ option(PAGE8K "Set to ON if host device have PageSize of 8K (instead of 4K)" ${P
option(PAGE16K "Set to ON if host device have PageSize of 16K (instead of 4K)" ${PAGE16K})
option(PAGE64K "Set to ON if host device have PageSize of 64K (instead of 4K)" ${PAGE64K})
option(STATICBUILD "Set to ON to have a static build (Warning, not working)" ${STATICBUILD})
+option(NO_LIB_INSTALL "Set ON to not install a few x86_64 libs that are used by many program" ${NO_LIB_INSTALL})
if(${CMAKE_VERSION} VERSION_LESS "3.12.2")
find_package(PythonInterp 3)
@@ -716,6 +717,7 @@ endif()
string(COMPARE EQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}" "i686" _x86)
string(COMPARE EQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}" "x86_64" _x86_64)
string(COMPARE EQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}" "aarch64" _aarch64)
+string(COMPARE EQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}" "riscv64" _riscv64)
if(_x86_64 OR _aarch64)
add_definitions(-DCONFIG_64BIT)
@@ -726,10 +728,12 @@ if(NOT _x86 AND NOT _x86_64)
RUNTIME DESTINATION bin)
configure_file(system/box64.conf.cmake system/box64.conf)
install(FILES ${CMAKE_BINARY_DIR}/system/box64.conf DESTINATION /etc/binfmt.d/)
- install(FILES ${CMAKE_SOURCE_DIR}/x64lib/libstdc++.so.5 DESTINATION /usr/lib/x86_64-linux-gnu/)
- install(FILES ${CMAKE_SOURCE_DIR}/x64lib/libstdc++.so.6 DESTINATION /usr/lib/x86_64-linux-gnu/)
- install(FILES ${CMAKE_SOURCE_DIR}/x64lib/libgcc_s.so.1 DESTINATION /usr/lib/x86_64-linux-gnu/)
- install(FILES ${CMAKE_SOURCE_DIR}/x64lib/libpng12.so.0 DESTINATION /usr/lib/x86_64-linux-gnu/)
+ if(NOT NO_LIB_INSTALL)
+ install(FILES ${CMAKE_SOURCE_DIR}/x64lib/libstdc++.so.5 DESTINATION /usr/lib/x86_64-linux-gnu/)
+ install(FILES ${CMAKE_SOURCE_DIR}/x64lib/libstdc++.so.6 DESTINATION /usr/lib/x86_64-linux-gnu/)
+ install(FILES ${CMAKE_SOURCE_DIR}/x64lib/libgcc_s.so.1 DESTINATION /usr/lib/x86_64-linux-gnu/)
+ install(FILES ${CMAKE_SOURCE_DIR}/x64lib/libpng12.so.0 DESTINATION /usr/lib/x86_64-linux-gnu/)
+ endif()
install(FILES ${CMAKE_SOURCE_DIR}/system/box64.box64rc DESTINATION /etc/)
endif()
@@ -764,6 +768,8 @@ set(CPACK_PACKAGE_VERSION_PATCH ${BOX64_REVISION})
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/postinst")
if(_aarch64)
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "arm64")
+elseif(__riscv64)
+ set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "riscv64")
elseif(_x86_64)
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "x86_64")
else()

408
box64.spec Normal file
View File

@ -0,0 +1,408 @@
# 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
# box64 only supports these architectures
ExclusiveArch: aarch64 ppc64le x86_64
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 lx2160a
Summary: %{summary}
Requires: %{name}-data = %{version}-%{release}
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
%description lx2160a %{common_description}
This package contains a version of box64 targeting NXP LX2160A systems.
%package odroidn2
Summary: %{summary}
Requires: %{name}-data = %{version}-%{release}
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
%description odroidn2 %{common_description}
This package contains a version of box64 targeting ODROID-N2/N2+ systems.
%package rk3399
Summary: %{summary}
Requires: %{name}-data = %{version}-%{release}
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
%description rk3399 %{common_description}
This package contains a version of box64 targeting Rockchip RK3399 systems.
%package rk3588
Summary: %{summary}
Requires: %{name}-data = %{version}-%{release}
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
%description rk3588 %{common_description}
This package contains a version of box64 targeting Rockchip RK3588 / RK3588S
systems.
%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.
%package sd845
Summary: %{summary}
Requires: %{name}-data = %{version}-%{release}
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
%description sd845 %{common_description}
This package contains a version of box64 targeting Qualcomm Snapdragon 845
systems.
%package tegrax1
Summary: %{summary}
Requires: %{name}-data = %{version}-%{release}
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
%description tegrax1 %{common_description}
This package contains a version of box64 targeting Nvidia Tegra X1 systems.
%endif
%prep
%autosetup -p1
# Remove prebuilt 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}
# NXP LX2160A
%cmake %{common_flags} -DLX2160A=ON
%cmake_build
cp -p %{__cmake_builddir}/%{name} %{name}.lx2160a
rm -r %{__cmake_builddir}
# ODROID-N2/N2+
%cmake %{common_flags} -DODROIDN2=ON
%cmake_build
cp -p %{__cmake_builddir}/%{name} %{name}.odroidn2
rm -r %{__cmake_builddir}
# Rockchip RK3399
%cmake %{common_flags} -DRK3399=ON
%cmake_build
cp -p %{__cmake_builddir}/%{name} %{name}.rk3399
rm -r %{__cmake_builddir}
# Rockchip RK3588/RK3588S
%cmake %{common_flags} -DRK3588=ON
%cmake_build
cp -p %{__cmake_builddir}/%{name} %{name}.rk3588
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}
# Qualcomm Snapdragon 845
%cmake %{common_flags} -DSD845=ON
%cmake_build
cp -p %{__cmake_builddir}/%{name} %{name}.sd845
rm -r %{__cmake_builddir}
# Nvidia Tegra X1
%cmake %{common_flags} -DTEGRAX1=ON
%cmake_build
cp -p %{__cmake_builddir}/%{name} %{name}.tegrax1
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}
install -Ddpm0755 %{buildroot}%{_binfmtdir}
sed 's:${CMAKE_INSTALL_PREFIX}/bin/${BOX64}:%{_bindir}/%{name}:' \
< system/box64.conf.cmake > system/box64.conf
install -Dpm0644 -t %{buildroot}%{_binfmtdir} system/box64.conf
install -Dpm0644 -t %{buildroot}%{_sysconfdir} system/box64.box64rc
%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}.lx2160a \
%{name}.odroidn2 \
%{name}.rk3399 \
%{name}.rk3588 \
%{name}.rpi3 \
%{name}.rpi4 \
%{name}.sd845 \
%{name}.tegrax1
%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 lx2160a
%{_sbindir}/update-alternatives --install %{_bindir}/%{name} \
%{name} %{_bindir}/%{name}.lx2160a 10
%postun lx2160a
if [ $1 -eq 0 ] ; then
%{_sbindir}/update-alternatives --remove %{name} %{_bindir}/%{name}.lx2160a
fi
%post odroidn2
%{_sbindir}/update-alternatives --install %{_bindir}/%{name} \
%{name} %{_bindir}/%{name}.odroidn2 10
%postun odroidn2
if [ $1 -eq 0 ] ; then
%{_sbindir}/update-alternatives --remove %{name} %{_bindir}/%{name}.odroidn2
fi
%post rk3399
%{_sbindir}/update-alternatives --install %{_bindir}/%{name} \
%{name} %{_bindir}/%{name}.rk3399 10
%postun rk3399
if [ $1 -eq 0 ] ; then
%{_sbindir}/update-alternatives --remove %{name} %{_bindir}/%{name}.rk3399
fi
%post rk3588
%{_sbindir}/update-alternatives --install %{_bindir}/%{name} \
%{name} %{_bindir}/%{name}.rk3588 10
%postun rk3588
if [ $1 -eq 0 ] ; then
%{_sbindir}/update-alternatives --remove %{name} %{_bindir}/%{name}.rk3588
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
%post sd845
%{_sbindir}/update-alternatives --install %{_bindir}/%{name} \
%{name} %{_bindir}/%{name}.sd845 10
%postun sd845
if [ $1 -eq 0 ] ; then
%{_sbindir}/update-alternatives --remove %{name} %{_bindir}/%{name}.sd845
fi
%post tegrax1
%{_sbindir}/update-alternatives --install %{_bindir}/%{name} \
%{name} %{_bindir}/%{name}.tegrax1 10
%postun tegrax1
if [ $1 -eq 0 ] ; then
%{_sbindir}/update-alternatives --remove %{name} %{_bindir}/%{name}.tegrax1
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 lx2160a
%ghost %{_bindir}/%{name}
%{_bindir}/%{name}.lx2160a
%files odroidn2
%ghost %{_bindir}/%{name}
%{_bindir}/%{name}.odroidn2
%files rk3399
%ghost %{_bindir}/%{name}
%{_bindir}/%{name}.rk3399
%files rk3588
%ghost %{_bindir}/%{name}
%{_bindir}/%{name}.rk3588
%files rpi3
%ghost %{_bindir}/%{name}
%{_bindir}/%{name}.rpi3
%files rpi4
%ghost %{_bindir}/%{name}
%{_bindir}/%{name}.rpi4
%files sd845
%ghost %{_bindir}/%{name}
%{_bindir}/%{name}.sd845
%files tegrax1
%ghost %{_bindir}/%{name}
%{_bindir}/%{name}.tegrax1
%endif
%files data
%license LICENSE
%doc docs/*.md docs/img
%{_binfmtdir}/box64.conf
%config(noreplace) %{_sysconfdir}/box64.box64rc
%changelog
%autochangelog

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (box64-0.2.2.tar.gz) = 3213e112aad44118209733960523d459bf74a07b7a1cc1b1b86d5938af2052fc298c8d2b28237cd7186751bdfcf791741a82fdf461c02b58f7e98461b794ef95