Update to new bootstrap API

This commit is contained in:
Guillaume Gomez 2024-08-08 17:26:37 +02:00
parent f5abc4204f
commit 6db83ef8eb

View File

@ -9,17 +9,16 @@
//! ensure that they're always in place if needed. //! ensure that they're always in place if needed.
use std::fs; use std::fs;
use std::path::{Path, PathBuf}; use std::path::PathBuf;
use std::sync::OnceLock; use std::sync::OnceLock;
use super::llvm::HashStamp;
use crate::core::builder::{Builder, RunConfig, ShouldRun, Step}; use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
use crate::core::config::TargetSelection; use crate::core::config::TargetSelection;
use crate::utils::exec::command; use crate::utils::exec::command;
use crate::utils::helpers::{self, t}; use crate::utils::helpers::{self, t};
use crate::{generate_smart_stamp_hash, Kind}; use crate::{generate_smart_stamp_hash, Kind};
use super::llvm::HashStamp;
pub struct Meta { pub struct Meta {
stamp: HashStamp, stamp: HashStamp,
out_dir: PathBuf, out_dir: PathBuf,
@ -38,13 +37,13 @@ pub enum GccBuildStatus {
/// GCC, it's fine for us to not try to avoid doing so. /// GCC, it's fine for us to not try to avoid doing so.
pub fn prebuilt_gcc_config(builder: &Builder<'_>, target: TargetSelection) -> GccBuildStatus { pub fn prebuilt_gcc_config(builder: &Builder<'_>, target: TargetSelection) -> GccBuildStatus {
// If we have gcc submodule initialized already, sync it. // If we have gcc submodule initialized already, sync it.
builder.update_existing_submodule(&Path::new("src").join("gcc")); builder.update_existing_submodule("src/gcc");
// FIXME (GuillaumeGomez): To be done once gccjit has been built in the CI. // FIXME (GuillaumeGomez): To be done once gccjit has been built in the CI.
// builder.config.maybe_download_ci_gcc(); // builder.config.maybe_download_ci_gcc();
// Initialize the gcc submodule if not initialized already. // Initialize the gcc submodule if not initialized already.
builder.update_submodule(&Path::new("src").join("gcc")); builder.update_submodule("src/gcc");
let root = "src/gcc"; let root = "src/gcc";
let out_dir = builder.gcc_out(target).join("build"); let out_dir = builder.gcc_out(target).join("build");
@ -199,18 +198,17 @@ impl Step for Gcc {
return true; return true;
} }
builder.run( command(root.join("configure"))
command(root.join("configure")) .current_dir(&out_dir)
.current_dir(&out_dir) .arg("--enable-host-shared")
.arg("--enable-host-shared") .arg("--enable-languages=jit")
.arg("--enable-languages=jit") .arg("--enable-checking=release")
.arg("--enable-checking=release") .arg("--disable-bootstrap")
.arg("--disable-bootstrap") .arg("--disable-multilib")
.arg("--disable-multilib") .arg(format!("--prefix={}", install_dir.display()))
.arg(format!("--prefix={}", install_dir.display())), .run(builder);
); command("make").current_dir(&out_dir).arg(format!("-j{}", builder.jobs())).run(builder);
builder.run(command("make").current_dir(&out_dir).arg(format!("-j{}", builder.jobs()))); command("make").current_dir(&out_dir).arg("install").run(builder);
builder.run(command("make").current_dir(&out_dir).arg("install"));
t!(builder.symlink_file( t!(builder.symlink_file(
install_dir.join("lib/libgccjit.so"), install_dir.join("lib/libgccjit.so"),