Tue Jun 27 09:30:58 2023 UTC ()
libnbcompat: Predetermine printf runtime test outcomes in configure.

This way libnbcompat can be safely cross-compiled for NetBSD, as it
should be for anything NetBSD!

While here, use CONFIGURE_ENV.${OPSYS} instead of .if ${OPSYS} == and
.if ${USE_CROSS_COMPILE:U:tl} == "yes" instead of .if
!empty(USE_CROSS_COMPILE:M[yYe][eE][sS]).


(riastradh)
diff -r1.14 -r1.15 pkgsrc/pkgtools/libnbcompat/inplace.mk

cvs diff -r1.14 -r1.15 pkgsrc/pkgtools/libnbcompat/inplace.mk (expand / switch to unified diff)

--- pkgsrc/pkgtools/libnbcompat/inplace.mk 2018/08/07 12:04:36 1.14
+++ pkgsrc/pkgtools/libnbcompat/inplace.mk 2023/06/27 09:30:58 1.15
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: inplace.mk,v 1.14 2018/08/07 12:04:36 jperkin Exp $ 1# $NetBSD: inplace.mk,v 1.15 2023/06/27 09:30:58 riastradh Exp $
2# 2#
3# This file should not be included directly. Use USE_FEATURES instead. 3# This file should not be included directly. Use USE_FEATURES instead.
4# 4#
5# This Makefile fragment builds a working copy of libnbcompat inside 5# This Makefile fragment builds a working copy of libnbcompat inside
6# ${WRKDIR}. 6# ${WRKDIR}.
7# 7#
8 8
9.include "../../mk/bsd.prefs.mk" 9.include "../../mk/bsd.prefs.mk"
10 10
11LIBNBCOMPAT_USE_PIC?= no 11LIBNBCOMPAT_USE_PIC?= no
12 12
13LIBNBCOMPAT_FILESDIR= ${.CURDIR}/../../pkgtools/libnbcompat/files 13LIBNBCOMPAT_FILESDIR= ${.CURDIR}/../../pkgtools/libnbcompat/files
14LIBNBCOMPAT_SRCDIR= ${WRKDIR}/libnbcompat 14LIBNBCOMPAT_SRCDIR= ${WRKDIR}/libnbcompat
@@ -28,34 +28,40 @@ post-extract: libnbcompat-extract @@ -28,34 +28,40 @@ post-extract: libnbcompat-extract
28.PHONY: libnbcompat-extract 28.PHONY: libnbcompat-extract
29libnbcompat-extract: 29libnbcompat-extract:
30 ${RUN} ${CP} -R ${LIBNBCOMPAT_FILESDIR} ${LIBNBCOMPAT_SRCDIR} 30 ${RUN} ${CP} -R ${LIBNBCOMPAT_FILESDIR} ${LIBNBCOMPAT_SRCDIR}
31 ${RM} -f ${LIBNBCOMPAT_SRCDIR}/config.guess ${LIBNBCOMPAT_SRCDIR}/config.sub 31 ${RM} -f ${LIBNBCOMPAT_SRCDIR}/config.guess ${LIBNBCOMPAT_SRCDIR}/config.sub
32 ${LN} -fs ${PKGSRCDIR}/mk/gnu-config/config.guess ${LIBNBCOMPAT_SRCDIR}/config.guess 32 ${LN} -fs ${PKGSRCDIR}/mk/gnu-config/config.guess ${LIBNBCOMPAT_SRCDIR}/config.guess
33 ${LN} -fs ${PKGSRCDIR}/mk/gnu-config/config.sub ${LIBNBCOMPAT_SRCDIR}/config.sub 33 ${LN} -fs ${PKGSRCDIR}/mk/gnu-config/config.sub ${LIBNBCOMPAT_SRCDIR}/config.sub
34.if !empty(LIBNBCOMPAT_USE_PIC:M[Yy][Ee][Ss]) 34.if !empty(LIBNBCOMPAT_USE_PIC:M[Yy][Ee][Ss])
35 ${RUN} ${CP} -R ${LIBNBCOMPAT_FILESDIR} ${LIBNBCOMPAT_PICDIR} 35 ${RUN} ${CP} -R ${LIBNBCOMPAT_FILESDIR} ${LIBNBCOMPAT_PICDIR}
36 ${RM} -f ${LIBNBCOMPAT_PICDIR}/config.guess ${LIBNBCOMPAT_PICDIR}/config.sub 36 ${RM} -f ${LIBNBCOMPAT_PICDIR}/config.guess ${LIBNBCOMPAT_PICDIR}/config.sub
37 ${LN} -fs ${PKGSRCDIR}/mk/gnu-config/config.guess ${LIBNBCOMPAT_PICDIR}/config.guess 37 ${LN} -fs ${PKGSRCDIR}/mk/gnu-config/config.guess ${LIBNBCOMPAT_PICDIR}/config.guess
38 ${LN} -fs ${PKGSRCDIR}/mk/gnu-config/config.sub ${LIBNBCOMPAT_PICDIR}/config.sub 38 ${LN} -fs ${PKGSRCDIR}/mk/gnu-config/config.sub ${LIBNBCOMPAT_PICDIR}/config.sub
39.endif 39.endif
40 40
41.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) 41.if ${USE_CROSS_COMPILE:U:tl} == "yes"
42NBCOMPAT_CONFIGURE_ARGS+= --build=${NATIVE_MACHINE_GNU_PLATFORM:Q} 42NBCOMPAT_CONFIGURE_ARGS+= --build=${NATIVE_MACHINE_GNU_PLATFORM:Q}
43.endif 43.endif
44NBCOMPAT_CONFIGURE_ARGS+= --host=${MACHINE_GNU_PLATFORM:Q} 44NBCOMPAT_CONFIGURE_ARGS+= --host=${MACHINE_GNU_PLATFORM:Q}
45 45
46# The illumos fts(3) implementation is not (as of August 2018) largefile aware 46# The illumos fts(3) implementation is not (as of August 2018) largefile aware
47.if ${OPSYS} == "SunOS" 47CONFIGURE_ENV.SunOS+= ac_cv_func_fts_open=no
48CONFIGURE_ENV+= ac_cv_func_fts_open=no 48
 49# NetBSD has working printf %lld and correct vsnprintf return values,
 50# which can only be detected by runtime tests, not permitted when
 51# cross-compiling.
 52.if ${USE_CROSS_COMPILE:U:tl} == "yes"
 53CONFIGURE_ENV.NetBSD+= nb_cv_printf_lld=yes
 54CONFIGURE_ENV.NetBSD+= nb_cv_std_vsnprintf=yes
49.endif 55.endif
50 56
51pre-configure: libnbcompat-build 57pre-configure: libnbcompat-build
52.PHONY: libnbcompat-build 58.PHONY: libnbcompat-build
53libnbcompat-build: 59libnbcompat-build:
54 @${STEP_MSG} "Configuring and building libnbcompat" 60 @${STEP_MSG} "Configuring and building libnbcompat"
55 ${RUN} ${_ULIMIT_CMD} \ 61 ${RUN} ${_ULIMIT_CMD} \
56 cd ${LIBNBCOMPAT_SRCDIR} && ${SETENV} \ 62 cd ${LIBNBCOMPAT_SRCDIR} && ${SETENV} \
57 AWK=${AWK:Q} CC=${CC:Q} CFLAGS=${CFLAGS:M*:Q} \ 63 AWK=${AWK:Q} CC=${CC:Q} CFLAGS=${CFLAGS:M*:Q} \
58 CPPFLAGS=${CPPFLAGS:M*:Q} \ 64 CPPFLAGS=${CPPFLAGS:M*:Q} \
59 ${CONFIGURE_ENV:NLIBS=*} ${CONFIG_SHELL} \ 65 ${CONFIGURE_ENV:NLIBS=*} ${CONFIG_SHELL} \
60 ${CONFIGURE_SCRIPT} ${NBCOMPAT_CONFIGURE_ARGS} && \ 66 ${CONFIGURE_SCRIPT} ${NBCOMPAT_CONFIGURE_ARGS} && \
61 ${SETENV} ${MAKE_ENV} ${MAKE} -j${MAKE_JOBS:U1:Q} 67 ${SETENV} ${MAKE_ENV} ${MAKE} -j${MAKE_JOBS:U1:Q}