src/Pure/Admin/component_hol_light.scala
author wenzelm
Sat, 18 Jan 2025 22:29:47 +0100
changeset 81918 deb6cb34a37f
parent 81917 50cd5037aff7
child 81920 8d5989ab1e42
permissions -rw-r--r--
clarified patches;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
81834
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
     1
/*  Title:      Pure/Admin/component_hol_light.scala
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
     3
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
     4
Build component for HOL-Light, with export of facts and proofs, offline
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
     5
optimization, and import to Isabelle/HOL.
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
     6
*/
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
     7
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
     8
package isabelle
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
     9
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    10
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    11
object Component_HOL_Light {
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    12
  /* resources */
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    13
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    14
  val default_hol_light_url = "https://github.com/jrh13/hol-light.git"
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    15
  val default_hol_light_rev = "Release-3.0.0"
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    16
81915
02e107686442 move material from https://gitlab.inria.fr/hol-light-isabelle/hol-light 72b2b702eadb and https://gitlab.inria.fr/hol-light-isabelle/import ce58755b0232 into Isabelle repository: results from running "isabelle component_hol_light_import" of previous version;
wenzelm
parents: 81834
diff changeset
    17
  val hol_import_dir: Path = Path.explode("~~/src/HOL/Import")
81834
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    18
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    19
  def build_hol_light_import(
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    20
    only_offline: Boolean = false,
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    21
    progress: Progress = new Progress,
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    22
    target_dir: Path = Path.current,
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    23
    hol_light_url: String = default_hol_light_url,
81915
02e107686442 move material from https://gitlab.inria.fr/hol-light-isabelle/hol-light 72b2b702eadb and https://gitlab.inria.fr/hol-light-isabelle/import ce58755b0232 into Isabelle repository: results from running "isabelle component_hol_light_import" of previous version;
wenzelm
parents: 81834
diff changeset
    24
    hol_light_rev: String = default_hol_light_rev
81834
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    25
  ): Unit = {
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    26
    /* system */
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    27
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    28
    if (!only_offline) {
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    29
      Linux.check_system()
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    30
      Isabelle_System.require_command("buffer", test = "-i /dev/null")
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    31
      Isabelle_System.require_command("patch")
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    32
    }
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    33
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    34
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    35
    /* component */
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    36
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    37
    val component_name = "hol_light_import-" + Date.Format.alt_date(Date.now())
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    38
    val component_dir = Components.Directory(target_dir + Path.basic(component_name)).create()
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    39
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    40
    val platform = Isabelle_Platform.self.ISABELLE_PLATFORM(windows = true, apple = true)
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    41
    val platform_dir = Isabelle_System.make_directory(component_dir.path + Path.basic(platform))
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    42
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    43
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    44
    /* settings */
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    45
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    46
    component_dir.write_settings("""
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    47
HOL_LIGHT_IMPORT="$COMPONENT"
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    48
HOL_LIGTH_BUNDLE="$HOL_LIGHT_IMPORT/bundle/proofs"
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    49
HOL_LIGHT_OFFLINE="$HOL_LIGHT_IMPORT/${ISABELLE_WINDOWS_PLATFORM64:-${ISABELLE_APPLE_PLATFORM64:-$ISABELLE_PLATFORM64}}/offline"
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    50
""")
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    51
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    52
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    53
    /* README */
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    54
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    55
    File.write(component_dir.README,
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    56
      """Author: Cezary Kaliszyk, University of Innsbruck, 2013
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    57
Author: Alexander Krauss, QAware GmbH, 2013
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    58
Author: Sophie Tourret, INRIA, 2024
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    59
Author: Stéphane Glondu, INRIA, 2024
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    60
LICENSE (export tools): BSD-3 from Isabelle
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    61
LICENSE (HOL Light proofs): BSD-2 from HOL Light
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    62
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    63
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    64
This is an export of primitive proofs from HOL Light """ + hol_light_rev + """.
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    65
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    66
The original repository """ + hol_light_url + """
81918
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
    67
has been patched in 2 phases. The overall export process works like this:
81834
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    68
81915
02e107686442 move material from https://gitlab.inria.fr/hol-light-isabelle/hol-light 72b2b702eadb and https://gitlab.inria.fr/hol-light-isabelle/import ce58755b0232 into Isabelle repository: results from running "isabelle component_hol_light_import" of previous version;
wenzelm
parents: 81834
diff changeset
    69
  cd hol-light
81834
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    70
  make
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    71
81918
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
    72
  patch -p1 < "$HOL_LIGHT_IMPORT/patches/patch1"
81834
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    73
  ./ocaml-hol -I +compiler-libs stage1.ml
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    74
81918
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
    75
  patch -p1 < "$HOL_LIGHT_IMPORT/patches/patch2"
81834
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    76
  export MAXTMS=10000
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    77
  ./ocaml-hol -I +compiler-libs stage2.ml
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    78
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    79
  gzip -d proofs.gz
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    80
  > maps.lst
81915
02e107686442 move material from https://gitlab.inria.fr/hol-light-isabelle/hol-light 72b2b702eadb and https://gitlab.inria.fr/hol-light-isabelle/import ce58755b0232 into Isabelle repository: results from running "isabelle component_hol_light_import" of previous version;
wenzelm
parents: 81834
diff changeset
    81
  "$HOL_LIGHT_IMPORT/x86_64-linux/offline"
81834
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    82
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    83
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    84
      Makarius
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    85
      """ + Date.Format.date(Date.now()) + "\n")
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    86
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    87
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    88
    Isabelle_System.with_tmp_dir("build") { tmp_dir =>
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    89
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    90
      /* OCaml setup */
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    91
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    92
      progress.echo("Setup OCaml ...")
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    93
      progress.bash(
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    94
        if (only_offline) "isabelle ocaml_setup_base"
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    95
        else "isabelle ocaml_setup && isabelle ocaml_opam install -y camlp5",
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    96
        echo = progress.verbose).check
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    97
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    98
      val opam_env = Isabelle_System.bash("isabelle ocaml_opam env").check.out
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
    99
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   100
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   101
      /* "offline" tool */
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   102
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   103
      progress.echo("Building offline tool ...")
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   104
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   105
      val offline_path = Path.explode("offline")
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   106
      val offline_exe = offline_path.platform_exe
81915
02e107686442 move material from https://gitlab.inria.fr/hol-light-isabelle/hol-light 72b2b702eadb and https://gitlab.inria.fr/hol-light-isabelle/import ce58755b0232 into Isabelle repository: results from running "isabelle component_hol_light_import" of previous version;
wenzelm
parents: 81834
diff changeset
   107
      val offline_dir = Isabelle_System.make_directory(tmp_dir + offline_path)
02e107686442 move material from https://gitlab.inria.fr/hol-light-isabelle/hol-light 72b2b702eadb and https://gitlab.inria.fr/hol-light-isabelle/import ce58755b0232 into Isabelle repository: results from running "isabelle component_hol_light_import" of previous version;
wenzelm
parents: 81834
diff changeset
   108
02e107686442 move material from https://gitlab.inria.fr/hol-light-isabelle/hol-light 72b2b702eadb and https://gitlab.inria.fr/hol-light-isabelle/import ce58755b0232 into Isabelle repository: results from running "isabelle component_hol_light_import" of previous version;
wenzelm
parents: 81834
diff changeset
   109
      Isabelle_System.copy_dir(hol_import_dir + offline_path, offline_dir, direct = true)
81834
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   110
81915
02e107686442 move material from https://gitlab.inria.fr/hol-light-isabelle/hol-light 72b2b702eadb and https://gitlab.inria.fr/hol-light-isabelle/import ce58755b0232 into Isabelle repository: results from running "isabelle component_hol_light_import" of previous version;
wenzelm
parents: 81834
diff changeset
   111
      progress.bash("ocamlopt offline.ml -o offline",
02e107686442 move material from https://gitlab.inria.fr/hol-light-isabelle/hol-light 72b2b702eadb and https://gitlab.inria.fr/hol-light-isabelle/import ce58755b0232 into Isabelle repository: results from running "isabelle component_hol_light_import" of previous version;
wenzelm
parents: 81834
diff changeset
   112
        cwd = offline_dir, echo = progress.verbose).check
02e107686442 move material from https://gitlab.inria.fr/hol-light-isabelle/hol-light 72b2b702eadb and https://gitlab.inria.fr/hol-light-isabelle/import ce58755b0232 into Isabelle repository: results from running "isabelle component_hol_light_import" of previous version;
wenzelm
parents: 81834
diff changeset
   113
      Isabelle_System.copy_file(offline_dir + offline_exe, platform_dir + offline_exe)
81834
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   114
      File.set_executable(platform_dir + offline_exe)
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   115
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   116
81918
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
   117
      if (!only_offline) {
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
   118
        /* clone repository */
81834
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   119
81916
2bb448f2ac51 avoid redundant repository clone;
wenzelm
parents: 81915
diff changeset
   120
        val hol_light_dir = tmp_dir + Path.basic("hol-light")
2bb448f2ac51 avoid redundant repository clone;
wenzelm
parents: 81915
diff changeset
   121
        Isabelle_System.git_clone(hol_light_url, hol_light_dir, checkout = hol_light_rev,
2bb448f2ac51 avoid redundant repository clone;
wenzelm
parents: 81915
diff changeset
   122
          progress = progress)
2bb448f2ac51 avoid redundant repository clone;
wenzelm
parents: 81915
diff changeset
   123
81918
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
   124
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
   125
        /* patches */
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
   126
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
   127
        Isabelle_System.make_directory(component_dir.path + Path.basic("patches"))
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
   128
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
   129
        def patch(n: Int, source: Boolean = false): Path =
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
   130
          (if (source) hol_import_dir else component_dir.path) + Path.explode("patches/patch" + n)
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
   131
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
   132
        for (n <- List(1, 2)) Isabelle_System.copy_file(patch(n, source = true), patch(n))
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
   133
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
   134
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
   135
        /* export stages */
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
   136
81917
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   137
        def run(n: Int, lines: String*): Unit = {
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   138
          val title = "stage " + n
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   139
          if (n > 0) progress.echo("Running " + title + " ...")
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   140
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   141
          val start = Time.now()
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   142
          progress.bash(cat_lines("set -e" :: opam_env :: lines.toList),
81918
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
   143
            cwd = hol_light_dir, echo = progress.verbose).check.timing
81917
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   144
          val elapsed = Time.now() - start
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   145
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   146
          if (n > 0) {
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   147
            progress.echo("Finished " + title + " (" + elapsed.message_hms + " elapsed time)")
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   148
          }
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   149
        }
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   150
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   151
        run(0, "make")
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   152
        run(1,
81918
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
   153
          "patch -p1 < " + File.bash_path(patch(1)),
81917
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   154
          "./ocaml-hol -I +compiler-libs stage1.ml")
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   155
        run(2,
81918
deb6cb34a37f clarified patches;
wenzelm
parents: 81917
diff changeset
   156
          "patch -p1 < " + File.bash_path(patch(2)),
81917
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   157
          "export MAXTMS=10000",
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   158
          "./ocaml-hol -I +compiler-libs stage2.ml")
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   159
        run(3,
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   160
          "gzip -d proofs.gz",
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   161
          "> maps.lst",
50cd5037aff7 more explicit stages, with timing messages;
wenzelm
parents: 81916
diff changeset
   162
          File.bash_path(platform_dir + offline_exe) + " proofs")
81834
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   163
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   164
        val bundle_dir = Isabelle_System.make_directory(component_dir.path + Path.explode("bundle"))
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   165
        Isabelle_System.copy_file(hol_light_dir + Path.explode("proofs"), bundle_dir)
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   166
      }
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   167
    }
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   168
  }
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   169
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   170
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   171
  /* Isabelle tool wrapper */
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   172
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   173
  val isabelle_tool =
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   174
    Isabelle_Tool("component_hol_light_import", "build Isabelle component for HOL Light import",
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   175
      Scala_Project.here,
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   176
      { args =>
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   177
        var target_dir = Path.current
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   178
        var only_offline = false
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   179
        var hol_light_url = default_hol_light_url
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   180
        var hol_light_rev = default_hol_light_rev
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   181
        var verbose = false
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   182
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   183
        val getopts = Getopts("""
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   184
Usage: isabelle component_hol_light_import [OPTIONS]
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   185
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   186
  Options are:
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   187
    -D DIR       target directory (default ".")
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   188
    -O           only build the "offline" tool
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   189
    -U URL       git URL for original HOL Light repository, default:
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   190
                 """ + default_hol_light_url + """
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   191
    -r REV       revision or branch to checkout HOL Light (default: """ +
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   192
                    default_hol_light_rev + """)
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   193
    -v           verbose
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   194
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   195
  Build Isabelle component for HOL Light import.
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   196
""",
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   197
          "D:" -> (arg => target_dir = Path.explode(arg)),
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   198
          "O" -> (_ => only_offline = true),
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   199
          "U:" -> (arg => hol_light_url = arg),
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   200
          "r:" -> (arg => hol_light_rev = arg),
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   201
          "v" -> (_ => verbose = true))
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   202
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   203
        val more_args = getopts(args)
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   204
        if (more_args.nonEmpty) getopts.usage()
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   205
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   206
        val progress = new Console_Progress(verbose = verbose)
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   207
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   208
        build_hol_light_import(
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   209
          only_offline = only_offline, progress = progress, target_dir = target_dir,
81915
02e107686442 move material from https://gitlab.inria.fr/hol-light-isabelle/hol-light 72b2b702eadb and https://gitlab.inria.fr/hol-light-isabelle/import ce58755b0232 into Isabelle repository: results from running "isabelle component_hol_light_import" of previous version;
wenzelm
parents: 81834
diff changeset
   210
          hol_light_url = hol_light_url, hol_light_rev = hol_light_rev)
81834
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   211
      })
9e25f6e2748c reproducible construction of HOL Light export bundle;
wenzelm
parents:
diff changeset
   212
}