Initial LLVM build

This commit is contained in:
TennesseeTrash 2025-12-30 22:18:27 +01:00
parent cdfbcf4f61
commit 4a35de9a69
10 changed files with 342 additions and 23 deletions

View file

@ -1,12 +1,83 @@
#include "Common.hpp"
#include "Download.hpp"
#include "Unpack.hpp"
#include <Process/Environment.hpp>
#include <Process/Process.hpp>
#include <filesystem>
#include <print>
int main()
{
std::println("Hello World!");
if (!Toolchain::DownloadFile("index.html", "https://3011.io/")) {
Toolchain::fs::create_directories("Archives");
if (!Toolchain::fs::exists("Archives/LLVM.tar.gz") && !Toolchain::DownloadFile("Archives/LLVM.tar.gz", "https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-21.1.8.tar.gz")) {
std::println("Unlucky");
return 1;
}
Toolchain::fs::create_directories("Sources");
if (!Toolchain::fs::exists("Sources/LLVM") && !Toolchain::UnpackArchive("Archives/LLVM.tar.gz", "Sources/LLVM")) {
std::println("Unlucky");
return 1;
}
return 0;
Toolchain::fs::create_directories("Builds");
Process::Process configure(
"cmake", { "-S", "Sources/LLVM/llvm", "-B", "Builds/LLVM", "-G", "Ninja", "-DCMAKE_BUILD_TYPE=Release", "-DCMAKE_INSTALL_PREFIX=Stage0", "-DLLVM_ENABLE_PROJECTS=all", "-DLLVM_ENABLE_RUNTIMES=all" },
Process::ProcessOptions {
.StdinMode = Process::PipeMode::Null,
.StdoutMode = Process::PipeMode::Inherit,
.StderrMode = Process::PipeMode::Inherit,
.PathResolution = Process::PathMode::CurrentEnvironment,
.Environment = Process::CurrentEnvironment(),
.CloseOtherFds = true,
}
);
configure.Wait();
if (configure.ExitCode() != 0) {
std::println("Unlucky");
return 1;
}
Process::Process build (
"ninja", { "-C", "Builds/LLVM", "-j4" },
Process::ProcessOptions {
.StdinMode = Process::PipeMode::Null,
.StdoutMode = Process::PipeMode::Inherit,
.StderrMode = Process::PipeMode::Inherit,
.PathResolution = Process::PathMode::CurrentEnvironment,
.Environment = Process::CurrentEnvironment(),
.CloseOtherFds = true,
}
);
build.Wait();
if (build.ExitCode() != 0) {
std::println("Unlucky");
return 1;
}
Process::Process install (
"ninja", { "-C", "Builds/LLVM", "install" },
Process::ProcessOptions {
.StdinMode = Process::PipeMode::Null,
.StdoutMode = Process::PipeMode::Inherit,
.StderrMode = Process::PipeMode::Inherit,
.PathResolution = Process::PathMode::CurrentEnvironment,
.Environment = Process::CurrentEnvironment(),
.CloseOtherFds = true,
}
);
install.Wait();
if (install.ExitCode() != 0){
std::println("Unlucky");
return 1;
}
}