2022-12-16 16:07:56 +01:00
|
|
|
ARG ORG=dockcross
|
|
|
|
FROM ${ORG}/base:latest
|
2021-10-08 23:07:09 +02:00
|
|
|
|
|
|
|
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"
|
|
|
|
|
2024-04-16 16:56:40 +02:00
|
|
|
ENV LLVM_VERSION 18
|
2022-12-22 04:57:29 +01:00
|
|
|
|
|
|
|
# Build LLVM / Clang that supports our glibc
|
|
|
|
RUN apt-get update && \
|
|
|
|
# Temporarily install to setup apt repositories
|
|
|
|
apt-get install -y && \
|
|
|
|
\
|
|
|
|
curl -sS https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor > /etc/apt/trusted.gpg.d/llvm.gpg && \
|
2024-01-02 15:34:32 +01:00
|
|
|
echo "deb [signed-by=/etc/apt/trusted.gpg.d/llvm.gpg] http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-${LLVM_VERSION} main" >> /etc/apt/sources.list.d/llvm.list && \
|
|
|
|
echo "deb-src [signed-by=/etc/apt/trusted.gpg.d/llvm.gpg] http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-${LLVM_VERSION} main" >> /etc/apt/sources.list.d/llvm.list && \
|
2022-12-22 04:57:29 +01:00
|
|
|
\
|
|
|
|
apt-get update && \
|
|
|
|
apt-get install -y clang-${LLVM_VERSION} lld-${LLVM_VERSION} && \
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2024-04-16 16:56:40 +02:00
|
|
|
ENV WASI_VERSION 22
|
2023-06-22 05:18:48 +02:00
|
|
|
ENV WASI_VERSION_FULL ${WASI_VERSION}.0
|
|
|
|
RUN cd /usr/ && \
|
|
|
|
curl -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz && \
|
|
|
|
tar xvzf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz && \
|
|
|
|
rm wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
|
2022-12-22 04:57:29 +01:00
|
|
|
RUN cd /usr/ && \
|
|
|
|
curl -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/libclang_rt.builtins-wasm32-wasi-${WASI_VERSION_FULL}.tar.gz && \
|
|
|
|
tar xvzf libclang_rt.builtins-wasm32-wasi-${WASI_VERSION_FULL}.tar.gz && \
|
|
|
|
rm libclang_rt.builtins-wasm32-wasi-${WASI_VERSION_FULL}.tar.gz && \
|
2023-06-22 05:18:48 +02:00
|
|
|
cp -r lib/wasi /usr/lib/llvm-${LLVM_VERSION}/lib/clang/${LLVM_VERSION}/lib/
|
|
|
|
ENV WASI_SYSROOT /usr/wasi-sdk-${WASI_VERSION_FULL}/share/wasi-sysroot
|
|
|
|
ENV WASI_SDK_PATH /usr/wasi-sdk-${WASI_VERSION_FULL}
|
2021-10-08 23:07:09 +02:00
|
|
|
|
2022-01-02 03:40:22 +01:00
|
|
|
COPY clang-wasi-sysroot.sh clang++-wasi-sysroot.sh /usr/local/bin/
|
2021-10-08 23:07:09 +02:00
|
|
|
|
|
|
|
ENV CROSS_TRIPLE=wasm32-wasi
|
|
|
|
ENV CROSS_ROOT=${WASI_SDK_PATH}
|
2022-12-22 04:57:29 +01:00
|
|
|
ENV AR=llvm-ar-${LLVM_VERSION} \
|
2021-10-08 23:07:09 +02:00
|
|
|
CC=clang-wasi-sysroot.sh \
|
|
|
|
CXX=clang++-wasi-sysroot.sh \
|
2022-12-22 04:57:29 +01:00
|
|
|
LD=wasm-ld-${LLVM_VERSION} \
|
|
|
|
RANLIB=llvm-ranlib-${LLVM_VERSION}
|
2021-10-08 23:07:09 +02:00
|
|
|
|
2022-01-02 03:40:22 +01:00
|
|
|
#include "common.webassembly"
|
|
|
|
|
2021-10-13 21:40:49 +02:00
|
|
|
COPY WASI.cmake /usr/src/
|
|
|
|
RUN mv /usr/src/WASI.cmake /usr/share/cmake-*/Modules/Platform/
|
2022-02-23 04:02:21 +01:00
|
|
|
COPY *.cmake /usr/src/
|
|
|
|
RUN mv /usr/src/*.cmake /usr/share/cmake-*/Modules/
|
|
|
|
COPY CheckTypeSize.c.in /usr/src/
|
|
|
|
RUN mv /usr/src/CheckTypeSize.c.in /usr/share/cmake-*/Modules/
|
2021-10-08 23:07:09 +02:00
|
|
|
COPY Toolchain.cmake ${CROSS_ROOT}/
|
|
|
|
ENV CMAKE_TOOLCHAIN_FILE ${CROSS_ROOT}/Toolchain.cmake
|
|
|
|
|
|
|
|
#include "common.label-and-env"
|