From bc99adf54e58289dec3b8ca3fd365a44c6ee1d12 Mon Sep 17 00:00:00 2001 From: "Lance R. Vick" Date: Mon, 12 Feb 2024 12:16:55 -0800 Subject: [PATCH] feat: add llvm13 --- src/core/llvm13/Containerfile | 76 +++++++++++++++++++++++++++++++++++ src/packages.mk | 18 +++++++++ 2 files changed, 94 insertions(+) create mode 100644 src/core/llvm13/Containerfile diff --git a/src/core/llvm13/Containerfile b/src/core/llvm13/Containerfile new file mode 100644 index 0000000..bb4b23b --- /dev/null +++ b/src/core/llvm13/Containerfile @@ -0,0 +1,76 @@ +FROM scratch as base +ARG VERSION=13.0.1 +ENV SRC_FILE=llvm-project-${VERSION}.src.tar.xz +ENV SRC_SITE=https://github.com/llvm/llvm-project/releases/download/llvmorg-${VERSION}/${SRC_FILE} +ENV SRC_HASH=326335a830f2e32d06d0a36393b5455d17dc73e0bd1211065227ee014f92cbf8 + +FROM base as fetch +ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} . + +FROM fetch as build +COPY --from=busybox . / +COPY --from=binutils . / +COPY --from=cmake . / +COPY --from=ninja . / +COPY --from=musl . / +COPY --from=gcc . / +COPY --from=python . / +COPY --from=py-setuptools . / +COPY --from=zlib . / +COPY --from=openssl . / +# HACK: figure out why gcc package puts these in the wrong path at install time +COPY --from=gcc /usr/lib64/* /usr/lib/ +RUN tar -xf ${SRC_FILE} +WORKDIR llvm-project-${VERSION}.src +ADD *.patch . +RUN --network=none <<-EOF + set -eux + python -c "import setuptools; print(setuptools.__version__)" + cmake \ + -B build \ + -G Ninja \ + -Wno-dev -S llvm \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr/ \ + -DCMAKE_INSTALL_RPATH=/usr/ \ + -DLLVM_DEFAULT_TARGET_TRIPLE="x86_64-linux-musl" \ + -DLLVM_HOST_TRIPLE="x86_64-linux-musl" \ + -DLLVM_APPEND_VC_REV=OFF \ + -DLLVM_BINUTILS_INCDIR=/usr/include \ + -DLLVM_BUILD_DOCS=OFF \ + -DLLVM_BUILD_EXAMPLES=OFF \ + -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON \ + -DLLVM_BUILD_LLVM_DYLIB=ON \ + -DLLVM_BUILD_TESTS=ON \ + -DLLVM_ENABLE_ASSERTIONS=OFF \ + -DLLVM_ENABLE_DUMP=ON \ + -DLLVM_ENABLE_EH=ON \ + -DLLVM_ENABLE_FFI=OFF \ + -DLLVM_ENABLE_LIBCXX=OFF \ + -DLLVM_ENABLE_LIBEDIT=OFF \ + -DLLVM_ENABLE_PIC=ON \ + -DLLVM_ENABLE_RTTI=ON \ + -DLLVM_ENABLE_SPHINX=OFF \ + -DLLVM_ENABLE_TERMINFO=ON \ + -DLLVM_ENABLE_ZLIB=OFF \ + -DLLVM_ENABLE_ZSTD=OFF \ + -DLLVM_INCLUDE_BENCHMARKS=OFF \ + -DLLVM_INCLUDE_EXAMPLES=OFF \ + -DLLVM_INSTALL_UTILS=ON \ + -DLLVM_LINK_LLVM_DYLIB=ON \ + -DLLVM_USE_PERF=ON + cmake --build build + python3 llvm/utils/lit/setup.py build +EOF + +FROM build as install +RUN <<-EOF + set -eux + DESTDIR="/rootfs" cmake --install build + python3 llvm/utils/lit/setup.py install --root="/rootfs" + ln -s lit /rootfs/usr/bin/llvm-lit +EOF +RUN find /rootfs -exec touch -hcd "@0" "{}" + + +FROM scratch as package +COPY --from=install /rootfs / diff --git a/src/packages.mk b/src/packages.mk index 4e8367a..277b59f 100644 --- a/src/packages.mk +++ b/src/packages.mk @@ -250,6 +250,23 @@ out/linux-headers/index.json: \ out/stage3/index.json $(call build,core,linux-headers) +.PHONY: llvm13 +llvm13: out/llvm13/index.json +out/llvm13/index.json: \ + src/core/llvm13/Containerfile \ + out/binutils/index.json \ + out/busybox/index.json \ + out/cmake/index.json \ + out/gcc/index.json \ + out/make/index.json \ + out/musl/index.json \ + out/ninja/index.json \ + out/openssl/index.json \ + out/py-setuptools/index.json \ + out/python/index.json \ + out/zlib/index.json + $(call build,core,llvm13) + .PHONY: llvm llvm: out/llvm/index.json out/llvm/index.json: \ @@ -418,6 +435,7 @@ out/rust/index.json: \ out/cmake/index.json \ out/gcc/index.json \ out/libunwind/index.json \ + out/llvm13/index.json \ out/llvm/index.json \ out/make/index.json \ out/musl/index.json \