xz: update to 5.6.2.
[void-pkg.git] / common / build-style / zig-build.sh
blob205c4cadf53f8c92ac42e561b21ab07ab8f2ac6b
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 --sysroot "${XBPS_CROSS_BASE}" \
33 --libc xbps_zig_libc.txt \
34 -Dtarget="${zig_target}" -Dcpu="${zig_cpu}" \
35 -Drelease-safe --prefix /usr install \
36 ${configure_args}
39 do_install() {
40 cp -r zig-out/* "${DESTDIR}"