From 3cc12dd35e1a2e847d51727cf077815561af888a Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Mon, 6 Jul 2026 21:38:54 -0700 Subject: [PATCH] packaging: build libmpeg2 into macOS deps for CD32 FMV The DMG builds silently lost CD32 FMV video decode when Homebrew's libmpeg2 moved to a macOS 26 baseline: the deployment-target check rejects it against the 13.0 release target and no other copy exists. Build libmpeg2 0.5.1 into the private deps prefix instead, pinned by sha256 from the videolan tarball in CI. The 2008 tarball needs its autotools regenerated to configure on arm64-apple-darwin and gnu89 inline semantics to link with clang, matching the Homebrew formula. --- README_unix.md | 4 +++- tools/macos-build-deps.sh | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README_unix.md b/README_unix.md index 4a9a91f3..d6007767 100644 --- a/README_unix.md +++ b/README_unix.md @@ -53,7 +53,7 @@ The system zlib is normally enough on macOS. The macOS build defaults to `CMAKE_OSX_DEPLOYMENT_TARGET=13.0` so the app is not accidentally tied to the build machine's current macOS release. Bundled libraries and frameworks must support the same or an older deployment target. The packaging script checks every bundled Mach-O file and fails if, for example, Homebrew SDL3 or Qt was built with a newer `minos` than the app target. Use the private dependency build below for repeatable release artifacts. -For repeatable release builds, build SDL3, QtBase, libFLAC when CHD is enabled, and optional libraries such as libpng into a private prefix with the same deployment target instead of using Homebrew bottles. The helper defaults QtBase to bundled third-party libraries so Homebrew dylibs with newer deployment targets are not pulled into the release app. If SDL3's CMake or pkg-config metadata is missing from the private prefix, the WinUAE CMake build can still use a matching `include/SDL3` and `libSDL3.0.dylib` pair from `CMAKE_PREFIX_PATH`. Supplying `WINUAE_LIBPNG_SOURCE` gives the Unix screenshot backend a deployment-target-compatible PNG library; without it, CMake may skip a too-new Homebrew libpng and fall back to BMP screenshots. Supplying `WINUAE_FLAC_SOURCE` lets the dependency helper build CHD's required FLAC library with the same deployment target. PPC release packages also need deployment-target-compatible QEMU-UAE dependencies such as GLib, gettext, and PCRE2; Homebrew bottles built for a newer macOS will be rejected by the bundle verifier. +For repeatable release builds, build SDL3, QtBase, libFLAC when CHD is enabled, and optional libraries such as libpng into a private prefix with the same deployment target instead of using Homebrew bottles. The helper defaults QtBase to bundled third-party libraries so Homebrew dylibs with newer deployment targets are not pulled into the release app. If SDL3's CMake or pkg-config metadata is missing from the private prefix, the WinUAE CMake build can still use a matching `include/SDL3` and `libSDL3.0.dylib` pair from `CMAKE_PREFIX_PATH`. Supplying `WINUAE_LIBPNG_SOURCE` gives the Unix screenshot backend a deployment-target-compatible PNG library; without it, CMake may skip a too-new Homebrew libpng and fall back to BMP screenshots. Supplying `WINUAE_FLAC_SOURCE` lets the dependency helper build CHD's required FLAC library with the same deployment target. Supplying `WINUAE_LIBMPEG2_SOURCE` (the libmpeg2 0.5.1 tarball from videolan.org, extracted) enables CD32 FMV video decode; without a deployment-target-compatible libmpeg2, CMake silently disables FMV playback. PPC release packages also need deployment-target-compatible QEMU-UAE dependencies such as GLib, gettext, and PCRE2; Homebrew bottles built for a newer macOS will be rejected by the bundle verifier. ```sh WINUAE_MACOS_DEPLOYMENT_TARGET=13.0 \ @@ -61,6 +61,7 @@ WINUAE_SDL3_SOURCE=/path/to/SDL3-source \ WINUAE_QT_SOURCE=/path/to/qtbase-source \ WINUAE_LIBPNG_SOURCE=/path/to/libpng-source \ WINUAE_FLAC_SOURCE=/path/to/flac-source \ +WINUAE_LIBMPEG2_SOURCE=/path/to/libmpeg2-0.5.1 \ tools/macos-build-deps.sh /opt/winuae-macos-13 source /opt/winuae-macos-13/winuae-macos-deps-env.sh @@ -77,6 +78,7 @@ WINUAE_SDL3_SOURCE=/path/to/SDL3-source \ WINUAE_QT_SOURCE=/path/to/qtbase-source \ WINUAE_LIBPNG_SOURCE=/path/to/libpng-source \ WINUAE_FLAC_SOURCE=/path/to/flac-source \ +WINUAE_LIBMPEG2_SOURCE=/path/to/libmpeg2-0.5.1 \ cmake --build /tmp/winuae_cmake_build --target winuae_unix_macos_deps ``` diff --git a/tools/macos-build-deps.sh b/tools/macos-build-deps.sh index c5416124..8115fb39 100755 --- a/tools/macos-build-deps.sh +++ b/tools/macos-build-deps.sh @@ -119,6 +119,9 @@ run_autotools_build() { make distclean >/dev/null 2>&1 || true fi rm -f config.log config.status + if [[ "${WINUAE_AUTORECONF:-0}" == "1" ]]; then + autoreconf --force --install + fi env \ CFLAGS="${CFLAGS:-} -mmacosx-version-min=${target}" \ CXXFLAGS="${CXXFLAGS:-} -mmacosx-version-min=${target}" \ @@ -237,8 +240,16 @@ if [[ "${WINUAE_SKIP_LIBMPEG2:-0}" != "1" ]]; then split_extra_args "${WINUAE_LIBMPEG2_CONFIGURE_ARGS}" libmpeg2_configure_args+=(${extra_args[@]+"${extra_args[@]}"}) fi - run_autotools_build "${libmpeg2_source}" "${build_dir}/libmpeg2" \ - "${libmpeg2_configure_args[@]}" + # The 0.5.1 tarball ships 2008 autotools that cannot configure on + # arm64-apple-darwin, and clang needs gnu89 inline semantics to avoid + # duplicate symbol errors, so regenerate the build system like the + # Homebrew formula does. + ( + export WINUAE_AUTORECONF=1 + export CFLAGS="${CFLAGS:-} -std=gnu89" + run_autotools_build "${libmpeg2_source}" "${build_dir}/libmpeg2" \ + "${libmpeg2_configure_args[@]}" + ) ( cd "${build_dir}/libmpeg2/src" make -C libmpeg2 install -- 2.47.3