Debian Codegraph @

docker/centos/8/cpu_ispc_build/Dockerfile

raw
1 #
2 # Copyright (c) 2017-2025, Intel Corporation
3 #
4 # SPDX-License-Identifier: BSD-3-Clause
5
6 FROM rockylinux:8 AS llvm_only
7 LABEL maintainer="Dmitry Babokin <[email protected]>"
8 SHELL ["/bin/bash", "-c"]
9
10 ARG REPO=ispc/ispc
11 ARG SHA=main
12
13 # !!! Make sure that your docker config provides enough memory to the container,
14 # otherwise LLVM build may fail, as it will use all the cores available to container.
15
16 # Packages required to build ISPC and Clang.
17 RUN dnf -y update && dnf install -y wget yum-utils gcc gcc-c++ git make xz tbb-devel python38 python38-devel && \
18 dnf clean -y all
19
20 # These packages are required if you need to link ISPC with -static.
21 # Ninja is required for superbuild
22 RUN dnf -y --enablerepo=powertools install ninja-build libstdc++-static && \
23 dnf clean -y all
24
25 RUN if [[ $(uname -m) =~ "x86" ]]; then dnf -y update && dnf install -y glibc-devel.i686 && dnf clean -y all; fi
26
27 WORKDIR /usr/local/src
28
29 # Download and install required version of cmake (3.23.5 for both x86 and aarch64) as required for superbuild preset jsons.
30 RUN if [[ $(uname -m) =~ "x86" ]]; then \
31 export CMAKE_URL="https://cmake.org/files/v3.23/cmake-3.23.5-linux-x86_64.sh"; \
32 else \
33 export CMAKE_URL="https://github.com/Kitware/CMake/releases/download/v3.23.5/cmake-3.23.5-linux-aarch64.sh"; \
34 fi && \
35 wget -q --retry-connrefused --waitretry=5 --read-timeout=20 --timeout=15 -t 5 $CMAKE_URL && \
36 sh cmake-*.sh --prefix=/usr/local --skip-license && rm -rf cmake-*.sh
37
38 # If you are behind a proxy, you need to configure git.
39 RUN if [ -v http_proxy ]; then git config --global --add http.proxy "$http_proxy"; fi
40
41 WORKDIR /usr/local/src
42
43 # Fork ispc on github and clone *your* fork.
44 RUN git clone https://github.com/$REPO.git ispc
45
46 # If you are going to run test for future platforms, go to
47 # http://www.intel.com/software/sde and download the latest version,
48 # extract it, add to path and set SDE_HOME.
49
50 WORKDIR /usr/local/src/ispc
51
52 # Build Clang with all required patches.
53 # Pass required LLVM_VERSION with --build-arg LLVM_VERSION=<version>.
54 # Note self-build options, it's required to build clang and ispc with the same compiler,
55 # i.e. if clang was built by gcc, you may need to use gcc to build ispc (i.e. run "make gcc"),
56 # or better do clang selfbuild and use it for ispc build as well (i.e. just "make").
57 # "rm" are just to keep docker image small.
58 # Add --llvm-disable-assertions for building "release" version.
59 RUN git checkout $SHA && \
60 cmake superbuild \
61 -B build \
62 --preset os \
63 -DXE_DEPS=OFF \
64 -DBUILD_STAGE2_TOOLCHAIN_ONLY=ON \
65 -DCMAKE_INSTALL_PREFIX=/usr/local && \
66 cmake --build build && \
67 rm -rf build
68
69 FROM llvm_only AS ispc_build
70 SHELL ["/bin/bash", "-c"]
71
72 RUN dnf -y update && dnf install -y m4 bison flex && dnf clean -y all
73
74 # Create new non-root user and switch to it
75 RUN useradd -m -d /home/ispc_user -s /bin/bash -U ispc_user && \
76 chown -R ispc_user:ispc_user /usr
77
78 USER ispc_user
79
80 # Build ISPC
81 WORKDIR /usr/local/src/ispc
82 RUN cmake . \
83 -B build \
84 -DCMAKE_INSTALL_PREFIX=/usr/local \
85 -DISPC_PREPARE_PACKAGE=ON \
86 -DISPC_CROSS=ON && \
87 cmake --build build --target package -j"$(nproc)" && \
88 cmake --build build --target check-all && \
89 cmake --install build && \
90 rm -rf build