From fc9d0596575a9e1e18eaf1b1675adc0af41b98f5 Mon Sep 17 00:00:00 2001 From: patchzyy <64382339+patchzyy@users.noreply.github.com> Date: Sun, 18 Oct 2026 10:52:06 +0200 Subject: [PATCH] mac version fix --- Launcher/WiiCompiled.Setup.Linux/BuildRunner.cs | 1 + Launcher/local-build-macos.command | 10 +++++++++- Launcher/local-build.sh | 12 +++++++++++- Launcher/macos/build-setup-pkg.command | 1 + runtime/CMakeLists.txt | 2 ++ runtime/cmake/PublicProducts.cmake | 3 +++ runtime/src/main.cpp | 11 ++++++++--- 7 files changed, 35 insertions(+), 5 deletions(-) diff --git a/Launcher/WiiCompiled.Setup.Linux/BuildRunner.cs b/Launcher/WiiCompiled.Setup.Linux/BuildRunner.cs index 284310a..292afd9 100644 --- a/Launcher/WiiCompiled.Setup.Linux/BuildRunner.cs +++ b/Launcher/WiiCompiled.Setup.Linux/BuildRunner.cs @@ -82,6 +82,7 @@ internal static class BuildRunner { startInfo.ArgumentList.Add("--sysroot"); startInfo.ArgumentList.Add(sysroot); } + startInfo.ArgumentList.Add("--setup-version"); startInfo.ArgumentList.Add(ProductInfo.Version); using var process = new Process { StartInfo = startInfo }; var window = new BuildProgressWindow(reporter, InstallStages.Build, start: 6, end: 96); diff --git a/Launcher/local-build-macos.command b/Launcher/local-build-macos.command index 4c238fd..7a01e64 100755 --- a/Launcher/local-build-macos.command +++ b/Launcher/local-build-macos.command @@ -27,12 +27,15 @@ Usage: local-build-macos.command --output-dir DIR [options] --cmake PATH --ninja PATH Override build tools --dotnet PATH Override dotnet --translator-bin PATH Use a self-contained Translator.Cli executable + --setup-version VERSION Version recorded in the runtime log (default: in + Launcher/Directory.Build.props when present) EOF } workspace="$default_workspace"; profile=base; output_dir=""; base_output_dir="" game=""; nodtool=""; retro_root=""; retro_wfc=""; skip_retro_wfc=0; force_clean=0 parallel=0; cmake_bin=cmake; ninja_bin=ninja; dotnet_bin=dotnet; translator_bin="" +setup_version="" while (($#)); do case "$1" in --workspace) workspace=${2:-}; shift 2 ;; @@ -50,6 +53,7 @@ while (($#)); do --ninja) ninja_bin=${2:-}; shift 2 ;; --dotnet) dotnet_bin=${2:-}; shift 2 ;; --translator-bin) translator_bin=${2:-}; shift 2 ;; + --setup-version) setup_version=${2:-}; shift 2 ;; -h|--help) usage; exit 0 ;; *) fail "unknown option: $1" ;; esac @@ -60,6 +64,10 @@ macos_arch=$(uname -m) case "$macos_arch" in arm64|x86_64) ;; *) fail "unsupported macOS architecture: $macos_arch" ;; esac macos_deployment_target=12.0 workspace=$(cd "$workspace" && pwd) +if [[ -z "$setup_version" && -f "$workspace/Launcher/Directory.Build.props" ]]; then + setup_version=$(sed -nE 's/.*([^<]+)<\/Version>.*/\1/p' "$workspace/Launcher/Directory.Build.props" | head -n 1) +fi +[[ "$setup_version" =~ ^[0-9A-Za-z.+-]*$ ]] || fail '--setup-version contains unsupported characters' [[ -n "$output_dir" ]] || fail '--output-dir is required' case "$profile" in base|retro-rewind|both) ;; *) fail '--profile must be base, retro-rewind, or both' ;; esac builds_retro=0; [[ "$profile" != base ]] && builds_retro=1 @@ -136,7 +144,7 @@ step emit-build-shards 'Preparing native build shards'; translator "${args[@]}" step configure-native 'Configuring the native toolchain' # Use Aurora's pinned SDL3 source on macOS. A system SDL3 can be older than # Aurora's required API even when find_package() succeeds. -"$cmake_bin" -S "$workspace/runtime" -B "$native_build" -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_MAKE_PROGRAM="$ninja_bin" -DCMAKE_OSX_ARCHITECTURES="$macos_arch" -DCMAKE_OSX_DEPLOYMENT_TARGET="$macos_deployment_target" -DMKW_TRANSLATED_COMPILE_JOBS="$translated_jobs" -DAURORA_SDL3_PROVIDER=vendor +"$cmake_bin" -S "$workspace/runtime" -B "$native_build" -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_MAKE_PROGRAM="$ninja_bin" -DCMAKE_OSX_ARCHITECTURES="$macos_arch" -DCMAKE_OSX_DEPLOYMENT_TARGET="$macos_deployment_target" -DMKW_TRANSLATED_COMPILE_JOBS="$translated_jobs" -DAURORA_SDL3_PROVIDER=vendor -DMKW_SETUP_VERSION="$setup_version" targets=(); [[ "$profile" != retro-rewind ]] && targets+=(WiiCompiled); [[ "$profile" != base ]] && targets+=(RetroRewind) step compile "Compiling ${targets[*]} locally"; "$cmake_bin" --build "$native_build" --target "${targets[@]}" --parallel "$global_jobs" if [[ "$profile" != retro-rewind ]]; then "$script_dir/macos/publish-app.command" --build-dir "$native_build" --product WiiCompiled --output-dir "${base_output_dir:-$output_dir}" --architecture "$macos_arch" --minimum-system-version "$macos_deployment_target"; fi diff --git a/Launcher/local-build.sh b/Launcher/local-build.sh index f48ae9b..cdc81eb 100755 --- a/Launcher/local-build.sh +++ b/Launcher/local-build.sh @@ -66,6 +66,7 @@ translator_bin_override="" fuse_ld_override="" native_prebuilt_dir="" sysroot="" +setup_version="" usage() { cat <<'EOF' @@ -90,6 +91,8 @@ Usage: local-build.sh --output-dir DIR [options] skips compiling aurora-main from source entirely --sysroot PATH Passed to CMake as -DCMAKE_SYSROOT: where the compiler resolves standard headers/startup files + --setup-version VERSION Version recorded in the runtime log (default: in + Launcher/Directory.Build.props when present) EOF } @@ -114,11 +117,17 @@ while [[ $# -gt 0 ]]; do --translator-bin) translator_bin_override=$2; shift 2 ;; --native-prebuilt-dir) native_prebuilt_dir=$2; shift 2 ;; --sysroot) sysroot=$2; shift 2 ;; + --setup-version) setup_version=$2; shift 2 ;; -h|--help) usage; exit 0 ;; *) fail "unknown argument: $1" ;; esac done +if [[ -z "$setup_version" && -f "$workspace/Launcher/Directory.Build.props" ]]; then + setup_version=$(sed -nE 's/.*([^<]+)<\/Version>.*/\1/p' "$workspace/Launcher/Directory.Build.props" | head -n 1) +fi +[[ "$setup_version" =~ ^[0-9A-Za-z.+-]*$ ]] || fail "--setup-version contains unsupported characters" + [[ -n "$output_dir" ]] || { usage; fail "--output-dir is required"; } case "$profile" in base|retro-rewind|both) ;; @@ -418,7 +427,8 @@ configure_args=(-S "$workspace/runtime" -B "$build" -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$cc_bin" -DCMAKE_CXX_COMPILER="$cxx_bin" -DCMAKE_MAKE_PROGRAM="$ninja_bin" - -DMKW_TRANSLATED_COMPILE_JOBS="$translated_jobs") + -DMKW_TRANSLATED_COMPILE_JOBS="$translated_jobs" + -DMKW_SETUP_VERSION="$setup_version") # CMAKE_C_COMPILER/CXX_COMPILER stay stable across AppImage runs on their own (they're exactly # what's passed via -D above, and AppRun points --cc/--cxx at a symlink it re-targets at the # current mount every launch - see build-appimage.sh). CMAKE_AR/RANLIB/LINKER/ASM_COMPILER do NOT diff --git a/Launcher/macos/build-setup-pkg.command b/Launcher/macos/build-setup-pkg.command index f2ae572..cf84b9e 100755 --- a/Launcher/macos/build-setup-pkg.command +++ b/Launcher/macos/build-setup-pkg.command @@ -151,6 +151,7 @@ for source in aurora-main projects runtime translator; do copy_clean "$workspace/$source" "$resources/workspace/$source" done mkdir -p "$resources/workspace/Launcher/macos" +copy_clean "$workspace/Launcher/Directory.Build.props" "$resources/workspace/Launcher/Directory.Build.props" copy_clean "$workspace/Launcher/local-build-macos.command" "$resources/workspace/Launcher/local-build-macos.command" copy_clean "$workspace/Launcher/macos/extract-disc.command" "$resources/workspace/Launcher/macos/extract-disc.command" copy_clean "$workspace/Launcher/macos/publish-app.command" "$resources/workspace/Launcher/macos/publish-app.command" diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 6410b0b..73bf4d6 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -56,6 +56,8 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(AMD64|amd64|x86_64|X86_64)$" AND message(FATAL_ERROR "MKW_X86_CPU_PROFILE must be v2 or v3 (got '${MKW_X86_CPU_PROFILE}')") endif() +set(MKW_SETUP_VERSION "" CACHE STRING "WiiCompiled version recorded in the runtime log") + option(MKW_PLATFORM_TESTS_ONLY "Build host-platform tests without graphics dependencies or game assets" OFF) include("${CMAKE_CURRENT_LIST_DIR}/cmake/HostLibraries.cmake") if(MKW_PLATFORM_TESTS_ONLY) diff --git a/runtime/cmake/PublicProducts.cmake b/runtime/cmake/PublicProducts.cmake index 14f2500..7b8b327 100644 --- a/runtime/cmake/PublicProducts.cmake +++ b/runtime/cmake/PublicProducts.cmake @@ -80,6 +80,9 @@ target_compile_features(mkw_runtime_common PRIVATE cxx_std_20) target_compile_definitions(mkw_runtime_common PRIVATE SDL_MAIN_HANDLED _DISABLE_STRING_ANNOTATION _DISABLE_VECTOR_ANNOTATION) +if(MKW_SETUP_VERSION) + target_compile_definitions(mkw_runtime_common PRIVATE MKW_SETUP_VERSION="${MKW_SETUP_VERSION}") +endif() target_link_libraries(mkw_runtime_common PRIVATE aurora::gx aurora::pad aurora::si aurora::vi aurora::mtx) target_link_libraries(mkw_runtime_common PRIVATE mkw_platform mkw::pugixml mkw::toml11 mkw::cryptopp mkw::mbedtls) diff --git a/runtime/src/main.cpp b/runtime/src/main.cpp index 1597d20..b3784c2 100644 --- a/runtime/src/main.cpp +++ b/runtime/src/main.cpp @@ -378,10 +378,15 @@ void AttachParentConsoleForDiagnostics() { void AttachParentConsoleForDiagnostics() {} #endif -// The setup writes build-fingerprint.json beside every product executable; its SetupVersion is -// the only version identity the runtime has (products are compiled locally, so nothing is baked -// into the binary). Surface it at the top of the transcript so every attached log self-identifies. +// The macOS and Linux local builds bake the setup version in; the Windows setup instead writes it +// to build-fingerprint.json beside the executable. Surfaced at the top of the transcript so every +// attached log self-identifies. std::string ReadInstalledSetupVersion() { +#if defined(MKW_SETUP_VERSION) + if (constexpr std::string_view builtIn = MKW_SETUP_VERSION; !builtIn.empty()) { + return std::string(builtIn); + } +#endif const auto directory = RuntimeConfigFile::ExecutableDirectory(); if (!directory) { return {};