# HG changeset patch # User wenzelm # Date 1602598628 -7200 # Node ID e79294c4230c9d85ef5350edb77fcc13d2b0508b # Parent b44e894796d5160642338720642d94768908a274 more portable; tuned; diff -r b44e894796d5 -r e79294c4230c src/Pure/System/executable.scala --- a/src/Pure/System/executable.scala Mon Oct 12 18:59:44 2020 +0200 +++ b/src/Pure/System/executable.scala Tue Oct 13 16:17:08 2020 +0200 @@ -9,11 +9,12 @@ object Executable { - def libraries_closure(exe_path0: Path, + def libraries_closure(path: Path, mingw: MinGW = MinGW.none, - filter: String => Boolean = _ => true): List[String] = + filter: String => Boolean = _ => true, + patchelf: Boolean = false): List[String] = { - val exe_path = exe_path0.expand + val exe_path = path.expand val exe_dir = exe_path.dir val exe = exe_path.base @@ -51,8 +52,16 @@ libs.foreach(lib => File.copy(Path.explode(lib), exe_dir)) if (Platform.is_linux) { - // requires "LDFLAGS=-Wl,-rpath,_DUMMY_" - Isabelle_System.bash("chrpath -r '$ORIGIN' " + File.bash_path(exe_path)).check + if (patchelf) { + // requires e.g. Ubuntu 16.04 LTS + Isabelle_System.require_command("patchelf") + Isabelle_System.bash("patchelf --force-rpath --set-rpath '$ORIGIN' " + File.bash_path(exe_path)).check + } + else { + // requires e.g. LDFLAGS=-Wl,-rpath,_DUMMY_ + Isabelle_System.require_command("chrpath") + Isabelle_System.bash("chrpath -r '$ORIGIN' " + File.bash_path(exe_path)).check + } } else if (Platform.is_macos) { val script =