From 771f1425842a3f1fde8aaeae9c54368b23668cbf Mon Sep 17 00:00:00 2001 From: Raed Rizqie Date: Mon, 28 Jul 2025 00:58:38 +0800 Subject: [PATCH] scummvm: fix aarch64 build - fix aarch64 detection to properly enable neon - add msys2 refs - install license file --- .../001-fix-host-cpu-detection.patch | 29 ++++++++++ mingw-w64-scummvm/PKGBUILD | 53 +++++++++++++++---- 2 files changed, 71 insertions(+), 11 deletions(-) create mode 100644 mingw-w64-scummvm/001-fix-host-cpu-detection.patch diff --git a/mingw-w64-scummvm/001-fix-host-cpu-detection.patch b/mingw-w64-scummvm/001-fix-host-cpu-detection.patch new file mode 100644 index 0000000000..513002759e --- /dev/null +++ b/mingw-w64-scummvm/001-fix-host-cpu-detection.patch @@ -0,0 +1,29 @@ +--- a/configure ++++ b/configure +@@ -325,12 +325,15 @@ + #localedir='${datarootdir}/locale' + + # For cross compiling +-_host="" +-_host_cpu="" ++_host="$host" ++_host_cpu="$host_cpu" + _host_vendor="" + _host_os="" + _host_alias="" + ++_build="$build" ++_build_cpu="$build_cpu" ++ + _port_mk="ports.mk" + + # Use temp files in the build directory +@@ -3480,7 +3483,7 @@ + ;; + esac + +-if test -n "$_host"; then ++if test "$_host" != "$_build" ; then + # Cross-compiling mode - add your target here if needed + echo "Cross-compiling to $_host" + case "$_host" in diff --git a/mingw-w64-scummvm/PKGBUILD b/mingw-w64-scummvm/PKGBUILD index 838e796275..966ca5ee00 100644 --- a/mingw-w64-scummvm/PKGBUILD +++ b/mingw-w64-scummvm/PKGBUILD @@ -4,14 +4,16 @@ _realname=scummvm pkgbase=mingw-w64-${_realname} pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" pkgver=2.9.1 -pkgrel=1 -pkgdesc="A 'virtual machine' for several classic graphical point-and-click adventure games. (mingw-w64)" +pkgrel=2 +pkgdesc="A 'virtual machine' for several classic graphical point-and-click adventure games (mingw-w64)" arch=('any') mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64') url='https://www.scummvm.org/' +msys2_repository_url='https://github.com/scummvm/scummvm' +msys2_documentation_url='https://docs.scummvm.org/' license=("spdx:GPL-3.0-or-later") makedepends=("${MINGW_PACKAGE_PREFIX}-cc" - "${MINGW_PACKAGE_PREFIX}-autotools") + "${MINGW_PACKAGE_PREFIX}-pkgconf") depends=("${MINGW_PACKAGE_PREFIX}-cc-libs" "${MINGW_PACKAGE_PREFIX}-a52dec" "${MINGW_PACKAGE_PREFIX}-curl" @@ -22,22 +24,42 @@ depends=("${MINGW_PACKAGE_PREFIX}-cc-libs" "${MINGW_PACKAGE_PREFIX}-fribidi" "${MINGW_PACKAGE_PREFIX}-glew" "${MINGW_PACKAGE_PREFIX}-libjpeg-turbo" + "${MINGW_PACKAGE_PREFIX}-libmpcdec" "${MINGW_PACKAGE_PREFIX}-libogg" + "${MINGW_PACKAGE_PREFIX}-libopenmpt" "${MINGW_PACKAGE_PREFIX}-libvorbis" "${MINGW_PACKAGE_PREFIX}-libmad" - "${MINGW_PACKAGE_PREFIX}-libmpeg2-git" + "${MINGW_PACKAGE_PREFIX}-libmpeg2" "${MINGW_PACKAGE_PREFIX}-libtheora" "${MINGW_PACKAGE_PREFIX}-libpng" + "${MINGW_PACKAGE_PREFIX}-libvpx" $([[ ${CARCH} == aarch64 ]] || echo "${MINGW_PACKAGE_PREFIX}-nasm") "${MINGW_PACKAGE_PREFIX}-readline" "${MINGW_PACKAGE_PREFIX}-SDL2" "${MINGW_PACKAGE_PREFIX}-SDL2_net" "${MINGW_PACKAGE_PREFIX}-zlib") -source=("https://downloads.scummvm.org/frs/scummvm/${pkgver}/scummvm-${pkgver}.tar.xz") -sha256sums=('6a82f36afa9de758ab1dd377101a26a53f12417cbfd350bb8e5d7fd5b8c257e3') +source=("https://downloads.scummvm.org/frs/scummvm/${pkgver}/${_realname}-${pkgver}.tar.xz" + 001-fix-host-cpu-detection.patch) +sha256sums=('6a82f36afa9de758ab1dd377101a26a53f12417cbfd350bb8e5d7fd5b8c257e3' + '7b669440a03b26eb638746f65b9f454028bf2593e116af0ccc68fe17dbae87cf') + +apply_patch_with_msg() { + for _patch in "$@" + do + msg2 "Applying ${_patch}" + patch -p1 -i "${srcdir}/${_patch}" + done +} + +prepare() { + cd ${_realname}-${pkgver} + + apply_patch_with_msg \ + 001-fix-host-cpu-detection.patch +} build() { - mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}" + mkdir -p build-${MSYSTEM} && cd build-${MSYSTEM} declare -a _extra_config if check_option "debug" "n"; then @@ -46,9 +68,16 @@ build() { _extra_config+=("--disable-release" "--disable-optimizations" "--enable-debug") fi - # because of MSYS emulation, host_cpu detected as AMD64 - if [[ ${CARCH} == aarch64 ]]; then - _extra_config+=("--enable-ext-neon" "--disable-ext-sse2" "--disable-ext-avx2") + export host=${MINGW_CHOST} + export host_cpu=${CARCH} + export build=${MINGW_CHOST} + + # Suppress some annoying warnings + CXXFLAGS+=" -Wno-deprecated-declarations -Wno-strict-aliasing" + if [[ ${MSYSTEM} == CLANG* ]]; then + CXXFLAGS+=" -Wno-nontrivial-memcall -Wno-unused-but-set-variable" + else + CXXFLAGS+=" -Wno-cast-user-defined -Wno-class-memaccess -Wno-maybe-uninitialized -Wno-stringop-truncation" fi ../${_realname}-${pkgver}/configure \ @@ -59,6 +88,8 @@ build() { } package() { - cd "${srcdir}/build-${MSYSTEM}" + cd build-${MSYSTEM} make DESTDIR="${pkgdir}" install + + install -Dm644 "${srcdir}"/${_realname}-${pkgver}/COPYING "${pkgdir}"${MINGW_PREFIX}/share/licenses/scummvm/LICENSE }