--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Pure/System/executable.scala Sun Oct 11 22:26:55 2020 +0200
@@ -0,0 +1,38 @@
+/* Title: Pure/System/executable.scala
+ Author: Makarius
+
+Support for platform-specific executables.
+*/
+
+package isabelle
+
+
+object Executable
+{
+ def libraries(path: Path, mingw: MinGW = MinGW.none): List[Path] =
+ {
+ val path1 = path.expand
+ val dir = path1.dir
+ val exe = path1.base
+
+ def command_output(cmd: String): List[String] =
+ {
+ val script = mingw.bash_script(cmd + " " + File.bash_path(exe))
+ Library.split_lines(Isabelle_System.bash(script, cwd = dir.file).check.out)
+ }
+
+ if (Platform.is_macos) {
+ val Pattern = """^\s*(.+)\s+\(.*\)$""".r
+ for { Pattern(a) <- command_output("otool -L") } yield {
+ Library.try_unprefix("@executable_path/", a) match {
+ case None => Path.explode(a)
+ case Some(b) => dir + Path.explode(b)
+ }
+ }
+ }
+ else {
+ val Pattern = """^.*=>\s*(.+)\s+\(.*\)$""".r
+ for { Pattern(a) <- command_output("ldd") } yield Path.explode(a)
+ }
+ }
+}
--- a/src/Pure/build-jars Sun Oct 11 18:46:44 2020 +0100
+++ b/src/Pure/build-jars Sun Oct 11 22:26:55 2020 +0200
@@ -125,6 +125,7 @@
src/Pure/System/command_line.scala
src/Pure/System/cygwin.scala
src/Pure/System/distribution.scala
+ src/Pure/System/executable.scala
src/Pure/System/getopts.scala
src/Pure/System/isabelle_charset.scala
src/Pure/System/isabelle_fonts.scala