fix dll overrides & add disable UMU

This commit is contained in:
olcxja 2026-10-04 15:40:09 +02:00
commit 8c6db38fab
12 changed files with 295 additions and 45 deletions

View file

@ -16,7 +16,11 @@
//
// Everything here rewires a link to a RELATIVE path when the file it points at
// can be found locally, so the tree stays relocatable forever, and restores
// the executable bit on the binaries a wine/proton build needs.
// the executable bit on the binaries a wine/proton build needs. An absolute
// link is always rewritten; a relative one is only touched when it no longer
// resolves, because a tree that changed layout (a prefix whose contents moved
// one level up, see prefixes.ensureUnifiedPrefix) keeps relative links written
// against the old depth and every one of them breaks at once.
const fsp = require('fs').promises
const fs = require('fs')
@ -116,10 +120,11 @@ function relativeTarget(link, target, roots) {
return null
}
// Rewire every absolute symlink under `root` that can be expressed relative to
// `roots` (usually [root, DIRS.FILES]). Returns how many links changed. A link
// may only become rewirable once another link it chains through has been
// fixed, so the pass repeats until nothing changes.
// Rewire the symlinks under `root` that can be expressed relative to `roots`
// (usually [root, DIRS.FILES]): absolute ones always, relative ones only when
// they no longer resolve. Returns how many links changed. A link may only
// become rewirable once another link it chains through has been fixed, so the
// pass repeats until nothing changes.
async function rewireSymlinks(root, roots = []) {
if (!root) return 0
const candidates = [root, ...roots.filter(r => r && r !== root)]
@ -135,8 +140,13 @@ async function rewireSymlinks(root, roots = []) {
} catch {
continue
}
if (!path.isAbsolute(target)) continue // already relocatable
const next = relativeTarget(link, path.normalize(target), candidates)
const absolute = path.isAbsolute(target)
// a relative link that still resolves is already relocatable - only a
// broken one is worth touching, and the suffix search in relativeTarget
// finds the file it was pointing at before the layout changed
if (!absolute && exists(path.resolve(path.dirname(link), target))) continue
const from = absolute ? path.normalize(target) : path.resolve(path.dirname(link), target)
const next = relativeTarget(link, from, candidates)
if (!next || next === target) continue
try {
await fsp.unlink(link)