create

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bash
cd $(dirname $0)
set -ex


# Fetch clang source code
if [ ! -d llvm-project ]; then
    git clone --recursive git@github.com:llvm/llvm-project.git
fi
git -C llvm-project fetch
git -C llvm-project checkout llvmorg-18.1.3

rm -rf build.tmp container/dist

docker run -it --rm -u $(id -u):$(id -g) \
    -w /var/source \
    -v $(pwd):/var/source \
    registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest \
        cmake -B build.tmp -G Ninja -S llvm-project/llvm \
            -DLLVM_ENABLE_PROJECTS="clang;lld" \
            -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind;compiler-rt" \
            -DCMAKE_BUILD_TYPE=Release \
            -DCMAKE_INSTALL_PREFIX=container/dist

docker run -it --rm -u $(id -u):$(id -g) \
    -w /var/source \
    -v $(pwd):/var/source \
    registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest \
        ninja -C build.tmp all install/strip

# Build the container
cd container
docker build --tag linux-builder .