mirror of
https://github.com/goodpuppies/petplay.git
synced 2026-10-23 17:00:51 +02:00
Pin raylib 5.5 and Zig 0.13.0, verify the source archive and patch the upstream build to support external GLFW and cross-target library paths. Build on the ARM runner and boot the compiled executable under software GL to verify the bundled library, render texture, scene and capture helper. Agent: Codex 0.163.0; model gpt-6.1-sol; thread 01a145fa-213b-7510-83c0-48dd3e275c9a
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
import { fromFileUrl } from "@std/path";
|
|
|
|
function firstExisting(candidates: string[]): string | null {
|
|
for (const candidate of candidates) {
|
|
try {
|
|
if (Deno.statSync(candidate).isFile) return candidate;
|
|
} catch {
|
|
// Continue through platform/runtime-specific candidates.
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
export function getOpenVrLibraryPath(base: string | URL = import.meta.url): string {
|
|
const override = Deno.env.get("PETPLAY_OPENVR_LIBRARY");
|
|
if (override) return override;
|
|
if (Deno.build.os === "windows") {
|
|
return fromFileUrl(new URL("../resources/openvr_api.dll", base));
|
|
}
|
|
const steamVrArch = Deno.build.arch === "aarch64" ? "linuxarm64" : "linux64";
|
|
return firstExisting([
|
|
"/usr/lib/libopenvr_api.so",
|
|
`/opt/steamvr/bin/${steamVrArch}/libopenvr_api.so`,
|
|
`${
|
|
Deno.env.get("HOME") ?? ""
|
|
}/.local/share/Steam/steamapps/common/SteamVR/bin/${steamVrArch}/libopenvr_api.so`,
|
|
]) ?? "libopenvr_api.so";
|
|
}
|
|
|
|
export function getRaylibLibraryPath(base: string | URL = import.meta.url): string {
|
|
const override = Deno.env.get("PETPLAY_RAYLIB_LIBRARY");
|
|
if (override) return override;
|
|
if (Deno.build.os === "windows") {
|
|
return fromFileUrl(new URL("../resources/raylib.dll", base));
|
|
}
|
|
return firstExisting([
|
|
fromFileUrl(
|
|
new URL(
|
|
Deno.build.arch === "aarch64"
|
|
? "../dist/native/aarch64-unknown-linux-gnu/libraylib.so"
|
|
: "../resources/libraylib.so",
|
|
base,
|
|
),
|
|
),
|
|
"/usr/lib/libraylib.so",
|
|
"/usr/local/lib/libraylib.so",
|
|
]) ?? "libraylib.so";
|
|
}
|