mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-25 22:15:57 +00:00
Build the setup for Linux as an AppImage.
tools/make_release_linux.py assembles the Linux release folder and packs it with the static type-2 AppImage runtime: python-build-standalone 3.14 with tkinter, LLVM 23.1.4 (clang, lld, llvm-ar) and the part of the Steam Runtime 3 sniper SDK sysroot a game build reads, so the game, hostcheck, hactool and the translator need no newer glibc than 2.31 and run on SteamOS. The game it builds needs only glibc, the system's Vulkan loader and the libSDL3.so.0 beside it; Opus, libvpx, zstd and libstdc++ are linked in. --prove builds generated/v121 with the folder alone and runs the probes. The installer runs on Linux: release and dev layouts, temp under the XDG cache (the AppImage mount is read-only), cancel through the CLI's process group, language from LANG, xdg-open and a PNG icon, texts that name the right executable, and a warning on kernels older than 6.7. hostcheck reads x86-64-v3 from CPUID, since clang's __builtin_cpu_supports reads it from libgcc, which before GCC 12 has no level bits. build_game.py takes --sysroot, build_hactool.py --cc and build_xlate.py --llvm/--sysroot; linux.c carries the Linux 6.7 write-watch definitions for older headers. Also: shader_census.py and package_build.py use the Linux executable names, and probe-shader writes its shader path with forward slashes.
This commit is contained in:
1 parent
5a84b19476
commit
29a14d69fe
18 files changed
+767
-46
No files matched your search
+29
-6
@@ -15,6 +15,7 @@ import json
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
import threading
|
||||
@@ -94,10 +95,21 @@ def kill_tree(proc):
|
||||
return
|
||||
if os.name == 'nt':
|
||||
subprocess.run(['taskkill', '/T', '/F', '/PID', str(proc.pid)], capture_output=True)
|
||||
else:
|
||||
return
|
||||
try: # run_tool starts each tool in a session of its own: the group holds ninja, clang and the game
|
||||
os.killpg(proc.pid, signal.SIGKILL)
|
||||
except OSError:
|
||||
proc.kill()
|
||||
|
||||
|
||||
def linux_kernel():
|
||||
"""(major, minor) of the running Linux kernel, None elsewhere."""
|
||||
if not sys.platform.startswith('linux'):
|
||||
return None
|
||||
m = re.match(r'(\d+)\.(\d+)', os.uname().release)
|
||||
return (int(m.group(1)), int(m.group(2))) if m else None
|
||||
|
||||
|
||||
def run_tool(ctx, step, script, args, parse=None, cwd=None):
|
||||
"""Run a tool script with the bundled Python. Its output goes to <temp>/logs/<step>-<script>.log and, line by line,
|
||||
to parse(line). Returns (exit code, log path)."""
|
||||
@@ -109,7 +121,8 @@ def run_tool(ctx, step, script, args, parse=None, cwd=None):
|
||||
env = dict(os.environ, PYTHONUNBUFFERED='1', PYTHONIOENCODING='utf-8')
|
||||
with open(log, 'w', encoding='utf-8', newline='\n') as out:
|
||||
proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=cwd or ctx.layout.root,
|
||||
env=env, text=True, encoding='utf-8', errors='replace', bufsize=1)
|
||||
env=env, text=True, encoding='utf-8', errors='replace', bufsize=1,
|
||||
start_new_session=os.name != 'nt')
|
||||
try:
|
||||
for line in proc.stdout:
|
||||
out.write(line)
|
||||
@@ -231,7 +244,11 @@ class Check(Step):
|
||||
layout, work = ctx.layout, ctx.temp / 'check'
|
||||
work.mkdir(parents=True, exist_ok=True)
|
||||
exe = work / ('hostcheck' + EXE)
|
||||
command = [str(layout.clang), '-O1', str(HOSTCHECK), '-I', str(layout.deps / 'include'), '-o', str(exe)]
|
||||
command = [str(layout.clang), '-O1', str(HOSTCHECK), '-o', str(exe)]
|
||||
if layout.deps:
|
||||
command += ['-I', str(layout.deps / 'include')]
|
||||
if layout.sysroot:
|
||||
command += [f'--sysroot={layout.sysroot}', '-fuse-ld=lld']
|
||||
if os.name != 'nt':
|
||||
command.append('-ldl')
|
||||
r = subprocess.run(command, capture_output=True, text=True, errors='replace')
|
||||
@@ -254,6 +271,11 @@ class Check(Step):
|
||||
if not any(tuple(d['api'][:2]) >= (1, 3) for d in devices):
|
||||
raise InstallError('check.vulkan_too_old',
|
||||
devices=', '.join(f'{d["name"]} ({d["api"][0]}.{d["api"][1]})' for d in devices))
|
||||
kernel = linux_kernel()
|
||||
if kernel and kernel < (6, 7):
|
||||
# Without userfaultfd's asynchronous write protection nothing tracks the CPU's writes: the game copies whole
|
||||
# pools to the GPU at each submit and its texture checks see every page as changed (docs/building.md, Linux)
|
||||
ctx.reporter.warning('warn.kernel_old', version='.'.join(map(str, kernel)))
|
||||
ctx.host = host
|
||||
|
||||
def inputs(self, ctx):
|
||||
@@ -532,8 +554,8 @@ class Compile(Step):
|
||||
layout = ctx.layout
|
||||
clang = subprocess.run([str(layout.clang), '--version'], capture_output=True, text=True).stdout
|
||||
tools = [layout.tools / n for n in ('build_game.py', 'romfs_index.py', 'check_content.py')]
|
||||
return fingerprint('compile-1', ctx.keys['lift'], layout.runtime, layout.runtime_lib, layout.deps, *tools,
|
||||
clang, *[d.name for d in layout.dlls])
|
||||
return fingerprint('compile-1', ctx.keys['lift'], layout.runtime, layout.runtime_lib, layout.deps or 'system',
|
||||
layout.sysroot or 'host', *tools, clang, *[d.name for d in layout.dlls])
|
||||
|
||||
def current(self, ctx, record):
|
||||
exe = ctx.dest / ('totk' + EXE)
|
||||
@@ -558,7 +580,8 @@ class Compile(Step):
|
||||
|
||||
rep.progress('compile', 'compile', force=True)
|
||||
code, log = run_tool(ctx, 'compile', layout.tools / 'build_game.py', [
|
||||
'--gen', ctx.temp / 'gen', '--out', build, '--toolchain', layout.llvm, '--deps', layout.deps,
|
||||
'--gen', ctx.temp / 'gen', '--out', build, '--toolchain', layout.llvm,
|
||||
*(['--deps', layout.deps] if layout.deps else []), *(['--sysroot', layout.sysroot] if layout.sysroot else []),
|
||||
'--runtime', layout.runtime, '--runtime-lib', layout.runtime_lib, '--ninja', layout.ninja,
|
||||
'--version', version_tag(game_version(ctx)), '--expected', layout.expected(game_version(ctx)),
|
||||
'--exefs', dest / 'exefs', '--romfs', dest / 'romfs',
|
||||
|
||||
Reference in new issue
Block a user