Modify build system to properly handle unreal version upgrades

This commit is contained in:
2025-09-08 16:42:16 -04:00
parent 6e358c7eb9
commit 3b0ec0d72b
3 changed files with 34 additions and 28 deletions

View File

@@ -11,10 +11,7 @@ SOFTWARE YOU WILL NEED
Before attempting anything, install the following software: Before attempting anything, install the following software:
apt-get install git-lfs apt-get install git-lfs code dotnet6 clangd-15
apt-get install code
apt-get install dotnet6
apt-get install clangd-15 or better.
Everything else you need should be included in PopOS. If that's Everything else you need should be included in PopOS. If that's
not the case, let me know. not the case, let me know.
@@ -22,22 +19,11 @@ not the case, let me know.
GETTING THE CODE GETTING THE CODE
You will need to clone two git repositories: You will need to clone our repository:
cd $HOME cd $HOME
git clone https://github.com/EpicGames/UnrealEngine.git
git clone https://www.gnaut.com/team/integration.git git clone https://www.gnaut.com/team/integration.git
The two clone commands above are a simplification. In reality,
cloning these two repositories will require you to jump through
some hoops to get access from Epic Games. Follow the steps to
get access from Epic's website, but only go as far as cloning
the repository. Once the repository is cloned, we will take it
from there with our own "build.py".
It is important that these two repositories be located
at $HOME/UnrealEngine and $HOME/integration.
HOW TO BUILD THE FIRST TIME HOW TO BUILD THE FIRST TIME

View File

@@ -51,6 +51,20 @@ def read_if_exists(fn):
try: return Path(fn).read_text() try: return Path(fn).read_text()
except: return "" except: return ""
#
# Fix a chmod bug in the Zipfile module.
#
class JZipFile(zipfile.ZipFile):
def _extract_member(self, member, targetpath, pwd):
if not isinstance(member, zipfile.ZipInfo):
member = self.getinfo(member)
targetpath = super()._extract_member(member, targetpath, pwd)
attr = member.external_attr >> 16
if attr != 0:
os.chmod(targetpath, attr)
return targetpath
# #
# A JSON preprocessor. # A JSON preprocessor.
# #
@@ -191,20 +205,26 @@ def unzip_unreal_engine_and_apply_patch():
""" """
Unzip the unreal engine source, then apply a patch. Unzip the unreal engine source, then apply a patch.
""" """
if not Path(UNREALENGINE).is_dir(): zips = list(Path(INTEGRATION).glob("UnrealEngine-*-release.zip"))
zipfn = f"{INTEGRATION}/UnrealEngine.zip"; if len(zips) == 0:
with zipfile.ZipFile(zipfn, 'r') as z: sys.exit("Cannot find UnrealEngine-*-release.zip")
version = z.namelist()[0].split('/')[0] if len(zips) > 1:
if not fnmatch.fnmatch(version, 'UnrealEngine-*-release'): sys.exit("Found multiple files matching UnrealEngine-*-release.zip")
sys.exit("UnrealEngine.zip does not contain UnrealEngine-*-release") print("Unreal version: ", zips[0].stem)
unrealversion = os.path.join(INTEGRATION, version) zipfn = os.path.join(INTEGRATION, zips[0].name)
extracted = os.path.join(INTEGRATION, zips[0].stem)
touchfile = os.path.join(UNREALENGINE, zips[0].stem)
if not Path(touchfile).is_file():
print("Removing old version of unreal engine source...")
shutil.rmtree(UNREALENGINE, ignore_errors=True) shutil.rmtree(UNREALENGINE, ignore_errors=True)
shutil.rmtree(unrealversion, ignore_errors=True) shutil.rmtree(extracted, ignore_errors=True)
print("Unzipping UnrealEngine.zip...") print(f"Unzipping {zipfn}...")
shell(INTEGRATION, "unzip -q UnrealEngine.zip") with JZipFile(zipfn) as zf:
zf.extractall(INTEGRATION)
patchfile = f"{INTEGRATION}/EnginePatches/EnginePatch" patchfile = f"{INTEGRATION}/EnginePatches/EnginePatch"
shell(unrealversion, f"patch -p1 < {patchfile}") shell(extracted, f"patch -p1 < {patchfile}")
Path(unrealversion).rename(UNREALENGINE) Path(extracted).rename(UNREALENGINE)
Path(touchfile).touch()
def generate_buildconfiguration_xml(): def generate_buildconfiguration_xml():