From 6ce7869ddad93459443fc4dab0287c002559f811 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Thu, 3 Sep 2026 01:54:35 +0700 Subject: [PATCH] Warn of custom rpath, fix mednafen rpath --- recipes/emulators/mednafen/recipe.toml | 2 +- src/cook/cook_build.rs | 38 ++++++++++++++------------ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/recipes/emulators/mednafen/recipe.toml b/recipes/emulators/mednafen/recipe.toml index bd51a37db..7c80cf65a 100644 --- a/recipes/emulators/mednafen/recipe.toml +++ b/recipes/emulators/mednafen/recipe.toml @@ -17,9 +17,9 @@ dependencies = [ ] script = """ DYNAMIC_INIT -export SDL_LIBS="-lSDL2 -lorbital $("${TARGET}-pkg-config" --libs osmesa) -lstdc++" COOKBOOK_CONFIGURE_FLAGS+=( --without-libflac + --disable-rpath ) cookbook_configure """ \ No newline at end of file diff --git a/src/cook/cook_build.rs b/src/cook/cook_build.rs index 39499eaf4..a820aebe8 100644 --- a/src/cook/cook_build.rs +++ b/src/cook/cook_build.rs @@ -87,23 +87,27 @@ fn auto_deps_from_dynamic_linking( let object::build::elf::Dynamic::String { tag, val } = dynamic else { continue; }; - if *tag == object::elf::DT_NEEDED { - let Ok(name) = str::from_utf8(val) else { - continue; - }; - if let Ok(relative_path) = path.strip_prefix(rel_path) - && verbose - { - log_to_pty!(logger, "DEBUG: {} needs {}", relative_path.display(), name); + let Ok(name) = str::from_utf8(val) else { + continue; + }; + let path_rel = path + .strip_prefix(rel_path) + .ok() + .filter(|_| verbose) + .map(|s| s.display()); + match *tag { + object::elf::DT_NEEDED => { + if let Some(path_rel) = path_rel { + log_to_pty!(logger, "DEBUG: {} needs {}", path_rel, name); + } + needed.insert(name.to_string()); } - needed.insert(name.to_string()); - } else { - log_to_pty!( - logger, - "DEBUG: autopath failed {} is outside {}", - path.display(), - rel_path.display() - ); + object::elf::DT_RPATH | object::elf::DT_RUNPATH => { + if let Some(path_rel) = path_rel { + log_to_pty!(logger, "DEBUG: {} uses runpath {}", path_rel, name); + } + } + _ => {} // DT_SONAME } } } @@ -148,7 +152,7 @@ fn auto_deps_from_dynamic_linking( if verbose { for name in missing { - log_to_pty!(logger, "INFO: {} missing", name); + log_to_pty!(logger, "INFO: missing {}", name); } }