mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
fix(fex): provide current FreeType runtime libraries
This commit is contained in:
1 parent
e61090515a
commit
893aa5a517
2 files changed
+63
-2
No files matched your search
@@ -37,7 +37,7 @@ RUNTIMES = {SNIPER_APPID: ("sniper_platform_", "Steam Linux Runtime 3.0 (sniper"
|
||||
SLR4_APPID: ("steamrt4_platform_", "Steam Linux Runtime 4.0 (steamrt4")}
|
||||
MARKER = ".droiddeck-fex"
|
||||
LAYOUT = 1
|
||||
ROOTFS_LAYOUT = 3
|
||||
ROOTFS_LAYOUT = 4
|
||||
ARCH_DIRS = ("x86_64-linux-gnu", "i386-linux-gnu")
|
||||
INTERPRETERS = ("ld-linux-x86-64.so.2", "ld-linux.so.2")
|
||||
PROVIDED = frozenset((
|
||||
@@ -46,6 +46,7 @@ PROVIDED = frozenset((
|
||||
"libnss_compat.so.2", "libnss_dns.so.2", "libnss_files.so.2", "libnss_hesiod.so.2", "libthread_db.so.1",
|
||||
"libmemusage.so", "libpcprofile.so", "libc_malloc_debug.so.0", "gconv", "libstdc++.so.6", "libgcc_s.so.1",
|
||||
"libssl.so.3", "libcrypto.so.3",
|
||||
"libfreetype.so.6", "libpng16.so.16", "libbrotlidec.so.1", "libbrotlicommon.so.1", "libbz2.so.1.0", "libz.so.1",
|
||||
"libwayland-client.so.0", "libwayland-cursor.so.0", "libwayland-egl.so.1", "libwayland-server.so.0", "libffi.so.8",
|
||||
))
|
||||
GLIBC_BUILD = re.compile(r"^(?:ld|lib[A-Za-z_]+)-2\.[0-9]+\.so$|^libSegFault\.so$")
|
||||
|
||||
@@ -509,6 +509,66 @@ class PrepareTest(FexTestCase):
|
||||
fixed = subprocess.run(command, env=env, capture_output=True, text=True)
|
||||
self.assertEqual(fixed.returncode, 0, fixed.stderr)
|
||||
|
||||
def test_freetype_and_dependencies_use_the_newer_runtime_on_both_architectures(self):
|
||||
self.fex_tool()
|
||||
sniper = self.runtime()
|
||||
FEX["materialize"](str(sniper))
|
||||
provider = self.graphics(sniper)
|
||||
names = ("libfreetype.so.6", "libpng16.so.16", "libbrotlidec.so.1",
|
||||
"libbrotlicommon.so.1", "libbz2.so.1.0", "libz.so.1")
|
||||
for arch in ("x86_64-linux-gnu", "i386-linux-gnu"):
|
||||
for name in names:
|
||||
self.write(sniper / "files/lib" / arch / name, b"base")
|
||||
self.write(provider / "files/lib" / arch / name, b"new")
|
||||
fex, _ = self.quiet(FEX["prepare"])
|
||||
for arch in ("x86_64-linux-gnu", "i386-linux-gnu"):
|
||||
for name in names:
|
||||
self.assertEqual((Path(fex["rootfs"]) / "lib" / arch / name).resolve(),
|
||||
provider / "files/lib" / arch / name)
|
||||
self.assertEqual((sniper / "files/lib" / arch / name).read_bytes(), b"base")
|
||||
|
||||
@unittest.skipUnless(shutil.which("cc"), "C compiler unavailable")
|
||||
def test_bundled_library_resolves_the_new_freetype_symbol(self):
|
||||
self.fex_tool()
|
||||
sniper = self.runtime()
|
||||
FEX["materialize"](str(sniper))
|
||||
provider = self.graphics(sniper)
|
||||
base = sniper / "files/lib/x86_64-linux-gnu"
|
||||
newer = provider / "files/lib/x86_64-linux-gnu"
|
||||
source = self.tmp / "freetype.c"
|
||||
for folder, symbol in ((base, "FT_Init_FreeType"), (newer, "FT_Get_Color_Glyph_Paint")):
|
||||
source.write_text("void *%s(void) { return 0; }\n" % symbol)
|
||||
subprocess.run(["cc", "-shared", "-fPIC", "-nostdlib", "-Wl,-soname,libfreetype.so.6",
|
||||
"-o", str(folder / "libfreetype.so.6"), str(source)], check=True, capture_output=True)
|
||||
fex, _ = self.quiet(FEX["prepare"])
|
||||
root = Path(fex["rootfs"]) / "lib/x86_64-linux-gnu"
|
||||
source.write_text("extern void *FT_Get_Color_Glyph_Paint(void);\nvoid *probe(void) { return FT_Get_Color_Glyph_Paint(); }\n")
|
||||
probe = self.tmp / "libprobe.so"
|
||||
subprocess.run(["cc", "-shared", "-fPIC", "-nostdlib", "-o", str(probe), str(source),
|
||||
"-L" + str(newer), "-l:libfreetype.so.6", "-Wl,-rpath," + str(root)],
|
||||
check=True, capture_output=True)
|
||||
command = [sys.executable, "-c",
|
||||
"import ctypes,sys; "
|
||||
"ctypes.CDLL(sys.argv[2], mode=ctypes.RTLD_GLOBAL) if len(sys.argv) > 2 else None; "
|
||||
"ctypes.CDLL(sys.argv[1]).probe()", str(probe)]
|
||||
env = {k: v for k, v in os.environ.items() if not k.startswith("LD_")}
|
||||
broken = subprocess.run(command + [str(base / "libfreetype.so.6")], env=env, capture_output=True, text=True)
|
||||
self.assertNotEqual(broken.returncode, 0)
|
||||
self.assertIn("undefined symbol: FT_Get_Color_Glyph_Paint", broken.stderr)
|
||||
fixed = subprocess.run(command, env=env, capture_output=True, text=True)
|
||||
self.assertEqual(fixed.returncode, 0, fixed.stderr)
|
||||
|
||||
def test_missing_freetype_provider_keeps_base_on_both_architectures(self):
|
||||
self.fex_tool()
|
||||
sniper = self.runtime()
|
||||
FEX["materialize"](str(sniper))
|
||||
self.graphics(sniper)
|
||||
for arch in ("x86_64-linux-gnu", "i386-linux-gnu"):
|
||||
self.write(sniper / "files/lib" / arch / "libfreetype.so.6", b"base")
|
||||
fex, _ = self.quiet(FEX["prepare"])
|
||||
for arch in ("x86_64-linux-gnu", "i386-linux-gnu"):
|
||||
self.assertEqual((Path(fex["rootfs"]) / "lib" / arch / "libfreetype.so.6").read_bytes(), b"base")
|
||||
|
||||
def test_missing_provider_libraries_keep_the_base_runtime_libraries(self):
|
||||
self.fex_tool()
|
||||
sniper = self.runtime()
|
||||
@@ -523,7 +583,7 @@ class PrepareTest(FexTestCase):
|
||||
sniper = self.runtime()
|
||||
FEX["materialize"](str(sniper))
|
||||
self.graphics(sniper)
|
||||
with mock.patch.dict(G, {"ROOTFS_LAYOUT": 2}):
|
||||
with mock.patch.dict(G, {"ROOTFS_LAYOUT": 3}):
|
||||
self.quiet(FEX["prepare"])
|
||||
_, said = self.quiet(FEX["prepare"])
|
||||
self.assertIn("built the x86 runtime", said)
|
||||
|
||||
Reference in new issue
Block a user