%global gitbranch main # Full 40-char SHA — GitHub honors `git fetch ` only for full hashes # (uploadpack.allowAnySHA1InWant); the CI keeps this in sync with upstream HEAD. %global gitcommit 2fd322ecf78caf66a07d50fa1d022ee82ca69910 %global gitcommit_short %(echo %{gitcommit} | cut -c1-7) # Cemu installs as a single, already-stripped binary; skip the auto -debuginfo. %global debug_package %{nil} Name: cemu Version: 0^g%{gitcommit_short} Release: 1%{?dist} Summary: Wii U emulator License: MPL-2.0 URL: https://github.com/cemu-project/Cemu # Sources are fetched in %%prep via `git clone`; COPR project l4s has # enable_net=true so this works inside mock as well. ExclusiveArch: aarch64 # Toolchain + general build glue BuildRequires: cmake >= 3.20 BuildRequires: ninja-build BuildRequires: clang BuildRequires: llvm BuildRequires: lld BuildRequires: gcc-c++ BuildRequires: git BuildRequires: python3 BuildRequires: perl-core BuildRequires: nasm BuildRequires: pkgconfig BuildRequires: libtool BuildRequires: autoconf BuildRequires: automake BuildRequires: make BuildRequires: patch BuildRequires: zip BuildRequires: unzip BuildRequires: tar BuildRequires: xz BuildRequires: curl BuildRequires: ca-certificates # System libraries Cemu / vcpkg-built deps link against BuildRequires: bluez-libs-devel BuildRequires: cubeb-devel BuildRequires: freeglut-devel BuildRequires: glm-devel BuildRequires: gtk3-devel BuildRequires: kernel-headers BuildRequires: libgcrypt-devel BuildRequires: libsecret-devel BuildRequires: libusb1-devel BuildRequires: systemd-devel BuildRequires: wayland-devel BuildRequires: wayland-protocols-devel BuildRequires: zlib-devel BuildRequires: zlib-static BuildRequires: bzip2-devel # libpng-devel ships a cmake config that references PNG::png_static → # /usr/lib64/libpng16.a; without -static that target is "imported but # missing" and find_package(PNG) aborts when vcpkg's pkg pulls it in. BuildRequires: libpng-static # Window system / graphics BuildRequires: mesa-libGL-devel BuildRequires: mesa-libGLU-devel BuildRequires: libX11-devel BuildRequires: libxcb-devel BuildRequires: libxkbcommon-devel # Audio backends Cubeb may probe BuildRequires: alsa-lib-devel BuildRequires: pulseaudio-libs-devel %description Cemu is a Wii U emulator that runs Wii U games and applications, originally developed for Windows and now also building on Linux and macOS. %prep rm -rf %{name}-%{version} git clone --depth=1 --branch %{gitbranch} %{url} %{name}-%{version} cd %{name}-%{version} git fetch --depth=1 origin %{gitcommit} git checkout %{gitcommit} # Skip submodules we never compile on aarch64 Linux. The .update=none entries # are honored by `git submodule update --init` below. # * metal-cpp: macOS Metal backend git config submodule.dependencies/metal-cpp.update none # Pre-fetch submodules with per-submodule retries. Cemu's vcpkg submodule is # `shallow = false` in .gitmodules, but the in-tree CMakeLists auto-unshallows # vcpkg at configure time if needed, so a depth=1 fetch here is sufficient. # Read paths from .gitmodules directly — `git submodule foreach` only iterates # already-checked-out submodules, which doesn't help us on a fresh clone. git submodule init git submodule sync submodules=$(git config --file .gitmodules --get-regexp 'submodule\..*\.path' | awk '{print $2}') for sm in $submodules; do if [ "$(git config --get "submodule.${sm}.update" 2>/dev/null || true)" = "none" ]; then echo "skip ${sm} (update=none)" continue fi ok= for attempt in 1 2 3 4 5 6 7 8; do rm -rf -- "${sm}" ".git/modules/${sm}" git submodule init -- "${sm}" >/dev/null if git submodule update --depth=1 -- "${sm}"; then ok=1 break fi echo "${sm}: attempt ${attempt} failed, retrying in $((attempt * 5))s..." >&2 sleep $((attempt * 5)) done if [ -z "$ok" ]; then echo "submodule ${sm}: exhausted retries" >&2 exit 1 fi done # Some top-level submodules (e.g. dependencies/cubeb) have their own nested # submodules (sanitizers-cmake). Recurse one extra level — by now all the # top-level ones are populated and only the nested ones are missing, so this # does very little work in practice but plugs the find_package() holes that # cmake hits otherwise. for attempt in 1 2 3 4 5; do if git submodule update --init --recursive --depth=1; then break fi echo "nested submodule fetch attempt ${attempt} failed, retrying in $((attempt * 5))s..." >&2 sleep $((attempt * 5)) done %build cd %{name}-%{version} export CC=clang export CXX=clang++ # Reset distro hardening flags — vcpkg builds many vendored libraries that # trip over -fstack-protector-strong / -D_FORTIFY_SOURCE. export CFLAGS= export CXXFLAGS= export LDFLAGS= # vcpkg downloads/builds many dependencies during cmake configure; let it use # the build chroot's tmp. The directory must exist beforehand or vcpkg's # bootstrap aborts with "not a directory". export VCPKG_DOWNLOADS=%{_builddir}/vcpkg-downloads mkdir -p "$VCPKG_DOWNLOADS" # On aarch64 vcpkg doesn't always ship a prebuilt cmake/ninja and its bootstrap # can't reliably download them in a sandboxed mock chroot — use the system tools. export VCPKG_FORCE_SYSTEM_BINARIES=1 cmake -S . -B build -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_COMPILER=clang \ -DCMAKE_CXX_COMPILER=clang++ \ -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja \ -DENABLE_VCPKG=ON cmake --build build -j%{?_smp_build_ncpus}%{!?_smp_build_ncpus:1} %install cd %{name}-%{version} install -Dpm0755 bin/Cemu_release %{buildroot}%{_bindir}/Cemu install -Dpm0644 dist/linux/info.cemu.Cemu.desktop \ %{buildroot}%{_datadir}/applications/info.cemu.Cemu.desktop install -Dpm0644 dist/linux/info.cemu.Cemu.png \ %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/info.cemu.Cemu.png install -Dpm0644 dist/linux/info.cemu.Cemu.metainfo.xml \ %{buildroot}%{_datadir}/metainfo/info.cemu.Cemu.metainfo.xml # Cemu's runtime data (gameProfiles, resources, shaders) lives next to the # binary in upstream; ship it under %{_datadir}/Cemu and have the wrapper # binary find it via a relative path. mkdir -p %{buildroot}%{_datadir}/Cemu cp -r bin/gameProfiles %{buildroot}%{_datadir}/Cemu/ cp -r bin/resources %{buildroot}%{_datadir}/Cemu/ %files %license %{name}-%{version}/LICENSE.txt %doc %{name}-%{version}/README.md %{_bindir}/Cemu %{_datadir}/applications/info.cemu.Cemu.desktop %{_datadir}/icons/hicolor/256x256/apps/info.cemu.Cemu.png %{_datadir}/metainfo/info.cemu.Cemu.metainfo.xml %{_datadir}/Cemu/ %changelog %autochangelog