also bundle dotnet in translator for linux appimage

This commit is contained in:
theofficialgman
2026-08-25 23:52:20 -04:00
parent c5db4d0e8e
commit edc5fa1dd3
4 changed files with 53 additions and 20 deletions
@@ -12,7 +12,7 @@ internal static class BuildRunner
public static async Task RunAsync(
string workspace, string profile, string outputDir, string? baseOutputDir,
string? retroRewindPackageDir, string? retroWfcOfflineDir, bool skipRetroWfcPayload,
bool forceCleanBuild, IInstallReporter reporter, CancellationToken cancellationToken)
bool forceCleanBuild, string? translatorBin, IInstallReporter reporter, CancellationToken cancellationToken)
{
var script = Path.Combine(workspace, "Launcher", "local-build.sh");
if (!File.Exists(script)) throw new FileNotFoundException("local-build.sh is missing", script);
@@ -41,6 +41,10 @@ internal static class BuildRunner
}
if (skipRetroWfcPayload) startInfo.ArgumentList.Add("--skip-retro-wfc-payload");
if (forceCleanBuild) startInfo.ArgumentList.Add("--force-clean-build");
if (!string.IsNullOrEmpty(translatorBin))
{
startInfo.ArgumentList.Add("--translator-bin"); startInfo.ArgumentList.Add(translatorBin);
}
using var process = new Process { StartInfo = startInfo };
var window = new BuildProgressWindow(reporter, InstallStages.Build, start: 6, end: 96);
+2 -1
View File
@@ -111,6 +111,7 @@ internal static class Program
flags.GetValueOrDefault("retro-wfc-offline-dir"),
flags.ContainsKey("skip-retro-wfc-payload"),
flags.ContainsKey("force-clean-build"),
flags.GetValueOrDefault("translator-bin"),
reporter, token);
reporter.Progress(InstallStages.Shortcuts, "Creating shortcuts", 98);
@@ -260,7 +261,7 @@ internal static class Program
install --profile {base|retro-rewind|both} [--game ISO_PATH] [--install-dir DIR]
[--retro-rewind-package-dir DIR] [--retro-wfc-offline-dir DIR | --skip-retro-wfc-payload]
[--force-clean-build] [--progress-json] [--workspace DIR]
[--force-clean-build] [--translator-bin PATH] [--progress-json] [--workspace DIR]
uninstall [--profile {base|retro-rewind|both|all}]
launch-base
launch-retro
+25 -10
View File
@@ -1,16 +1,19 @@
#!/usr/bin/env bash
# Packages Launcher/WiiCompiled.Setup.Linux as a self-contained AppImage: a single file Wheel
# Wizard (or anyone else) can fetch and execute with no git clone and no `dotnet` install required
# just to run the installer itself. It still shells out to system clang/cmake/ninja/dolphin-tool -
# no toolchain is bundled, matching Launcher/local-build.sh's own prerequisites.
# Wizard (or anyone else) can fetch and execute with no git clone and no `dotnet` install at all -
# both the installer and the translator are published as self-contained binaries and bundled, so
# AppRun passes --translator-bin to skip local-build.sh's own dotnet-build-from-source step. It
# still shells out to system clang/cmake/ninja/dolphin-tool - no C/C++ toolchain is bundled,
# matching Launcher/local-build.sh's own remaining prerequisites.
#
# An AppImage mounts read-only, but local-build.sh writes generated/, native-build/, Assets/, etc.
# into the workspace it's given. So AppRun (written below) copies the bundled workspace snapshot
# out to a writable cache directory on first run, and only ever re-syncs the bundled directories
# (runtime/, aurora-main/, translator/, projects/, local-build.sh) on a later run whose bundled
# version changed - generated/native-build/Assets/PulsarPacks live only in that writable cache and
# are never touched by the sync, so local-build.sh's own incremental caching survives across runs
# and across AppImage updates.
# (runtime/, aurora-main/, projects/, local-build.sh) on a later run whose bundled version changed
# - generated/native-build/Assets/PulsarPacks live only in that writable cache and are never
# touched by the sync, so local-build.sh's own incremental caching survives across runs and across
# AppImage updates. translator/ isn't part of this snapshot at all: it's published as its own
# self-contained binary (usr/bin/translator-cli) below and never needs a writable copy.
set -euo pipefail
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
@@ -44,8 +47,20 @@ dotnet publish "$workspace/Launcher/WiiCompiled.Setup.Linux" -c Release -r linux
cp "$publish_tmp/WiiCompiled.Setup.Linux" "$appdir/usr/bin/wiicompiled-setup"
chmod +x "$appdir/usr/bin/wiicompiled-setup"
# Published as a self-contained binary too, so an AppImage user never needs a `dotnet` SDK on
# PATH at all - local-build.sh is told about it via --translator-bin and skips its own
# dotnet-build-from-source step entirely (see local-build.sh's translator resolution branch).
echo "Publishing the translator (self-contained linux-x64)..."
translator_publish_tmp="$workspace/Launcher/artifacts/appimage-build/publish-translator"
rm -rf "$translator_publish_tmp"
dotnet publish "$workspace/translator/src/Translator.Cli" -c Release -r linux-x64 \
--self-contained -p:PublishSingleFile=true -p:EnableCompressionInSingleFile=true \
-o "$translator_publish_tmp"
cp "$translator_publish_tmp/Translator.Cli" "$appdir/usr/bin/translator-cli"
chmod +x "$appdir/usr/bin/translator-cli"
echo "Staging the bundled workspace snapshot..."
for dir in runtime aurora-main translator projects; do
for dir in runtime aurora-main projects; do
cp -r "$workspace/$dir" "$appdir/workspace/$dir"
done
# Mirrors Build-Installer.ps1's own staging exclusions exactly: aurora-main/extern/CMakeLists.txt
@@ -72,14 +87,14 @@ CACHE="${XDG_DATA_HOME:-$HOME/.local/share}/WiiCompiled/workspace"
if [ ! -f "$CACHE/.bundle-version" ] || \
[ "$(cat "$HERE/workspace/.bundle-version")" != "$(cat "$CACHE/.bundle-version")" ]; then
mkdir -p "$CACHE/Launcher"
for dir in runtime aurora-main translator projects; do
for dir in runtime aurora-main projects; do
rm -rf "$CACHE/$dir"
cp -r "$HERE/workspace/$dir" "$CACHE/$dir"
done
cp "$HERE/workspace/Launcher/local-build.sh" "$CACHE/Launcher/local-build.sh"
cp "$HERE/workspace/.bundle-version" "$CACHE/.bundle-version"
fi
exec "$HERE/usr/bin/wiicompiled-setup" --workspace "$CACHE" "$@"
exec "$HERE/usr/bin/wiicompiled-setup" --workspace "$CACHE" --translator-bin "$HERE/usr/bin/translator-cli" "$@"
APPRUN
chmod +x "$appdir/AppRun"
+21 -8
View File
@@ -62,6 +62,7 @@ cmake_override=""
ninja_override=""
dotnet_override=""
translator_dll_override=""
translator_bin_override=""
usage() {
cat <<'EOF'
@@ -79,7 +80,8 @@ Usage: local-build.sh --output-dir DIR [options]
--cc PATH / --cxx PATH C/C++ compiler (default: cc/c++ on PATH)
--cmake PATH / --ninja PATH Build tools (default: on PATH)
--dotnet PATH dotnet executable (default: on PATH)
--translator-dll PATH Pre-built Translator.Cli.dll (skips building the translator)
--translator-dll PATH Pre-built Translator.Cli.dll (skips building the translator; still needs --dotnet to run it)
--translator-bin PATH Self-contained Translator.Cli executable (skips building AND needs no dotnet at all)
EOF
}
@@ -101,6 +103,7 @@ while [[ $# -gt 0 ]]; do
--ninja) ninja_override=$2; shift 2 ;;
--dotnet) dotnet_override=$2; shift 2 ;;
--translator-dll) translator_dll_override=$2; shift 2 ;;
--translator-bin) translator_bin_override=$2; shift 2 ;;
-h|--help) usage; exit 0 ;;
*) fail "unknown argument: $1" ;;
esac
@@ -146,7 +149,11 @@ ninja_bin=${ninja_override:-ninja}
cc_bin=${cc_override:-clang}
cxx_bin=${cxx_override:-clang++}
require_command "$dotnet_bin" dotnet
# A self-contained --translator-bin needs no dotnet at all (it bundles its own runtime); dotnet is
# only required when the translator has to be built from source or run as a plain .dll.
if [[ -z "$translator_bin_override" ]]; then
require_command "$dotnet_bin" dotnet
fi
require_command "$cmake_bin" cmake
require_command "$ninja_bin" ninja
require_command "$cc_bin" cc
@@ -180,14 +187,20 @@ entry_point=$(awk '
' "$project")
[[ -n "$entry_point" ]] || fail "Could not find a translation entry point in $project"
translator_bin=$translator_bin_override
translator_dll=$translator_dll_override
if [[ -z "$translator_dll" ]]; then
translator_dll=$workspace/translator/src/Translator.Cli/bin/Release/net8.0/Translator.Cli.dll
log_step build-translator "Building the translator"
"$dotnet_bin" build "$workspace/translator/src/Translator.Cli/Translator.Cli.csproj" -c Release
if [[ -n "$translator_bin" ]]; then
assert_file "$translator_bin" "Translator.Cli executable"
translator() { "$translator_bin" "$@"; }
else
if [[ -z "$translator_dll" ]]; then
translator_dll=$workspace/translator/src/Translator.Cli/bin/Release/net8.0/Translator.Cli.dll
log_step build-translator "Building the translator"
"$dotnet_bin" build "$workspace/translator/src/Translator.Cli/Translator.Cli.csproj" -c Release
fi
assert_file "$translator_dll" "Translator.Cli.dll"
translator() { "$dotnet_bin" "$translator_dll" "$@"; }
fi
assert_file "$translator_dll" "Translator.Cli.dll"
translator() { "$dotnet_bin" "$translator_dll" "$@"; }
# ---------------------------------------------------------------------------
# Parallelism: three independent knobs, same reasoning as LocalBuild.ps1 -