53 lines
1.8 KiB
Python
53 lines
1.8 KiB
Python
version = "20.1.0"
|
|
revision = 1
|
|
metadata = meta(
|
|
description = "LLVM compiler infrastructure with clang and lld",
|
|
license = "Apache-2.0 WITH LLVM-exception",
|
|
website = "https://llvm.org/",
|
|
)
|
|
source = tarball_source(
|
|
url = f"https://github.com/llvm/llvm-project/releases/download/llvmorg-{version}/llvm-project-{version}.src.tar.xz",
|
|
sha256 = "?",
|
|
strip_components = 1,
|
|
)
|
|
host_deps = ["binutils"]
|
|
|
|
def configure(ctx):
|
|
ctx.run([
|
|
"cmake",
|
|
"-S", ctx.source_dir / "llvm",
|
|
"-B", ctx.build_dir,
|
|
"-G", "Ninja",
|
|
"-DCMAKE_BUILD_TYPE=Release",
|
|
"-DCMAKE_INSTALL_PREFIX=" + ctx.prefix,
|
|
"-DLLVM_ENABLE_PROJECTS=clang;clang-tools-extra;lld",
|
|
"-DLLVM_ENABLE_RUNTIMES=compiler-rt",
|
|
"-DLLVM_TARGETS_TO_BUILD=X86;AArch64;RISCV",
|
|
"-DLLVM_DEFAULT_TARGET_TRIPLE=" + options.target_triple,
|
|
"-DLLVM_HOST_TRIPLE=" + options.target_triple,
|
|
"-DLLVM_ENABLE_LIBXML2=OFF",
|
|
"-DLLVM_ENABLE_LIBEDIT=OFF",
|
|
"-DLLVM_ENABLE_TERMINFO=OFF",
|
|
"-DLLVM_ENABLE_ASSERTIONS=OFF",
|
|
"-DLLVM_ENABLE_PIC=ON",
|
|
"-DLLVM_BUILD_LLVM_DYLIB=ON",
|
|
"-DLLVM_LINK_LLVM_DYLIB=ON",
|
|
"-DLLVM_INSTALL_UTILS=ON",
|
|
"-DLLVM_INCLUDE_TESTS=OFF",
|
|
"-DLLVM_INCLUDE_EXAMPLES=OFF",
|
|
"-DLLVM_INCLUDE_BENCHMARKS=OFF",
|
|
"-DCLANG_DEFAULT_LINKER=lld",
|
|
"-DCLANG_DEFAULT_RTLIB=compiler-rt",
|
|
"-DCLANG_DEFAULT_CXX_STDLIB=libstdc++",
|
|
], env = {
|
|
"CFLAGS": options.host_cflags,
|
|
"CXXFLAGS": options.host_cxxflags,
|
|
"LDFLAGS": options.host_ldflags,
|
|
})
|
|
|
|
def build(ctx):
|
|
ctx.run(["cmake", "--build", ctx.build_dir, "-j" + str(ctx.jobs)])
|
|
|
|
def install(ctx, pkg):
|
|
ctx.run(["cmake", "--install", ctx.build_dir], env = {"DESTDIR": pkg.dest_dir})
|