@@ -3,23 +3,36 @@ VERSION 0.8
3
3
# Tweak the default container registry used for pulling system images.
4
4
ARG --global default_container_registry = "docker.io"
5
5
6
- build :
6
+ init :
7
7
ARG --required from
8
+ # Toggle the building of test programs
9
+ ARG test = true
10
+ # Toggle whether we use vcpkg to obtain dependencies
11
+ ARG use_vcpkg = true
8
12
FROM --pass-args $from
9
- DO --pass-args +BOOTSTRAP_BUILD_INSTALL_EXPORT
13
+ DO --pass-args +INSTALL_DEPS
14
+
15
+ build :
16
+ ARG warnings_as_errors = true
17
+ ARG configs = Debug
18
+ ARG test = true
19
+ ARG use_vcpkg = true
20
+ FROM --pass-args +init
21
+ DO --pass-args +BUILD_INSTALL_EXPORT
10
22
11
23
test :
12
24
FROM --pass-args +build
13
25
RUN uv run --group = build \
14
26
make ctest-run TEST_CONFIG= Debug JUNIT_OUTPUT= /results.xml || :
15
27
SAVE ARTIFACT /results.xml
16
28
29
+ # Target used to install LLVM for a build. Not used outside this file
17
30
env.llvm :
18
31
ARG --required llvm_major_version
19
32
# LLVM doesn't provide a container, so we just use Ubuntu and the automated
20
33
# LLVM installser script to get the appropriate major version
21
34
FROM $default_container_registry/ubuntu:24.04
22
- DO +INIT
35
+ DO +BASE
23
36
# Required for the LLVM installer:
24
37
RUN __install lsb-release software-properties-common gnupg
25
38
# Install the major version using the automated LLVM installer:
@@ -29,28 +42,6 @@ env.llvm:
29
42
ENV CC= clang-$llvm_major_version
30
43
ENV CXX= clang++-$llvm_major_version
31
44
32
- build-rl :
33
- FROM $default_container_registry/rockylinux:8
34
- RUN dnf -y install epel-release unzip
35
- LET cmake_url = "https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.30.3-linux-x86_64.sh"
36
- RUN curl "$cmake_url" -Lo cmake.sh && \
37
- sh cmake.sh --exclude-subdir --prefix = /usr/local/ --skip-license
38
- LET ninja_url = "https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-linux.zip"
39
- RUN curl -L "$ninja_url" -o ninja.zip && \
40
- unzip ninja.zip -d /usr/local/bin/
41
- CACHE ~/.ccache # Epel Ccache still uses the old cache location
42
- DO --pass-args +BOOTSTRAP_BUILD_INSTALL_EXPORT \
43
- --launcher "scl run gcc-toolset-12 --" \
44
- --build_deps "gcc-toolset-12 python3.12 ccache" \
45
- --vcpkg_bs_deps "zip unzip git perl"
46
-
47
- build-fedora :
48
- FROM $default_container_registry/fedora:41
49
- DO --pass-args +BOOTSTRAP_BUILD_INSTALL_EXPORT \
50
- --build_deps "cmake ninja-build git gcc gcc-c++ python3.12 ccache" \
51
- --vcpkg_bs_deps "zip unzip perl" \
52
- --third_deps "boost-devel boost-url fmt-devel openssl-devel"
53
-
54
45
build-multi :
55
46
FROM $default_container_registry/alpine
56
47
# COPY +build-rl/ out/rl/ ## XXX: Redhat build is broken: Investigate GCC linker issues
@@ -59,24 +50,23 @@ build-multi:
59
50
COPY (+build-fedora/ --use_vcpkg = false) out/fedora/
60
51
SAVE ARTIFACT out/* /
61
52
62
- matrix :
63
- BUILD +run \
64
- --target +build-debian --target +build-alpine --target +build-fedora \
65
- --use_vcpkg = true --use_vcpkg = false \
66
- --test = false --test = true
67
-
68
53
run :
69
54
LOCALLY
70
55
ARG --required target
71
56
BUILD --pass-args $target
72
57
73
58
# Miscellaneous system init
74
- INIT :
59
+ BASE :
75
60
FUNCTION
76
61
COPY --chmod = 755 tools/__tool /usr/local/bin/__tool
77
62
RUN __tool __init
78
63
# Basic requirements to even function:
79
- RUN __install lsb-release curl
64
+ IF test -f /etc/redhat-release && ! test -f /etc/fedora-release
65
+ # Install EPEL on RHEL-based platforms
66
+ RUN __install epel-release
67
+ END
68
+ RUN __install lsb-release && \
69
+ (curl --version || __install curl)
80
70
81
71
# Obtain uv
82
72
ARG uv_version = "0.8.15"
@@ -88,20 +78,18 @@ INIT:
88
78
&& uv --version
89
79
END
90
80
91
- BOOTSTRAP_BUILD_INSTALL_EXPORT :
81
+ BUILD_INSTALL_EXPORT :
92
82
FUNCTION
93
- # Bootstrap
94
- DO --pass-args +BOOTSTRAP_DEPS
95
83
# Build and install
96
84
DO --pass-args +BUILD --install_prefix = /opt/amongoc --cpack_out = /tmp/pkg
97
85
# Export
98
86
SAVE ARTIFACT /tmp/pkg/* /pkg/
99
87
SAVE ARTIFACT /opt/amongoc/* /install/
100
88
101
89
# Install dependencies, possibly warming up the user-local vcpkg cache if vcpkg is used
102
- BOOTSTRAP_DEPS :
90
+ INSTALL_DEPS :
103
91
FUNCTION
104
- DO +INIT
92
+ DO +BASE
105
93
# Do we want to use vcpkg?
106
94
ARG use_vcpkg= true
107
95
# Are we installing test-only dependencies?
@@ -138,6 +126,15 @@ BOOTSTRAP_DEPS:
138
126
END
139
127
ELSE IF test -f /etc/redhat-release
140
128
RUN __install python3.12 ccache gcc gcc-c++
129
+ # Specify a version of the GCC toolset to be installed, available in
130
+ # RHEL-based systems ≤9.x
131
+ ARG gts_version
132
+ IF test "$gts_version" != ''
133
+ RUN __install scl-utils gcc-toolset-$gts_version
134
+ ENV LAUNCHER = "scl run gcc-toolset-$gts_version -- "
135
+ ELSE
136
+ RUN __install gcc gcc-c++
137
+ END
141
138
IF __bool $use_vcpkg
142
139
RUN __install zip unzip perl git
143
140
ELSE
@@ -165,8 +162,7 @@ BOOTSTRAP_DEPS:
165
162
" > $src_tmp /CMakeLists.txt
166
163
# Running CMake now will prepare our dependencies without configuring the rest of the project
167
164
CACHE ~/.cache/vcpkg
168
- ARG launcher
169
- RUN $launcher uv run --with = cmake~= 3.20 --with = ninja cmake -G Ninja -S $src_tmp -B $src_tmp /_build/vcpkg-bootstrapping
165
+ RUN $LAUNCHER uv run --with = cmake~= 3.20 --with = ninja cmake -G Ninja -S $src_tmp -B $src_tmp /_build/vcpkg-bootstrapping
170
166
END
171
167
172
168
COPY_SRC :
@@ -179,18 +175,13 @@ BUILD:
179
175
FUNCTION
180
176
ARG install_prefix
181
177
ARG cpack_out
182
- ARG launcher
183
178
DO +COPY_SRC
184
- # Toggle testing
185
- ARG test= true
186
- # Enable -Werror
187
- ARG warnings_as_errors= true
188
- # Toggle PMM in the build
189
- ARG use_vcpkg= true
190
- # The configurations to build (semicolon-separated list)
191
- ARG configs= Debug
179
+ ARG --required test
180
+ ARG --required warnings_as_errors
181
+ ARG --required use_vcpkg
182
+ ARG --required configs
192
183
# Configure
193
- RUN $launcher uv run --group = build \
184
+ RUN $LAUNCHER uv run --group = build \
194
185
make build \
195
186
CONFIGS= "$configs" \
196
187
INSTALL_PREFIX= $install_prefix \
@@ -199,12 +190,12 @@ BUILD:
199
190
BUILD_TESTING= $(__boolstr $test )
200
191
IF test "$install_prefix" != ""
201
192
FOR conf IN Debug # Release RelWithDebInfo
202
- RUN $launcher uv run --group = build \
193
+ RUN $LAUNCHER uv run --group = build \
203
194
make install-fast INSTALL_PREFIX= $install_prefix INSTALL_CONFIG= $conf
204
195
END
205
196
END
206
197
IF test "$cpack_out" != ""
207
- RUN $launcher uv run --group = build \
198
+ RUN $LAUNCHER uv run --group = build \
208
199
make package-fast \
209
200
CPACK_OUT= "$cpack_out" \
210
201
PACKAGE_CONFIGS= "$configs"
0 commit comments