src/Pure/Admin/build_polyml.scala
changeset 77191 c42bf52381f1
parent 77190 f6ba88f23135
child 77510 f5d6cd98b16a
equal deleted inserted replaced
77190:f6ba88f23135 77191:c42bf52381f1
   158   val default_polyml_name = "polyml-5.9"
   158   val default_polyml_name = "polyml-5.9"
   159 
   159 
   160   val default_sha1_url = "https://isabelle.sketis.net/repos/sha1/archive"
   160   val default_sha1_url = "https://isabelle.sketis.net/repos/sha1/archive"
   161   val default_sha1_version = "e0239faa6f42"
   161   val default_sha1_version = "e0239faa6f42"
   162 
   162 
   163   private def init_sources(src_dir: Path): Unit = {
   163   private def init_src_root(src_dir: Path, input: String, output: String): Unit = {
   164     val lines = split_lines(File.read(src_dir + Path.explode("RootX86.ML")))
   164     val lines = split_lines(File.read(src_dir + Path.explode(input)))
   165     val ml_files =
   165     val ml_files =
   166       for {
   166       for {
   167         line <- lines
   167         line <- lines
   168         rest <- Library.try_unprefix("use", line)
   168         rest <- Library.try_unprefix("use", line)
   169       } yield "ML_file" + rest
   169       } yield "ML_file" + rest
   170 
   170 
   171     File.write(src_dir + Path.explode("ROOT.ML"),
   171     File.write(src_dir + Path.explode(output),
   172 """(* Poly/ML Compiler root file.
   172 """(* Poly/ML Compiler root file.
   173 
   173 
   174 When this file is open in the Prover IDE, the ML files of the Poly/ML
   174 When this file is open in the Prover IDE, the ML files of the Poly/ML
   175 compiler can be explored interactively. This is a separate copy: it does
   175 compiler can be explored interactively. This is a separate copy: it does
   176 not affect the running ML session. *)
   176 not affect the running ML session. *)
   213           Isabelle_System.extract(
   213           Isabelle_System.extract(
   214             download.tar.gz, component_dir.path + Path.basic(target), strip = true)
   214             download.tar.gz, component_dir.path + Path.basic(target), strip = true)
   215           download
   215           download
   216         }
   216         }
   217 
   217 
   218       init_sources(component_dir.src)
   218       init_src_root(component_dir.src, "RootArm64.ML", "ROOT0.ML")
       
   219       init_src_root(component_dir.src, "RootX86.ML", "ROOT.ML")
   219 
   220 
   220       for (arch_64 <- List(false, true)) {
   221       for (arch_64 <- List(false, true)) {
   221         progress.echo("Building " + polyml_platform(arch_64))
   222         progress.echo("Building " + polyml_platform(arch_64))
   222         make_polyml(
   223         make_polyml(
   223           root = polyml_download,
   224           root = polyml_download,
   259 
   260 
   260 ML_SYSTEM=""" + Bash.string(polyml_name) + """
   261 ML_SYSTEM=""" + Bash.string(polyml_name) + """
   261 ML_HOME="$POLYML_HOME/$ML_PLATFORM"
   262 ML_HOME="$POLYML_HOME/$ML_PLATFORM"
   262 ML_SOURCES="$POLYML_HOME/src"
   263 ML_SOURCES="$POLYML_HOME/src"
   263 
   264 
   264 ISABELLE_DOCS_EXAMPLES="$ISABELLE_DOCS_EXAMPLES:\$ML_SOURCES/ROOT.ML"
   265 case "$ML_PLATFORM" in
       
   266   *arm64*)
       
   267     ISABELLE_DOCS_EXAMPLES="$ISABELLE_DOCS_EXAMPLES:\$ML_SOURCES/ROOT0.ML"
       
   268     ;;
       
   269   *)
       
   270     ISABELLE_DOCS_EXAMPLES="$ISABELLE_DOCS_EXAMPLES:\$ML_SOURCES/ROOT.ML"
       
   271     ;;
       
   272 esac
   265 """)
   273 """)
   266 
   274 
   267 
   275 
   268     /* README */
   276     /* README */
   269 
   277