## START: Set by rpmautospec ## (rpmautospec version 0.7.3) ## RPMAUTOSPEC: autorelease, autochangelog %define autorelease(e:s:pb:n) %{?-p:0.}%{lua: release_number = 1; base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); print(release_number + base_release_number - 1); }%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} ## END: Set by rpmautospec #global date 20240816 #global commit 226f5e2f235909170a5e2214a4e8ce0402af61b9 %{?commit:%global shortcommit %(c=%{commit}; echo ${c:0:7})} %global srcname FEX %global forgeurl https://github.com/FEX-Emu/FEX # FEX upstream only supports building with clang %global toolchain clang # We do not want to run integration tests in Fedora %bcond integration 0 %if %{with integration} %bcond check 1 %else # Tests don't work for now %bcond check 0 %endif %ifarch %{x86_64} %bcond thunks 0 %elif 0%{?fedora} >= 41 %global has_sysroot 1 %bcond thunks 1 %else %bcond thunks 0 %endif # FEX does not support x86_64 hosts in production, only enable this when # testing local builds for development %bcond x86_debug 0 Name: fex-emu Version: 2505%{?commit:^%{date}git%{commit}} Release: %autorelease Summary: Fast usermode x86 and x86-64 emulator for ARM64 # FEX itself is MIT, see below for the bundled libraries %global fex_license MIT AND Apache-2.0 AND BSD-3-Clause AND GPL-2.0-only License: %{fex_license} URL: https://fex-emu.com %if %{defined commit} Source0: %{forgeurl}/commit/%{commit}/%{srcname}-%{commit}.tar.gz %else Source0: %{forgeurl}/archive/%{srcname}-%{version}/%{srcname}-%{srcname}-%{version}.tar.gz %endif Source1: README.fedora # The sysroot is built using build-fex-sysroot.sh, which downloads Fedora RPMs # for x86_64, repacks them into the sysroot tarball, and extracts licensing # information into fex-sysroot-macros.inc, which is then included here and used # to populate the SourceLicense tag. %if 0%{?has_sysroot} Source2: fex-sysroot-macros.inc %include %SOURCE2 Source3: fex-sysroot-%{sysroot_version}.tar.gz Source4: toolchain_x86_32.cmake Source5: toolchain_x86_64.cmake Source6: build-fex-sysroot.sh SourceLicense: %{fex_license} %{sysroot_license} %endif # Bundled dependencies managed as git submodules upstream # These are too entangled with the build system to unbundle for now # https://github.com/FEX-Emu/FEX/issues/2996 # https://github.com/FEX-Emu/FEX/issues/4267 %{lua: local externals = { { name="cpp-optparse", ref="9f94388", owner="Sonicadvance1", path="../Source/Common/cpp-optparse", license="MIT" }, { name="drm-headers", ref="0675d2f", owner="FEX-Emu", package="kernel", version="6.13", license="GPL-2.0-only" }, { name="jemalloc", ref="02ca52b", owner="FEX-Emu", version="5.3.0", license="MIT" }, { name="jemalloc", ref="4043539", owner="FEX-Emu", path="jemalloc_glibc", version="5.3.0", license="MIT" }, { name="robin-map", ref="d5683d9", owner="FEX-Emu", version="1.3.0", license="MIT" }, { name="Vulkan-Headers", ref="cacef30", owner="KhronosGroup", package="vulkan-headers", version="1.4.310", license="Apache-2.0" }, } for i, s in ipairs(externals) do si = 100 + i print(string.format("Source%d: https://github.com/%s/%s/archive/%s/%s-%s.tar.gz", si, s.owner, s.name, s.ref, s.name, s.ref).."\n") if s.bcond and not rpm.isdefined(string.format("with_%s", s.bcond)) then goto continue1 end print(string.format("Provides: bundled(%s) = %s", (s.package or s.name), (s.version or "0")).."\n") ::continue1:: end function print_setup_externals() for i, s in ipairs(externals) do si = 100 + i if s.bcond and not rpm.isdefined(string.format("with_%s", s.bcond)) then goto continue2 end print(string.format("mkdir -p External/%s", (s.path or s.name)).."\n") print(string.format("tar -xzf %s --strip-components=1 -C External/%s", rpm.expand("%{SOURCE"..si.."}"), (s.path or s.name)).."\n") ::continue2:: end end } # LinuxEmulation: Implement custom longjump that is fortification safe Patch: %{forgeurl}/commit/a37def2c22e528477f64296747228400ddc40222.patch # Async: Add run_one interface to enable more fine-grained event loop control Patch: %{forgeurl}/commit/8eaf45414c05c9e7ef6f74a323d95fe7e0d883c1.patch # FEXServer: Don't time out while clients are still connected Patch: %{forgeurl}/commit/c326e2d669fd5e9356f6107e188413a449cc1fd7.patch # FEX upstream only supports these architectures %if %{with x86_debug} ExclusiveArch: %{arm64} %{x86_64} %else ExclusiveArch: %{arm64} %endif BuildRequires: cmake BuildRequires: clang BuildRequires: git-core BuildRequires: lld BuildRequires: llvm BuildRequires: ninja-build BuildRequires: python3 %ifarch %{arm64} BuildRequires: python3-setuptools %endif BuildRequires: sed BuildRequires: systemd-rpm-macros %if %{with check} BuildRequires: nasm BuildRequires: python3-clang %endif BuildRequires: catch2-devel BuildRequires: fmt-devel BuildRequires: libepoxy-devel BuildRequires: SDL2-devel BuildRequires: xxhash-devel %ifarch %{x86_64} BuildRequires: xbyak-devel %endif %if %{with thunks} BuildRequires: alsa-lib-devel BuildRequires: clang-devel BuildRequires: libdrm-devel BuildRequires: libglvnd-devel BuildRequires: libX11-devel BuildRequires: libXrandr-devel BuildRequires: llvm-devel BuildRequires: openssl-devel BuildRequires: wayland-devel BuildRequires: zlib-devel %endif BuildRequires: cmake(Qt6Qml) BuildRequires: cmake(Qt6Quick) BuildRequires: cmake(Qt6Widgets) Requires: systemd-udev Requires: %{name}-filesystem = %{version}-%{release} %if %{with thunks} Recommends: %{name}-thunks = %{version}-%{release} %endif Recommends: fex-emu-rootfs-fedora Recommends: erofs-fuse Recommends: erofs-utils Recommends: squashfs-tools Recommends: squashfuse # Drop once f42 is retired Obsoletes: fex-emu-gdb < 2409-4 Provides: fex-emu-gdb = %{version}-%{release} # Do not check guest thunks for requires, since these are x86-64 binaries that link against libs in the FEX RootFS. %global __requires_exclude_from ^%{_datadir}/fex-emu/GuestThunks.*$ # Do not check guest and host thunks for provides, since these are not general system libraries on the host. %global __provides_exclude_from ^(%{_datadir}/fex-emu/GuestThunks.*|%{_libdir}/fex-emu/HostThunks.*)$ %description FEX allows you to run x86 and x86-64 binaries on an AArch64 host, similar to qemu-user and box86. It has native support for a rootfs overlay, so you don't need to chroot, as well as some thunklibs so it can forward things like GL to the host. FEX presents a Linux 5.0+ interface to the guest, and supports only AArch64 as a host. FEX is very much work in progress, so expect things to change. %package filesystem Summary: FEX rootfs and overlay filesystem BuildArch: noarch %description filesystem %{summary}. %package devel Summary: Development headers and libraries for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} %description devel This package provides development headers and libraries for %{name}. %package utils Summary: Utility tools for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} %description utils This package provides utility tools for %{name} for advanced users. %if %{with thunks} %package thunks Summary: Thunk libraries for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} %description thunks This package provides host library thunks for %{name}. %endif %prep %if %{defined commit} %setup -q -n %{srcname}-%{commit} %else %setup -q -n %{srcname}-%{srcname}-%{version} %endif # Copy in our README.fedora cp -p %SOURCE1 . # Unpack bundled libraries %{lua: print_setup_externals()} # This is done after so we can patch the bundled libraries if needed %autopatch -p1 # Ensure library soversion is set sed -i FEXCore/Source/CMakeLists.txt \ -e '/PROPERTIES OUTPUT_NAME/aset_target_properties(${Name} PROPERTIES VERSION %{version})' # Set up sysroot and toolchain files %if 0%{?has_sysroot} # Unpack and prepare sysroot tar xzf %SOURCE3 cp -p %SOURCE4 %SOURCE5 . CPPINC="/$(cd sysroot; ls -d usr/include/c++/*)" sed -i "s,%%CPPINC%%,$CPPINC,g" toolchain_*.cmake %endif %build %cmake -G Ninja \ -DENABLE_OFFLINE_TELEMETRY=OFF \ %ifarch %{x86_64} -DENABLE_X86_HOST_DEBUG=ON \ %endif %if %{with thunks} -DBUILD_THUNKS=ON \ -DENABLE_CLANG_THUNKS=ON \ %endif %if %{with check} -DBUILD_TESTS=ON \ %else -DBUILD_TESTS=OFF \ %endif %if %{with integration} -DBUILD_FEX_LINUX_TESTS=ON \ %else -DBUILD_FEX_LINUX_TESTS=OFF \ %endif %if 0%{?has_sysroot} -DX86_DEV_ROOTFS=$PWD/sysroot \ -DX86_32_TOOLCHAIN_FILE=$PWD/toolchain_x86_32.cmake \ -DX86_64_TOOLCHAIN_FILE=$PWD/toolchain_x86_64.cmake \ %endif %{nil} %cmake_build %install %cmake_install # These are used to store RootFS and overlays for FEX that will be provided # by other packages install -Ddpm0755 %{buildroot}%{_datadir}/fex-emu/RootFS/ install -Ddpm0755 %{buildroot}%{_datadir}/fex-emu/overlays/ %if %{with thunks} # This is for running tests only (and gets installed into the wrong libdir) rm %{buildroot}/usr/lib/libfex_thunk_test.so %else # Not useful without thunks rm %{buildroot}%{_datadir}/fex-emu/ThunksDB.json %endif %postun if [ $1 -eq 0 ]; then /bin/systemctl try-restart systemd-binfmt.service fi %if %{with check} %check %ctest %endif %files %license LICENSE %doc Readme.md README.fedora docs %{_bindir}/FEXBash %{_bindir}/FEXGetConfig %{_bindir}/FEXInterpreter %{_bindir}/FEXLoader %{_bindir}/FEXpidof %{_bindir}/FEXServer %{_libdir}/libFEXCore.so.%{version} %ifnarch %{x86_64} %{_binfmtdir}/FEX-x86.conf %{_binfmtdir}/FEX-x86_64.conf %endif %{_datadir}/fex-emu/AppConfig/ %{_mandir}/man1/FEX.1* %files filesystem %dir %{_datadir}/fex-emu/ %dir %{_datadir}/fex-emu/RootFS %dir %{_datadir}/fex-emu/overlays %files devel %{_includedir}/FEXCore/ %{_libdir}/libFEXCore.so %files utils %{_bindir}/FEXConfig %{_bindir}/FEXRootFSFetcher %if %{with thunks} %files thunks %{_libdir}/fex-emu/HostThunks/ %{_libdir}/fex-emu/HostThunks_32/ %{_datadir}/fex-emu/ThunksDB.json %{_datadir}/fex-emu/GuestThunks/ %{_datadir}/fex-emu/GuestThunks_32/ %endif %changelog ## START: Generated by rpmautospec * Sat May 10 2025 Davide Cavalca - 2505-1 - Update to 2505; Fixes: RHBZ#2350194 * Wed Apr 16 2025 Davide Cavalca - 2504-1 - Update to 2504; Fixes: RHBZ#2350194 * Wed Apr 16 2025 Davide Cavalca - 2503-1 - Update to 2503; Fixes: RHBZ#2350194 * Wed Apr 16 2025 Davide Cavalca - 2502-4 - Various fixes for build-fex-sysroot.sh - Use /etc/os-release instead of lsb_release - Shellcheck fixes - More robust args handling * Sun Mar 16 2025 Davide Cavalca - 2502-3 - Backport upstream patch for LLVM 20 support; Fixes: RHBZ#2351394 * Sat Mar 15 2025 Davide Cavalca - 2502-2 - Use more system libraries instead of the bundled ones * Sun Feb 23 2025 Davide Cavalca - 2502-1 - Update to 2502; Fixes: RHBZ#2344448 * Sun Jan 19 2025 Davide Cavalca - 2501-1 - Update to 2501; Fixes: RHBZ#2336247 * Thu Jan 16 2025 Fedora Release Engineering - 2412-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild * Tue Dec 24 2024 Asahi Lina - 2412-3 - Add provides/requires excludes for thunk libs * Sun Dec 22 2024 Asahi Lina - 2412-2 - Add missing thunks conditionals & fix typo * Sun Dec 22 2024 Asahi Lina - 2412-1 - Update to 2412; Fixes: RHBZ#2330211 * Wed Nov 13 2024 Asahi Lina - 2410-2 - Add fixes for Steam update breakage * Wed Oct 16 2024 Davide Cavalca - 2410-1 - Update to 2410; Fixes: RHBZ#2317071 * Tue Oct 08 2024 Sergio Lopez - 2409-8 - Backport upstream compat input commit * Sat Oct 05 2024 Janne Grunau - 2409-7 - Add filesystem subpackage for rootfs and overlays * Fri Oct 04 2024 Davide Cavalca - 2409-6 - Backport upstream bugfix commit * Thu Oct 03 2024 Davide Cavalca - 2409-5 - Add recommends for the Fedora rootfs * Wed Oct 02 2024 Davide Cavalca - 2409-4 - Drop gdb subpackage, not meant for end users * Tue Oct 01 2024 Davide Cavalca - 2409-3 - Own directories for RootFS and overlays * Tue Sep 17 2024 Davide Cavalca - 2409-2 - Disable telemetry * Thu Sep 05 2024 Davide Cavalca - 2409-1 - Update to 2409 * Tue Aug 27 2024 Davide Cavalca - 2408-1 - Initial import; Fixes: RHBZ#2305342 ## END: Generated by rpmautospec