src/Pure/Admin/build_polyml.scala
author wenzelm
Sat, 12 Nov 2016 17:00:26 +0100
changeset 64504 e4707c2655eb
parent 64503 365021be3c5b
child 64505 545a7ab3c35f
permissions -rw-r--r--
clarified msys root; proper copy_files;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
     1
/*  Title:      Pure/Admin/build_polyml.scala
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
     3
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
     4
Build Poly/ML from sources.
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
     5
*/
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
     6
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
     7
package isabelle
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
     8
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
     9
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    10
object Build_PolyML
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    11
{
64496
wenzelm
parents: 64495
diff changeset
    12
  /** build_polyml **/
wenzelm
parents: 64495
diff changeset
    13
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    14
  sealed case class Platform_Info(
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    15
    options: List[String] = Nil,
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    16
    options_multilib: List[String] = Nil,
64487
b843bcdd40f0 more precise environment (for Windows);
wenzelm
parents: 64486
diff changeset
    17
    setup: String = "",
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    18
    copy_files: List[String] = Nil)
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    19
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    20
  private val platform_info = Map(
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    21
    "x86-linux" ->
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    22
      Platform_Info(
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    23
        options_multilib =
64484
784e28e4dc57 proper options;
wenzelm
parents: 64483
diff changeset
    24
          List("--build=i386", "CFLAGS=-m32 -O3", "CXXFLAGS=-m32 -O3", "CCASFLAGS=-m32")),
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    25
    "x86_64-linux" -> Platform_Info(),
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    26
    "x86-darwin" ->
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    27
      Platform_Info(
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    28
        options =
64484
784e28e4dc57 proper options;
wenzelm
parents: 64483
diff changeset
    29
          List("--build=i686-darwin", "CFLAGS=-arch i686 -O3 -I../libffi/include",
784e28e4dc57 proper options;
wenzelm
parents: 64483
diff changeset
    30
            "CXXFLAGS=-arch i686 -O3 -I../libffi/include", "CCASFLAGS=-arch i686 -O3",
64503
365021be3c5b clarified setup: avoid alternative C compiler tools, e.g. from Homebrew or MacPorts;
wenzelm
parents: 64502
diff changeset
    31
            "LDFLAGS=-segprot POLY rwx rwx"),
365021be3c5b clarified setup: avoid alternative C compiler tools, e.g. from Homebrew or MacPorts;
wenzelm
parents: 64502
diff changeset
    32
        setup = "PATH=/usr/bin:/bin:/usr/sbin:/sbin"),
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    33
    "x86_64-darwin" ->
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    34
      Platform_Info(
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    35
        options =
64484
784e28e4dc57 proper options;
wenzelm
parents: 64483
diff changeset
    36
          List("--build=x86_64-darwin", "CFLAGS=-arch x86_64 -O3 -I../libffi/include",
784e28e4dc57 proper options;
wenzelm
parents: 64483
diff changeset
    37
            "CXXFLAGS=-arch x86_64 -O3 -I../libffi/include", "CCASFLAGS=-arch x86_64",
64503
365021be3c5b clarified setup: avoid alternative C compiler tools, e.g. from Homebrew or MacPorts;
wenzelm
parents: 64502
diff changeset
    38
            "LDFLAGS=-segprot POLY rwx rwx"),
365021be3c5b clarified setup: avoid alternative C compiler tools, e.g. from Homebrew or MacPorts;
wenzelm
parents: 64502
diff changeset
    39
        setup = "PATH=/usr/bin:/bin:/usr/sbin:/sbin"),
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    40
    "x86-windows" ->
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    41
      Platform_Info(
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    42
        options =
64484
784e28e4dc57 proper options;
wenzelm
parents: 64483
diff changeset
    43
          List("--host=i686-w32-mingw32", "CPPFLAGS=-I/mingw32/include", "--disable-windows-gui"),
64494
979520c83f30 proper CONFIG_SITE for msys;
wenzelm
parents: 64493
diff changeset
    44
        setup =
979520c83f30 proper CONFIG_SITE for msys;
wenzelm
parents: 64493
diff changeset
    45
          """PATH=/usr/bin:/bin:/mingw32/bin
979520c83f30 proper CONFIG_SITE for msys;
wenzelm
parents: 64493
diff changeset
    46
            export CONFIG_SITE=/etc/config.site""",
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    47
        copy_files =
64504
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    48
          List("$MSYS/mingw32/bin/libgcc_s_dw2-1.dll",
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    49
            "$MSYS/mingw32/bin/libgmp-10.dll",
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    50
            "$MSYS/mingw32/bin/libstdc++-6.dll")),
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    51
    "x86_64-windows" ->
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    52
      Platform_Info(
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    53
        options =
64484
784e28e4dc57 proper options;
wenzelm
parents: 64483
diff changeset
    54
          List("--host=x86_64-w64-mingw32", "CPPFLAGS=-I/mingw64/include", "--disable-windows-gui"),
64494
979520c83f30 proper CONFIG_SITE for msys;
wenzelm
parents: 64493
diff changeset
    55
        setup =
979520c83f30 proper CONFIG_SITE for msys;
wenzelm
parents: 64493
diff changeset
    56
          """PATH=/usr/bin:/bin:/mingw64/bin
979520c83f30 proper CONFIG_SITE for msys;
wenzelm
parents: 64493
diff changeset
    57
            export CONFIG_SITE=/etc/config.site""",
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    58
        copy_files =
64504
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    59
          List("$MSYS/mingw64/bin/libgcc_s_seh-1.dll",
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    60
            "$MSYS/mingw64/bin/libgmp-10.dll",
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    61
            "$MSYS/mingw64/bin/libstdc++-6.dll")))
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    62
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    63
  def build_polyml(
64489
db1bc2732554 clarified command-line;
wenzelm
parents: 64488
diff changeset
    64
    root: Path,
64495
754e1b4634c3 build sha1 library;
wenzelm
parents: 64494
diff changeset
    65
    sha1_root: Option[Path] = None,
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    66
    progress: Progress = Ignore_Progress,
64493
a2eebcc8bb69 clarified platform selection;
wenzelm
parents: 64492
diff changeset
    67
    arch_64: Boolean = false,
64485
e996c0a5eca9 support other bash executable (notably for msys on Windows);
wenzelm
parents: 64484
diff changeset
    68
    options: List[String] = Nil,
64504
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    69
    msys_root: Option[Path] = None)
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    70
  {
64489
db1bc2732554 clarified command-line;
wenzelm
parents: 64488
diff changeset
    71
    if (!((root + Path.explode("configure")).is_file && (root + Path.explode("PolyML")).is_dir))
db1bc2732554 clarified command-line;
wenzelm
parents: 64488
diff changeset
    72
      error("Bad Poly/ML root directory: " + root)
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    73
64493
a2eebcc8bb69 clarified platform selection;
wenzelm
parents: 64492
diff changeset
    74
    val platform =
a2eebcc8bb69 clarified platform selection;
wenzelm
parents: 64492
diff changeset
    75
      (if (arch_64) "x86_64" else "x86") +
a2eebcc8bb69 clarified platform selection;
wenzelm
parents: 64492
diff changeset
    76
      (if (Platform.is_windows) "-windows" else if (Platform.is_macos) "-darwin" else "-linux")
a2eebcc8bb69 clarified platform selection;
wenzelm
parents: 64492
diff changeset
    77
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    78
    val info =
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    79
      platform_info.get(platform) getOrElse
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    80
        error("Bad platform identifier: " + quote(platform))
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
    81
64504
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    82
    val settings =
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    83
      msys_root match {
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    84
        case None if Platform.is_windows =>
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    85
          error("Windows requires specification of msys root directory")
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    86
        case None => Isabelle_System.settings()
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    87
        case Some(msys) => Isabelle_System.settings() + ("MSYS" -> msys.expand.implode)
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    88
      }
64492
98215fa4f8d1 more robust Windows platform;
wenzelm
parents: 64491
diff changeset
    89
64491
6a1a1bbfcb93 copy libgmp on Linux;
wenzelm
parents: 64490
diff changeset
    90
64495
754e1b4634c3 build sha1 library;
wenzelm
parents: 64494
diff changeset
    91
    /* bash */
754e1b4634c3 build sha1 library;
wenzelm
parents: 64494
diff changeset
    92
64504
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    93
    def bash(
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    94
      cwd: Path, script: String, redirect: Boolean = false, echo: Boolean = false): Process_Result =
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    95
    {
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    96
      val script1 =
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    97
        msys_root match {
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    98
          case None => script
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
    99
          case Some(msys) =>
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
   100
            File.bash_path(msys + Path.explode("usr/bin/bash")) + " -c " + Bash.string(script)
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
   101
        }
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
   102
      progress.bash(script1, cwd = cwd.file, redirect = redirect, echo = echo)
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
   103
    }
64495
754e1b4634c3 build sha1 library;
wenzelm
parents: 64494
diff changeset
   104
754e1b4634c3 build sha1 library;
wenzelm
parents: 64494
diff changeset
   105
64491
6a1a1bbfcb93 copy libgmp on Linux;
wenzelm
parents: 64490
diff changeset
   106
    /* configure and make */
6a1a1bbfcb93 copy libgmp on Linux;
wenzelm
parents: 64490
diff changeset
   107
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
   108
    val configure_options =
64493
a2eebcc8bb69 clarified platform selection;
wenzelm
parents: 64492
diff changeset
   109
      (if (!arch_64 && Isabelle_System.getenv("ISABELLE_PLATFORM64") == "x86_64-linux")
a2eebcc8bb69 clarified platform selection;
wenzelm
parents: 64492
diff changeset
   110
        info.options_multilib
a2eebcc8bb69 clarified platform selection;
wenzelm
parents: 64492
diff changeset
   111
       else info.options) ::: List("--enable-intinf-as-int") ::: options
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
   112
64495
754e1b4634c3 build sha1 library;
wenzelm
parents: 64494
diff changeset
   113
    bash(root,
64487
b843bcdd40f0 more precise environment (for Windows);
wenzelm
parents: 64486
diff changeset
   114
      info.setup + "\n" +
64485
e996c0a5eca9 support other bash executable (notably for msys on Windows);
wenzelm
parents: 64484
diff changeset
   115
      """
e996c0a5eca9 support other bash executable (notably for msys on Windows);
wenzelm
parents: 64484
diff changeset
   116
        [ -f Makefile ] && make distclean
e996c0a5eca9 support other bash executable (notably for msys on Windows);
wenzelm
parents: 64484
diff changeset
   117
        {
e996c0a5eca9 support other bash executable (notably for msys on Windows);
wenzelm
parents: 64484
diff changeset
   118
          ./configure --prefix="$PWD/target" """ + Bash.strings(configure_options) + """
e996c0a5eca9 support other bash executable (notably for msys on Windows);
wenzelm
parents: 64484
diff changeset
   119
          rm -rf target
e996c0a5eca9 support other bash executable (notably for msys on Windows);
wenzelm
parents: 64484
diff changeset
   120
          make compiler && make compiler && make install
e996c0a5eca9 support other bash executable (notably for msys on Windows);
wenzelm
parents: 64484
diff changeset
   121
        } || { echo "Build failed" >&2; exit 2; }
64501
234571db1b90 tuned output;
wenzelm
parents: 64500
diff changeset
   122
      """, redirect = true, echo = true).check
64485
e996c0a5eca9 support other bash executable (notably for msys on Windows);
wenzelm
parents: 64484
diff changeset
   123
64495
754e1b4634c3 build sha1 library;
wenzelm
parents: 64494
diff changeset
   124
    val ldd_files =
64493
a2eebcc8bb69 clarified platform selection;
wenzelm
parents: 64492
diff changeset
   125
      if (Platform.is_linux) {
64495
754e1b4634c3 build sha1 library;
wenzelm
parents: 64494
diff changeset
   126
        val libs = bash(root, "ldd target/bin/poly").check.out_lines
64491
6a1a1bbfcb93 copy libgmp on Linux;
wenzelm
parents: 64490
diff changeset
   127
        val Pattern = """\s*libgmp.*=>\s*(\S+).*""".r
6a1a1bbfcb93 copy libgmp on Linux;
wenzelm
parents: 64490
diff changeset
   128
        for (Pattern(lib) <- libs) yield lib
6a1a1bbfcb93 copy libgmp on Linux;
wenzelm
parents: 64490
diff changeset
   129
      }
6a1a1bbfcb93 copy libgmp on Linux;
wenzelm
parents: 64490
diff changeset
   130
      else Nil
6a1a1bbfcb93 copy libgmp on Linux;
wenzelm
parents: 64490
diff changeset
   131
6a1a1bbfcb93 copy libgmp on Linux;
wenzelm
parents: 64490
diff changeset
   132
64495
754e1b4634c3 build sha1 library;
wenzelm
parents: 64494
diff changeset
   133
    /* sha1 library */
754e1b4634c3 build sha1 library;
wenzelm
parents: 64494
diff changeset
   134
754e1b4634c3 build sha1 library;
wenzelm
parents: 64494
diff changeset
   135
    val sha1_files =
754e1b4634c3 build sha1 library;
wenzelm
parents: 64494
diff changeset
   136
      if (sha1_root.isDefined) {
754e1b4634c3 build sha1 library;
wenzelm
parents: 64494
diff changeset
   137
        val dir1 = sha1_root.get
64501
234571db1b90 tuned output;
wenzelm
parents: 64500
diff changeset
   138
        bash(dir1, "./build " + platform, redirect = true, echo = true).check
64495
754e1b4634c3 build sha1 library;
wenzelm
parents: 64494
diff changeset
   139
        val dir2 = dir1 + Path.explode(platform)
754e1b4634c3 build sha1 library;
wenzelm
parents: 64494
diff changeset
   140
        File.read_dir(dir2).map(entry => dir2.implode + "/" + entry)
754e1b4634c3 build sha1 library;
wenzelm
parents: 64494
diff changeset
   141
      }
754e1b4634c3 build sha1 library;
wenzelm
parents: 64494
diff changeset
   142
      else Nil
754e1b4634c3 build sha1 library;
wenzelm
parents: 64494
diff changeset
   143
754e1b4634c3 build sha1 library;
wenzelm
parents: 64494
diff changeset
   144
64491
6a1a1bbfcb93 copy libgmp on Linux;
wenzelm
parents: 64490
diff changeset
   145
    /* target */
64484
784e28e4dc57 proper options;
wenzelm
parents: 64483
diff changeset
   146
784e28e4dc57 proper options;
wenzelm
parents: 64483
diff changeset
   147
    val target = Path.explode(platform)
64488
bc77e19aad44 no backup of generated stuff;
wenzelm
parents: 64487
diff changeset
   148
    Isabelle_System.rm_tree(target)
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
   149
    Isabelle_System.mkdirs(target)
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
   150
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
   151
    for {
64484
784e28e4dc57 proper options;
wenzelm
parents: 64483
diff changeset
   152
      d <- List("target/bin", "target/lib")
64489
db1bc2732554 clarified command-line;
wenzelm
parents: 64488
diff changeset
   153
      dir = root + Path.explode(d)
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
   154
      entry <- File.read_dir(dir)
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
   155
    } File.move(dir + Path.explode(entry), target)
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
   156
64495
754e1b4634c3 build sha1 library;
wenzelm
parents: 64494
diff changeset
   157
    for (file <- "~~/Admin/polyml/polyi" :: info.copy_files ::: ldd_files ::: sha1_files)
64504
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
   158
      File.copy(Path.explode(file).expand_env(settings), target)
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
   159
  }
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
   160
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
   161
64496
wenzelm
parents: 64495
diff changeset
   162
64500
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   163
  /** Isabelle tool wrapper **/
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
   164
64500
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   165
  val isabelle_tool = Isabelle_Tool("build_polyml", "build Poly/ML from sources", args =>
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   166
    {
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   167
      Command_Line.tool0 {
64504
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
   168
        var msys_root: Option[Path] = None
64500
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   169
        var arch_64 = false
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   170
        var sha1_root: Option[Path] = None
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
   171
64500
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   172
        val getopts = Getopts("""
64489
db1bc2732554 clarified command-line;
wenzelm
parents: 64488
diff changeset
   173
Usage: isabelle build_polyml [OPTIONS] ROOT [CONFIGURE_OPTIONS]
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
   174
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
   175
  Options are:
64504
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
   176
    -M DIR       msys root directory (for Windows)
64493
a2eebcc8bb69 clarified platform selection;
wenzelm
parents: 64492
diff changeset
   177
    -m ARCH      processor architecture (32=x86, 64=x86_64, default: x86)
64499
wenzelm
parents: 64496
diff changeset
   178
    -s DIR       sha1 sources, see https://bitbucket.org/isabelle_project/sha1
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
   179
64499
wenzelm
parents: 64496
diff changeset
   180
  Build Poly/ML in the ROOT directory of its sources, with additional
64489
db1bc2732554 clarified command-line;
wenzelm
parents: 64488
diff changeset
   181
  CONFIGURE_OPTIONS (e.g. --with-gmp).
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
   182
""",
64504
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
   183
          "M:" -> (arg => msys_root = Some(Path.explode(arg))),
64500
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   184
          "m:" ->
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   185
            {
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   186
              case "32" | "x86" => arch_64 = false
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   187
              case "64" | "x86_64" => arch_64 = true
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   188
              case bad => error("Bad processor architecture: " + quote(bad))
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   189
            },
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   190
          "s:" -> (arg => sha1_root = Some(Path.explode(arg))))
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
   191
64500
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   192
        val more_args = getopts(args)
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   193
        val (root, options) =
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   194
          more_args match {
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   195
            case root :: options => (Path.explode(root), options)
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   196
            case Nil => getopts.usage()
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   197
          }
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   198
        build_polyml(root, sha1_root = sha1_root, progress = new Console_Progress,
64504
e4707c2655eb clarified msys root;
wenzelm
parents: 64503
diff changeset
   199
          arch_64 = arch_64, options = options, msys_root = msys_root)
64500
159ea1055b39 back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents: 64499
diff changeset
   200
      }
64502
271e98c1fa40 proper admin tool;
wenzelm
parents: 64501
diff changeset
   201
    }, admin = true)
64483
bba1d341bdf6 build_polyml in Scala;
wenzelm
parents:
diff changeset
   202
}