src/Pure/Admin/build_vampire.scala
changeset 72888 74d785882737
parent 72887 970bad477c13
child 72889 5db643841f5d
equal deleted inserted replaced
72887:970bad477c13 72888:74d785882737
    45 
    45 
    46       progress.echo("Cloning repository " + repository)
    46       progress.echo("Cloning repository " + repository)
    47       progress.bash("git clone " + Bash.string(repository) + " vampire",
    47       progress.bash("git clone " + Bash.string(repository) + " vampire",
    48         cwd = tmp_dir.file, echo = verbose).check
    48         cwd = tmp_dir.file, echo = verbose).check
    49 
    49 
    50       val build_dir = tmp_dir + Path.explode("vampire")
    50       val source_dir = tmp_dir + Path.explode("vampire")
    51 
    51 
    52       File.copy(build_dir + Path.explode("LICENCE"), component_dir)
    52       File.copy(source_dir + Path.explode("LICENCE"), component_dir)
    53 
    53 
    54 
    54 
    55       /* build versions */
    55       /* build */
    56 
    56 
    57       for { (rev, exe) <- List(version1 -> "vampire", version2 -> "vampire_polymorphic") } {
    57       val build_static = Platform.is_linux
       
    58 
       
    59       def build_init(exe: String, rev: String): Unit =
       
    60       {
    58         progress.echo("Building " + exe + " (rev " + rev + ")")
    61         progress.echo("Building " + exe + " (rev " + rev + ")")
    59         progress.bash(
    62         progress.bash("git checkout --quiet --detach " + Bash.string(rev),
    60           List("git checkout --quiet --detach " + Bash.string(rev),
    63           cwd = source_dir.file, echo = verbose).check
    61             "make clean",
    64       }
    62             "make vampire_rel").mkString(" && "),
    65 
    63           cwd = build_dir.file, echo = verbose).check
    66 
       
    67       /* build standard version */
       
    68 
       
    69       {
       
    70         val exe = "vampire"
       
    71         build_init(exe, version1)
       
    72 
       
    73         val build_dir = Isabelle_System.make_directory(source_dir + Path.explode("build"))
       
    74 
       
    75         val cmake_opts = if (build_static) "-DBUILD_SHARED_LIBS=0 " else ""
       
    76         val cmake_out =
       
    77           progress.bash("cmake " + cmake_opts + """-G "Unix Makefiles" ..""",
       
    78             cwd = build_dir.file, echo = verbose).check.out
       
    79 
       
    80         val Pattern = """-- Setting binary name to (\S*)""".r
       
    81         val binary =
       
    82           split_lines(cmake_out).collectFirst({ case Pattern(name) => name })
       
    83             .getOrElse(error("Failed to determine binary name from cmake output:\n" + cmake_out))
       
    84 
       
    85         progress.bash("make", cwd = build_dir.file, echo = verbose).check
       
    86 
       
    87         File.copy(build_dir + Path.basic("bin") + Path.basic(binary).platform_exe,
       
    88           platform_dir + Path.basic(exe).platform_exe)
       
    89       }
       
    90 
       
    91 
       
    92       /* build polymorphic version */
       
    93 
       
    94       {
       
    95         val exe = "vampire_polymorphic"
       
    96         build_init(exe, version2)
       
    97 
       
    98         val target = if (build_static) "vampire_rel_static" else "vampire_rel"
       
    99         progress.bash("make " + target, cwd = source_dir.file, echo = verbose).check
    64 
   100 
    65         val rev_count =
   101         val rev_count =
    66           progress.bash("git rev-list HEAD --count", cwd = build_dir.file).check.out
   102           progress.bash("git rev-list HEAD --count", cwd = source_dir.file).check.out
    67         val build = Path.basic("vampire_rel_detached_" + rev_count)
   103         val binary = target + "_detached_" + rev_count
    68         File.copy(build_dir + build.platform_exe, platform_dir + Path.basic(exe).platform_exe)
   104         File.copy(source_dir + Path.basic(binary).platform_exe,
       
   105           platform_dir + Path.basic(exe).platform_exe)
    69       }
   106       }
    70 
   107 
    71 
   108 
    72       /* settings */
   109       /* settings */
    73 
   110 
    88 
   125 
    89       File.write(component_dir + Path.basic("README"),
   126       File.write(component_dir + Path.basic("README"),
    90         "This Isabelle component provides two versions of Vampire from\n" + repository + """
   127         "This Isabelle component provides two versions of Vampire from\n" + repository + """
    91 
   128 
    92   * vampire: standard version (regular stable release)
   129   * vampire: standard version (regular stable release)
       
   130 
       
   131       cmake . && make
       
   132 
    93   * vampire_polymorphic: special version for polymorphic FOL and HOL
   133   * vampire_polymorphic: special version for polymorphic FOL and HOL
    94     (intermediate repository version)
   134     (intermediate repository version)
    95 
   135 
    96 The executables have been built like this:
   136       make vampire_rel
    97 
       
    98     git checkout COMMIT
       
    99     make clean
       
   100     make vampire_rel
       
   101 
   137 
   102 The precise commit id is revealed by executing "vampire --version".
   138 The precise commit id is revealed by executing "vampire --version".
   103 
   139 
   104 
   140 
   105         Makarius
   141         Makarius