--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Pure/System/mingw.scala Sat Oct 10 20:31:54 2020 +0200
@@ -0,0 +1,52 @@
+/* Title: Pure/System/mingw.scala
+ Author: Makarius
+
+Support for MSYS2/MinGW64 on Windows.
+*/
+
+package isabelle
+
+
+object MinGW
+{
+ val none: Context = new Context(None)
+ def context(root: Path) = new Context(Some(root))
+
+ def environment: List[(String, String)] =
+ List("PATH" -> "/usr/bin:/bin:/mingw64/bin", "CONFIG_SITE" -> "/mingw64/etc/config.site")
+
+ def environment_prefix: String =
+ (for ((a, b) <- environment) yield Bash.string(a) + "=" + Bash.string(b))
+ .mkString("/usr/bin/env ", " ", " ")
+
+ class Context private[MinGW](val root: Option[Path])
+ {
+ override def toString: String =
+ root match {
+ case None => "MinGW.none"
+ case Some(msys_root) => "MinGW.context(" + msys_root.toString + ")"
+ }
+
+ def bash_command(command: String): String =
+ root match {
+ case None => command
+ case Some(msys_root) =>
+ File.bash_path(msys_root + Path.explode("usr/bin/bash")) +
+ " -c " + Bash.string(environment_prefix + command)
+ }
+
+ def get_root: Path =
+ if (!Platform.is_windows) error("Windows platform required")
+ else if (root.isEmpty) error("Windows platform needs specification of msys root directory")
+ else root.get
+
+ def check
+ {
+ if (Platform.is_windows) {
+ get_root
+ val result = Isabelle_System.bash(bash_command("uname -s")).check
+ if (!result.out.startsWith("MSYS")) error("Bad msys installation " + get_root)
+ }
+ }
+ }
+}
--- a/src/Pure/build-jars Sat Oct 10 17:26:23 2020 +0200
+++ b/src/Pure/build-jars Sat Oct 10 20:31:54 2020 +0200
@@ -133,6 +133,7 @@
src/Pure/System/isabelle_tool.scala
src/Pure/System/java_statistics.scala
src/Pure/System/linux.scala
+ src/Pure/System/mingw.scala
src/Pure/System/numa.scala
src/Pure/System/options.scala
src/Pure/System/platform.scala