Skip to content

Commit 37c7231

Browse files
committed
ci(preview): force transitive Linux runtime rpath
1 parent d20bbed commit 37c7231

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

scripts/stage-gstreamer-bundle.cjs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,18 +296,22 @@ function patchLinuxRuntimeRpaths(binaryDir, manifest, libTriplet) {
296296
for (const entry of fs.readdirSync(binaryDir, { withFileTypes: true })) {
297297
const filePath = path.join(binaryDir, entry.name);
298298
if (entry.isFile() && isElfFile(filePath)) {
299-
run('patchelf', ['--set-rpath', executableRpath, filePath]);
299+
setLinuxRpath(filePath, executableRpath);
300300
}
301301
}
302302

303303
patchElfTree(manifest.libDir, '$ORIGIN:$ORIGIN/..:$ORIGIN/../..:$ORIGIN/../../..');
304304
patchElfTree(manifest.pluginDir, '$ORIGIN/..');
305305
patchElfTree(manifest.binDir, `$ORIGIN/../lib/${libTriplet}`);
306306
if (isElfFile(manifest.scannerPath)) {
307-
run('patchelf', ['--set-rpath', `$ORIGIN/../../lib/${libTriplet}`, manifest.scannerPath]);
307+
setLinuxRpath(manifest.scannerPath, `$ORIGIN/../../lib/${libTriplet}`);
308308
}
309309
}
310310

311+
function setLinuxRpath(filePath, rpath) {
312+
run('patchelf', ['--force-rpath', '--set-rpath', rpath, filePath]);
313+
}
314+
311315
function patchElfTree(root, rpath) {
312316
if (!fs.existsSync(root)) {
313317
return;
@@ -319,7 +323,7 @@ function patchElfTree(root, rpath) {
319323
continue;
320324
}
321325
if (entry.isFile() && isElfFile(entryPath)) {
322-
run('patchelf', ['--set-rpath', rpath, entryPath]);
326+
setLinuxRpath(entryPath, rpath);
323327
}
324328
}
325329
}

scripts/verify-gstreamer-runtime.cjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,10 @@ function verifyLinux({ binaryDir }) {
338338
if (rpath.includes('.cache/gstreamer')) {
339339
throw new Error(`Linux binary still includes build-cache GStreamer RPATH: ${binary}\n${rpath}`);
340340
}
341+
const dynamicTags = run('readelf', ['-d', binary]);
342+
if (!dynamicTags.includes('(RPATH)')) {
343+
throw new Error(`Linux binary uses non-transitive RUNPATH instead of bundled RPATH: ${binary}`);
344+
}
341345

342346
const output = run('ldd', [binary], {
343347
env: {

0 commit comments

Comments
 (0)