8560be0ed3
Almost all uses, if not all of them, are wrong, according to the semantics of BUILD_DEPENDS (packages built for target available for use _by_ tools at build-time) and TOOL_DEPEPNDS (packages built for host available for use _as_ tools at build-time). No change to BUILD_DEPENDS as used correctly inside buildlink3. As proposed on tech-pkg: https://mail-index.netbsd.org/tech-pkg/2023/06/03/msg027632.html
50 lines
1.8 KiB
Makefile
50 lines
1.8 KiB
Makefile
# $NetBSD: application.mk,v 1.6 2023/06/06 12:41:47 riastradh Exp $
|
|
#
|
|
# Common logic to handle zig packages
|
|
# This is only usable if they include a 'build.zig' file
|
|
#
|
|
.include "../../mk/bsd.fast.prefs.mk"
|
|
|
|
# https://github.com/ziglang/zig/issues/3382
|
|
# For now, Zig doesn't support CFLAGS/LDFLAGS/etc.
|
|
|
|
# Debug build (default):
|
|
# Fast compilation speed, Safety checks enabled, Slow runtime performance
|
|
# Large binary size, No reproducible build requirement
|
|
# ReleaseFast (-Drelease-fast)
|
|
# Fast runtime performance, Safety checks disabled, Slow compilation speed
|
|
# Large binary size, Reproducible build
|
|
# ReleaseSafe (-Drelease-safe=true)
|
|
# Medium runtime performance, Safety checks enabled, Slow compilation speed
|
|
# Large binary size, Reproducible build
|
|
# ReleaseSmall (-Drelease-small=true)
|
|
# Medium runtime performance, Safety checks disabled, Slow compilation speed
|
|
# Small binary size
|
|
ZIGBUILDMODE?= -Drelease-safe=true
|
|
ZIGCPUMODE?= -Dcpu=baseline
|
|
ZIGBUILDARGS?=
|
|
ZIGTESTARGS?=
|
|
|
|
TOOL_DEPENDS+= zig-[0-9]*:../../lang/zig
|
|
USE_LANGUAGES= c
|
|
|
|
#MAKE_ENV+= ZIG_GLOBAL_CACHE_DIR=${WRKSRC}/tmp
|
|
# \todo: There is currently an issue building zig packages as RELRO.
|
|
#RELRO_SUPPORTED= no
|
|
|
|
# figure out how to do this for all zig packages:
|
|
#ZIGBUILDARGS+= -Dpie=true
|
|
#.if ${MKDEBUG:Uyes:M[yY][eE][sS]} && ${INSTALL_UNSTRIPPED:Uyes:tl} == yes
|
|
#ZIGBUILDARGS+= -Dstrip=true
|
|
#.endif
|
|
|
|
do-build:
|
|
mkdir ${WRKSRC}/tmp
|
|
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} zig build ${ZIGBUILDMODE} ${ZIGCPUMODE} ${ZIGBUILDARGS} --prefix ${DESTDIR}${PREFIX}
|
|
|
|
do-install:
|
|
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} zig build install ${ZIGBUILDMODE} ${ZIGCPUMODE} ${ZIGBUILDARGS} --prefix ${DESTDIR}${PREFIX}
|
|
|
|
do-test:
|
|
cd ${WRKSRC} && ${SETENV} ${TEST_ENV} zig build ${ZIGBUILDMODE} ${ZIGBUILDARGS} ${ZIGCPUMODE} ${ZIGTESTARGS} test
|