tell build script about llvm version
this will be needed to support compiler-rt build + installation later.
This commit is contained in:
parent
42dcddafdb
commit
8c5afad607
|
@ -1,22 +1,21 @@
|
|||
|
||||
|
||||
# global arguments
|
||||
ARG LLVM_SOURCE_URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.0/llvm-project-16.0.0.src.tar.xz"
|
||||
ARG LLVM_VERSION="16"
|
||||
|
||||
# the base layer.
|
||||
FROM debian:oldstable AS base
|
||||
ENV DEBIAN_FRONTEND="noninteractive"
|
||||
RUN apt-get update
|
||||
|
||||
# base layer for building
|
||||
# base layer for building anything
|
||||
FROM base AS build-base
|
||||
WORKDIR /build
|
||||
ARG BUILD_DEPS="curl ca-certificates build-essential python3 cmake ninja-build pkg-config git zlib1g-dev"
|
||||
RUN apt-get install -y --no-install-recommends $BUILD_DEPS
|
||||
|
||||
|
||||
# This comes with the LLVM source code extracted to /build/llvm
|
||||
# This layer extracts the LLVM source code extracted to /build/llvm
|
||||
FROM build-base as llvm-base
|
||||
ARG LLVM_SOURCE_URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.0/llvm-project-16.0.0.src.tar.xz"
|
||||
ARG LLVM_VERSION="16"
|
||||
ARG LLVM_SOURCE_URL
|
||||
RUN mkdir llvm && \
|
||||
cd llvm && \
|
||||
curl -L $LLVM_SOURCE_URL | tar --strip-components=1 -xJf -
|
||||
|
@ -26,5 +25,7 @@ RUN mkdir llvm && \
|
|||
# /build/llvm-bin is expected to be mounted to a host directory.
|
||||
FROM llvm-base as llvm-build
|
||||
COPY scripts/build_llvm.sh .
|
||||
ENTRYPOINT ["/bin/bash", "-xeuo", "pipefail", "-O", "globstar", "-O", "dotglob"]
|
||||
ARG LLVM_VERSION
|
||||
ENV LLVM_VERSION=$LLVM_VERSION
|
||||
ENTRYPOINT [ "/bin/bash" ]
|
||||
CMD [ "/build/build_llvm.sh" ]
|
||||
|
|
|
@ -18,7 +18,7 @@ LLVM is built using a podman container (see Containerfile). The steps for replic
|
|||
```
|
||||
mkdir llvm_build
|
||||
podman build -t llvm-build -f Containerfile.llvm
|
||||
podman run --cpus 16 -m 8G --mount type=bind,source=$PWD/llvm_build,destination=/build/llvm-bin localhost/llvm-build
|
||||
podman run --cpus 16 -m 8G --mount type=bind,source=$PWD/llvm_build,destination=/build/llvm-build localhost/llvm-build
|
||||
```
|
||||
|
||||
|
||||
|
|
|
@ -1,25 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script builds the llvm components used by the LCPU addon.
|
||||
# This is run in a debian container to try and keep everything ABI stable
|
||||
# This is run in a debian container to try and keep everything ABI stable.
|
||||
|
||||
JOBS=$(nproc)
|
||||
|
||||
# Configure LLVM. THis is a mouthful, but it's only a mouthful because we specialize things we don't
|
||||
# want in our minimal build of the LLVM project/clang.
|
||||
cmake -GNinja -S /build/llvm/llvm -B /build/llvm-bin/build \
|
||||
cmake -Wno-dev -GNinja -S /build/llvm/llvm -B /build/llvm-build/build \
|
||||
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
||||
-DCMAKE_INSTALL_PREFIX="/build/llvm-bin/install" \
|
||||
-DCMAKE_INSTALL_PREFIX="/build/llvm-build/install" \
|
||||
-DLLVM_INCLUDE_TESTS=OFF \
|
||||
-DLLVM_ENABLE_PROJECTS="clang;lld" \
|
||||
-DLLVM_TARGETS_TO_BUILD="RISCV" \
|
||||
-DLLVM_DEFAULT_TARGET_TRIPLE="riscv32-none-gnu"
|
||||
|
||||
|
||||
ninja -C /build/llvm-bin/build -j $JOBS
|
||||
|
||||
# TODO: Configure and build compiler-rt with our toolchain.
|
||||
#cmake -GNinja -S llvm_src/compiler-rt \
|
||||
# TODO: Build compiler-rt with our toolchain.
|
||||
# This currently does not work as a single build (why would it), we instead
|
||||
# need to stage things (the first building clang + lld), and this being the last stage currently
|
||||
#cmake -Wno-dev -GNinja -S llvm_src/compiler-rt \
|
||||
# -DCOMPILER_RT_BUILD_SANITIZERS=OFF \
|
||||
# -DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
|
||||
# -DCOMPILER_RT_BUILD_PROFILE=OFF \
|
||||
|
|
Loading…
Reference in New Issue