also bundle dotnet in translator for linux appimage

This commit is contained in:
theofficialgman committed 2026-08-29 12:06:58 -04:00
1 parent c5db4d0e8e
commit edc5fa1dd3
4 files changed
+53 -20

No files matched your search

@@ -12,7 +12,7 @@ internal static class BuildRunner
public static async Task RunAsync( public static async Task RunAsync(
string workspace, string profile, string outputDir, string? baseOutputDir, string workspace, string profile, string outputDir, string? baseOutputDir,
string? retroRewindPackageDir, string? retroWfcOfflineDir, bool skipRetroWfcPayload, 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"); var script = Path.Combine(workspace, "Launcher", "local-build.sh");
if (!File.Exists(script)) throw new FileNotFoundException("local-build.sh is missing", script); 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 (skipRetroWfcPayload) startInfo.ArgumentList.Add("--skip-retro-wfc-payload");
if (forceCleanBuild) startInfo.ArgumentList.Add("--force-clean-build"); 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 }; using var process = new Process { StartInfo = startInfo };
var window = new BuildProgressWindow(reporter, InstallStages.Build, start: 6, end: 96); 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.GetValueOrDefault("retro-wfc-offline-dir"),
flags.ContainsKey("skip-retro-wfc-payload"), flags.ContainsKey("skip-retro-wfc-payload"),
flags.ContainsKey("force-clean-build"), flags.ContainsKey("force-clean-build"),
flags.GetValueOrDefault("translator-bin"),
reporter, token); reporter, token);
reporter.Progress(InstallStages.Shortcuts, "Creating shortcuts", 98); 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] 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] [--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}] uninstall [--profile {base|retro-rewind|both|all}]
launch-base launch-base
launch-retro launch-retro
+25 -10
View File
@@ -1,16 +1,19 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Packages Launcher/WiiCompiled.Setup.Linux as a self-contained AppImage: a single file Wheel # 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 # Wizard (or anyone else) can fetch and execute with no git clone and no `dotnet` install at all -
# just to run the installer itself. It still shells out to system clang/cmake/ninja/dolphin-tool - # both the installer and the translator are published as self-contained binaries and bundled, so
# no toolchain is bundled, matching Launcher/local-build.sh's own prerequisites. # 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. # 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 # 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 # 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 # (runtime/, aurora-main/, projects/, local-build.sh) on a later run whose bundled version changed
# version changed - generated/native-build/Assets/PulsarPacks live only in that writable cache and # - generated/native-build/Assets/PulsarPacks live only in that writable cache and are never
# are never touched by the sync, so local-build.sh's own incremental caching survives across runs # touched by the sync, so local-build.sh's own incremental caching survives across runs and across
# and across AppImage updates. # 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 set -euo pipefail
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) 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" cp "$publish_tmp/WiiCompiled.Setup.Linux" "$appdir/usr/bin/wiicompiled-setup"
chmod +x "$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..." 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" cp -r "$workspace/$dir" "$appdir/workspace/$dir"
done done
# Mirrors Build-Installer.ps1's own staging exclusions exactly: aurora-main/extern/CMakeLists.txt # 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" ] || \ if [ ! -f "$CACHE/.bundle-version" ] || \
[ "$(cat "$HERE/workspace/.bundle-version")" != "$(cat "$CACHE/.bundle-version")" ]; then [ "$(cat "$HERE/workspace/.bundle-version")" != "$(cat "$CACHE/.bundle-version")" ]; then
mkdir -p "$CACHE/Launcher" 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" rm -rf "$CACHE/$dir"
cp -r "$HERE/workspace/$dir" "$CACHE/$dir" cp -r "$HERE/workspace/$dir" "$CACHE/$dir"
done done
cp "$HERE/workspace/Launcher/local-build.sh" "$CACHE/Launcher/local-build.sh" cp "$HERE/workspace/Launcher/local-build.sh" "$CACHE/Launcher/local-build.sh"
cp "$HERE/workspace/.bundle-version" "$CACHE/.bundle-version" cp "$HERE/workspace/.bundle-version" "$CACHE/.bundle-version"
fi 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 APPRUN
chmod +x "$appdir/AppRun" chmod +x "$appdir/AppRun"
+21 -8
View File
@@ -62,6 +62,7 @@ cmake_override=""
ninja_override="" ninja_override=""
dotnet_override="" dotnet_override=""
translator_dll_override="" translator_dll_override=""
translator_bin_override=""
usage() { usage() {
cat <<'EOF' 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) --cc PATH / --cxx PATH C/C++ compiler (default: cc/c++ on PATH)
--cmake PATH / --ninja PATH Build tools (default: on PATH) --cmake PATH / --ninja PATH Build tools (default: on PATH)
--dotnet PATH dotnet executable (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 EOF
} }
@@ -101,6 +103,7 @@ while [[ $# -gt 0 ]]; do
--ninja) ninja_override=$2; shift 2 ;; --ninja) ninja_override=$2; shift 2 ;;
--dotnet) dotnet_override=$2; shift 2 ;; --dotnet) dotnet_override=$2; shift 2 ;;
--translator-dll) translator_dll_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 ;; -h|--help) usage; exit 0 ;;
*) fail "unknown argument: $1" ;; *) fail "unknown argument: $1" ;;
esac esac
@@ -146,7 +149,11 @@ ninja_bin=${ninja_override:-ninja}
cc_bin=${cc_override:-clang} cc_bin=${cc_override:-clang}
cxx_bin=${cxx_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 "$cmake_bin" cmake
require_command "$ninja_bin" ninja require_command "$ninja_bin" ninja
require_command "$cc_bin" cc require_command "$cc_bin" cc
@@ -180,14 +187,20 @@ entry_point=$(awk '
' "$project") ' "$project")
[[ -n "$entry_point" ]] || fail "Could not find a translation entry point in $project" [[ -n "$entry_point" ]] || fail "Could not find a translation entry point in $project"
translator_bin=$translator_bin_override
translator_dll=$translator_dll_override translator_dll=$translator_dll_override
if [[ -z "$translator_dll" ]]; then if [[ -n "$translator_bin" ]]; then
translator_dll=$workspace/translator/src/Translator.Cli/bin/Release/net8.0/Translator.Cli.dll assert_file "$translator_bin" "Translator.Cli executable"
log_step build-translator "Building the translator" translator() { "$translator_bin" "$@"; }
"$dotnet_bin" build "$workspace/translator/src/Translator.Cli/Translator.Cli.csproj" -c Release 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 fi
assert_file "$translator_dll" "Translator.Cli.dll"
translator() { "$dotnet_bin" "$translator_dll" "$@"; }
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Parallelism: three independent knobs, same reasoning as LocalBuild.ps1 - # Parallelism: three independent knobs, same reasoning as LocalBuild.ps1 -