src/Pure/Admin/build_csdp.scala
changeset 76518 b30b8e23383c
parent 75394 42267c650205
child 76529 ded37aade88e
equal deleted inserted replaced
76517:b67c9ed2c810 76518:b30b8e23383c
    73           case Version(version) => version
    73           case Version(version) => version
    74           case _ => error("Failed to determine component version from " + quote(archive_name))
    74           case _ => error("Failed to determine component version from " + quote(archive_name))
    75         }
    75         }
    76 
    76 
    77       val component_name = "csdp-" + version
    77       val component_name = "csdp-" + version
    78       val component_dir = Isabelle_System.new_directory(target_dir + Path.basic(component_name))
    78       val component_dir =
    79       progress.echo("Component " + component_dir)
    79         Components.Directory.create(target_dir + Path.basic(component_name), progress = progress)
    80 
    80 
    81 
    81 
    82       /* platform */
    82       /* platform */
    83 
    83 
    84       val platform_name =
    84       val platform_name =
    85         proper_string(Isabelle_System.getenv("ISABELLE_WINDOWS_PLATFORM64")) orElse
    85         proper_string(Isabelle_System.getenv("ISABELLE_WINDOWS_PLATFORM64")) orElse
    86         proper_string(Isabelle_System.getenv("ISABELLE_PLATFORM64")) getOrElse
    86         proper_string(Isabelle_System.getenv("ISABELLE_PLATFORM64")) getOrElse
    87         error("No 64bit platform")
    87         error("No 64bit platform")
    88 
    88 
    89       val platform_dir = Isabelle_System.make_directory(component_dir + Path.basic(platform_name))
    89       val platform_dir =
       
    90         Isabelle_System.make_directory(component_dir.path + Path.basic(platform_name))
    90 
    91 
    91 
    92 
    92       /* download source */
    93       /* download source */
    93 
    94 
    94       val archive_path = tmp_dir + Path.basic(archive_name)
    95       val archive_path = tmp_dir + Path.basic(archive_name)
    97       Isabelle_System.bash("tar xzf " + File.bash_path(archive_path), cwd = tmp_dir.file).check
    98       Isabelle_System.bash("tar xzf " + File.bash_path(archive_path), cwd = tmp_dir.file).check
    98       val source_name = File.get_dir(tmp_dir)
    99       val source_name = File.get_dir(tmp_dir)
    99 
   100 
   100       Isabelle_System.bash(
   101       Isabelle_System.bash(
   101         "tar xzf " + archive_path + " && mv " + Bash.string(source_name) + " src",
   102         "tar xzf " + archive_path + " && mv " + Bash.string(source_name) + " src",
   102         cwd = component_dir.file).check
   103         cwd = component_dir.path.file).check
   103 
   104 
   104 
   105 
   105       /* build */
   106       /* build */
   106 
   107 
   107       progress.echo("Building CSDP for " + platform_name + " ...")
   108       progress.echo("Building CSDP for " + platform_name + " ...")
   117       progress.bash(mingw.bash_script("make"), cwd = build_dir.file, echo = verbose).check
   118       progress.bash(mingw.bash_script("make"), cwd = build_dir.file, echo = verbose).check
   118 
   119 
   119 
   120 
   120       /* install */
   121       /* install */
   121 
   122 
   122       Isabelle_System.copy_file(build_dir + Path.explode("LICENSE"), component_dir)
   123       Isabelle_System.copy_file(build_dir + Path.explode("LICENSE"), component_dir.path)
   123       Isabelle_System.copy_file(build_dir + Path.explode("solver/csdp").platform_exe, platform_dir)
   124       Isabelle_System.copy_file(build_dir + Path.explode("solver/csdp").platform_exe, platform_dir)
   124 
   125 
   125       if (Platform.is_windows) {
   126       if (Platform.is_windows) {
   126         Executable.libraries_closure(platform_dir + Path.explode("csdp.exe"), mingw = mingw,
   127         Executable.libraries_closure(platform_dir + Path.explode("csdp.exe"), mingw = mingw,
   127           filter =
   128           filter =
   130       }
   131       }
   131 
   132 
   132 
   133 
   133       /* settings */
   134       /* settings */
   134 
   135 
   135       val etc_dir = Isabelle_System.make_directory(component_dir + Path.basic("etc"))
   136       File.write(component_dir.settings,
   136       File.write(etc_dir + Path.basic("settings"),
       
   137         """# -*- shell-script -*- :mode=shellscript:
   137         """# -*- shell-script -*- :mode=shellscript:
   138 
   138 
   139 ISABELLE_CSDP="$COMPONENT/${ISABELLE_WINDOWS_PLATFORM64:-$ISABELLE_PLATFORM64}/csdp"
   139 ISABELLE_CSDP="$COMPONENT/${ISABELLE_WINDOWS_PLATFORM64:-$ISABELLE_PLATFORM64}/csdp"
   140 """)
   140 """)
   141 
   141 
   142 
   142 
   143       /* README */
   143       /* README */
   144 
   144 
   145       File.write(component_dir + Path.basic("README"),
   145       File.write(component_dir.README,
   146 """This is CSDP """ + version + """ from
   146 """This is CSDP """ + version + """ from
   147 """ + download_url + """
   147 """ + download_url + """
   148 
   148 
   149 Makefile flags have been changed for various platforms as follows:
   149 Makefile flags have been changed for various platforms as follows:
   150 
   150