Bolt icon indicating copy to clipboard operation
Bolt copied to clipboard

Implement a better build system

Open samvv opened this issue 8 months ago • 0 comments

Right now the Python script that builds Bolt is just an ugly file full of shortcuts and assumptions. Ideally, we can declaratively specify the build file in a build language that automatically does the caching for us.

This build language could simply be a subset of the Bolt language itself, where each expression is persistently cached on disk. That way, download, unzip and compile only happens once.

Very hypothetical example for LLVM:

let source = 
    download f"https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-{version}.tar.gz"
  |> extract ~strip_components:1

let configure
    ~version:string
    ~prefix:string
    ?(assertions = false)
    ?(targets: llvm_target[] = [ Host ])
  = cmake_generate
      (source version)
      ~defines:{
        "CMAKE_INSTALL_PREFIX" = prefix,
        "LLVM_ENABLE_ASSERTIONS" = assertions,
        "LLVM_TARGETS_TO_BUILD" = ";".join(targets),
      }

let build *args = configure *args |> cmake_build

let package *args =
  build *args ~prefix=install_dir |> cmake_install

samvv avatar May 04 '25 14:05 samvv