uniform build of binutils for linux, linux_arm, macos;
authorwenzelm
Mon, 05 Feb 2024 12:13:35 +0100
changeset 79577 1c63babf226e
parent 79575 b21d8401f0ca
child 79578 4c4d71b00001
uniform build of binutils for linux, linux_arm, macos;
src/Pure/Admin/component_windows_app.scala
--- a/src/Pure/Admin/component_windows_app.scala	Mon Feb 05 10:06:34 2024 +0100
+++ b/src/Pure/Admin/component_windows_app.scala	Mon Feb 05 12:13:35 2024 +0100
@@ -11,7 +11,7 @@
   /* resources */
 
   def tool_platform(): String = {
-    require(Platform.is_linux, "Linux platform required")
+    require(Platform.is_unix, "Linux or macOS platform required")
     Isabelle_Platform.self.ISABELLE_PLATFORM64
   }
 
@@ -34,7 +34,6 @@
     "https://github.com/chrislake/7zsfxmm/releases/download/1.7.1.3901/7zsd_extra_171_3901.7z"
 
   def build_windows_app(
-    build_binutils: Boolean = false,
     launch4j_url: String = default_launch4j_url,
     binutils_url: String = default_binutils_url,
     sfx_url: String = default_sfx_url,
@@ -67,23 +66,21 @@
 
       /* GNU binutils */
 
-      if (build_binutils) {
-        Isabelle_System.download_file(binutils_url, download_tar, progress = progress)
-        Isabelle_System.extract(download_tar, tmp_dir, strip = true)
+      Isabelle_System.download_file(binutils_url, download_tar, progress = progress)
+      Isabelle_System.extract(download_tar, tmp_dir, strip = true)
 
-        progress.echo("Building GNU binutils for " + platform_name + " ...")
-        val build_script =
-          List("""./configure --prefix="$PWD/target" --with-windres --with-ld --target=x86_64-w64-mingw32""",
-            "make", "make install")
-        Isabelle_System.bash(build_script.mkString(" && "), cwd = tmp_dir.file,
-          progress_stdout = progress.echo(_, verbose = true),
-          progress_stderr = progress.echo(_, verbose = true)).check
+      progress.echo("Building GNU binutils for " + platform_name + " ...")
+      val build_script =
+        List("""./configure --prefix="$PWD/target" --with-windres --with-ld --target=x86_64-w64-mingw32""",
+          "make", "make install")
+      Isabelle_System.bash(build_script.mkString(" && "), cwd = tmp_dir.file,
+        progress_stdout = progress.echo(_, verbose = true),
+        progress_stderr = progress.echo(_, verbose = true)).check
 
-        for (name <- List("ld", "windres")) {
-          Isabelle_System.copy_file(
-            tmp_dir + Path.explode("target/bin") + Path.basic("x86_64-w64-mingw32-" + name),
-              platform_bin_dir + Path.basic(name))
-        }
+      for (name <- List("ld", "windres")) {
+        Isabelle_System.copy_file(
+          tmp_dir + Path.explode("target/bin") + Path.basic("x86_64-w64-mingw32-" + name),
+            platform_bin_dir + Path.basic(name))
       }
 
 
@@ -139,7 +136,6 @@
         "build windows_app component from GNU binutils and launch4j",
       Scala_Project.here,
       { args =>
-        var build_binutils = false
         var target_dir = Path.current
         var launch4j_url = default_launch4j_url
         var binutils_url = default_binutils_url
@@ -162,7 +158,6 @@
 
   Build Isabelle windows_app component from GNU binutils and launch4j.
 """,
-          "B" -> (_ => build_binutils = true),
           "D:" -> (arg => target_dir = Path.explode(arg)),
           "U:" -> (arg => launch4j_url = arg),
           "V:" -> (arg => binutils_url = arg),
@@ -174,8 +169,7 @@
 
         val progress = new Console_Progress(verbose = verbose)
 
-        build_windows_app(build_binutils = build_binutils,
-          launch4j_url = launch4j_url, binutils_url = binutils_url,
+        build_windows_app(launch4j_url = launch4j_url, binutils_url = binutils_url,
           sfx_url = sfx_url, progress = progress, target_dir = target_dir)
       })
 }