moby: update to 27.4.0.
[void-pkg.git] / common / build-style / zig-build.sh
blob5c334b1e1e5110f5256a129daf9b6b121385dbb5
1 do_build() {
2 local zig_target zig_cpu
4 # TODO: This duplication between build-profiles and cross-profiles
5 # is totally unnecessary. It would be nice if there was some way to
6 # avoid it.
7 if [ "$CROSS_BUILD" ]; then
8 zig_target="${XBPS_CROSS_ZIG_TARGET}"
9 zig_cpu="${XBPS_CROSS_ZIG_CPU}"
10 else
11 zig_target="${XBPS_ZIG_TARGET}"
12 zig_cpu="${XBPS_ZIG_CPU}"
15 # Inform zig of the required libc include paths.
16 cat > xbps_zig_libc.txt <<-EOF
17 include_dir=${XBPS_CROSS_BASE}/usr/include
18 sys_include_dir=${XBPS_CROSS_BASE}/usr/include
19 crt_dir=${XBPS_CROSS_BASE}/usr/lib
20 msvc_lib_dir=
21 kernel32_lib_dir=
22 gcc_dir=
23 EOF
25 # The Zig build system only has a single install step, there is no
26 # way to build artifacts for a given prefix and then install those artifacts
27 # to that prefix at some later time. Therefore, we build and install to the zig-out
28 # directory and later copy the artifacts to the destdir in do_install().
29 # We use zig-out to avoid path conflicts as it is the default install
30 # prefix used by the zig build system.
31 DESTDIR="zig-out" zig build \
32 -j"${XBPS_MAKEJOBS}" \
33 --sysroot "${XBPS_CROSS_BASE}" \
34 --search-prefix "${XBPS_CROSS_BASE}/usr" \
35 --prefix /usr \
36 --global-cache-dir /host/zig \
37 --libc xbps_zig_libc.txt \
38 --release=safe \
39 --verbose \
40 -Dtarget="${zig_target}" -Dcpu="${zig_cpu}" \
41 install \
42 ${configure_args}
45 do_install() {
46 cp -r zig-out/* "${DESTDIR}"