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
7 if [ "$CROSS_BUILD" ]; then
8 zig_target
="${XBPS_CROSS_ZIG_TARGET}"
9 zig_cpu
="${XBPS_CROSS_ZIG_CPU}"
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
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 \
40 cp -r zig-out
/* "${DESTDIR}"