From 77c54f41cc00cff5408119b3e91e58eac8e318de Mon Sep 17 00:00:00 2001 From: jyelon Date: Fri, 27 Jun 2025 19:14:29 -0400 Subject: [PATCH] More work on getting a truly clean build --- EnginePatches/EnginePatch | 24 ------------------- EnginePatches/PatchedDosFiles | 1 - build.py | 43 ++++++++--------------------------- 3 files changed, 9 insertions(+), 59 deletions(-) delete mode 100644 EnginePatches/PatchedDosFiles diff --git a/EnginePatches/EnginePatch b/EnginePatches/EnginePatch index bc7e7360..d4b786b7 100644 --- a/EnginePatches/EnginePatch +++ b/EnginePatches/EnginePatch @@ -35,27 +35,3 @@ diff -u --recursive UnrealEngine-5.3.1-release/Engine/Source/Runtime/Application // If we're rendering offscreen, use the "dummy" SDL video driver if (FParse::Param(FCommandLine::Get(), TEXT("RenderOffScreen")) && !getenv("SDL_VIDEODRIVER")) { -diff -u --recursive UnrealEngine-5.3.1-release/Setup.bat UnrealEngine/Setup.bat ---- UnrealEngine-5.3.1-release/Setup.bat 2023-09-27 09:48:07.000000000 -0400 -+++ UnrealEngine/Setup.bat 2025-06-19 17:50:32.284629525 -0400 -@@ -28,7 +28,7 @@ - - rem Register the engine installation... - if not exist .\Engine\Binaries\Win64\UnrealVersionSelector-Win64-Shipping.exe goto :no_unreal_version_selector --.\Engine\Binaries\Win64\UnrealVersionSelector-Win64-Shipping.exe /register -+.\Engine\Binaries\Win64\UnrealVersionSelector-Win64-Shipping.exe /register /unattended - :no_unreal_version_selector - - rem Done! -diff -u --recursive UnrealEngine-5.3.1-release/Setup.sh UnrealEngine/Setup.sh ---- UnrealEngine-5.3.1-release/Setup.sh 2023-09-27 09:48:07.000000000 -0400 -+++ UnrealEngine/Setup.sh 2025-06-19 17:47:01.621969761 -0400 -@@ -80,7 +80,7 @@ - echo Register the engine installation... - if [ -f Engine/Binaries/Linux/UnrealVersionSelector-Linux-Shipping ]; then - pushd Engine/Binaries/Linux > /dev/null -- ./UnrealVersionSelector-Linux-Shipping -register > /dev/null & -+ ./UnrealVersionSelector-Linux-Shipping -register -unattended > /dev/null & - popd > /dev/null - fi - diff --git a/EnginePatches/PatchedDosFiles b/EnginePatches/PatchedDosFiles deleted file mode 100644 index 640c7639..00000000 --- a/EnginePatches/PatchedDosFiles +++ /dev/null @@ -1 +0,0 @@ -Setup.bat diff --git a/build.py b/build.py index 8182836f..50246f5e 100755 --- a/build.py +++ b/build.py @@ -13,6 +13,10 @@ import itertools, hashlib, zipfile, fnmatch from pathlib import Path from types import SimpleNamespace +# +# Suppress an error in some of Unreal's scripts: +# +os.environ["GIT_DIR"] = ".git" # # Utility subroutines @@ -113,34 +117,6 @@ def cpp_files_included_by(module): return result -# -# Applying patches to files with DOS line endings. -# -# We want to apply a patch to the UnrealEngine source, and some but not all -# of the files we want to patch have DOS line endings. Unfortunately, the -# unix patch utility can't handle a codebase with mixed line endings. -# To make it work, we convert all files to UNIX line endings, apply the -# patch, and then convert the appropriate files back. -# - -def dos2unix(fn): - before = Path(fn).read_bytes() - after = before.replace(b"\r\n", b"\n") - if before != after: - print("dos2unix ", fn) - Path(fn).write_bytes(after) - -def unix2dos(fn): - before = Path(fn).read_bytes() - after = before.replace(b"\n", b"\r\n") - if before != after: - print("unix2dos ", fn) - Path(fn).write_bytes(after) - -# -# Given a patch file, generate a list of the files being modified. -# - # # Determining the build configuration. # @@ -221,13 +197,10 @@ def unzip_unreal_engine_and_apply_patch(): unrealversion = os.path.join(INTEGRATION, version) shutil.rmtree(UNREALENGINE, ignore_errors=True) shutil.rmtree(unrealversion, ignore_errors=True) - shell(INTEGRATION, "unzip UnrealEngine.zip") + print("Unzipping UnrealEngine.zip...") + shell(INTEGRATION, "unzip -q UnrealEngine.zip") patchfile = f"{INTEGRATION}/EnginePatches/EnginePatch" - dosfiles = Path(f"{INTEGRATION}/EnginePatches/PatchedDosFiles").read_text().splitlines() - dos2unix(patchfile) - for file in dosfiles: dos2unix(f"{unrealversion}/{file}") shell(unrealversion, f"patch -p1 < {patchfile}") - for file in dosfiles: unix2dos(f"{unrealversion}/{file}") Path(unrealversion).rename(UNREALENGINE) @@ -282,13 +255,15 @@ def run_unrealengine_setup_bat_replacement(): prompt in the middle of a build. Yuk. So we've written our own script that replaces Setup.bat/Setup.sh. """ - if not Path(f"{UNREALENGINE}/Engine/Content").is_dir(): + touch = Path(f"{UNREALENGINE}/Engine/Build/HaveGitDependencies") + if not touch.is_file(): if sys.platform == "windows": shell(UNREALENGINE, "Engine/Binaries/DotNET/GitDependencies/win-x64/GitDependencies.exe") shell(UNREALENGINE, "Engine/Extras/Redist/en-us/UEPrereqSetup_x64.exe /quiet /norestart") else: shell(UNREALENGINE, "Engine/Build/BatchFiles/Linux/GitDependencies.sh") shell(f"{UNREALENGINE}/Engine/Build/BatchFiles/Linux", "./Setup.sh") + touch.write_text("Downloaded") def build_unrealbuildtool():