Mon Jul 8 22:09:22 2019 UTC ()
Support USE_FEATURES=strnlen to provide an implementation of strnlen(3) via libnbcompat, should the host OS lack support


(sevan)
diff -r1.24 -r1.25 pkgsrc/mk/features/features-vars.mk
diff -r1.8 -r1.9 pkgsrc/mk/features/features.mk

cvs diff -r1.24 -r1.25 pkgsrc/mk/features/features-vars.mk (expand / switch to unified diff)

--- pkgsrc/mk/features/features-vars.mk 2018/11/30 18:38:19 1.24
+++ pkgsrc/mk/features/features-vars.mk 2019/07/08 22:09:22 1.25
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: features-vars.mk,v 1.24 2018/11/30 18:38:19 rillig Exp $ 1# $NetBSD: features-vars.mk,v 1.25 2019/07/08 22:09:22 sevan Exp $
2# 2#
3# The platforms that are supported by pkgsrc differ in the amount of 3# The platforms that are supported by pkgsrc differ in the amount of
4# functions they provide in the C library (libc). Functions that are 4# functions they provide in the C library (libc). Functions that are
5# typically available on NetBSD are provided in the libnbcompat package. 5# typically available on NetBSD are provided in the libnbcompat package.
6# 6#
7# This file defines a set of "features" that some packages require. 7# This file defines a set of "features" that some packages require.
8# Whenever a package makes use of them, it should list the features in 8# Whenever a package makes use of them, it should list the features in
9# the USE_FEATURES variable. (It serves a similar purpose as USE_TOOLS.) 9# the USE_FEATURES variable. (It serves a similar purpose as USE_TOOLS.)
10# 10#
11# The *.c files that use the features must be patched a little. When 11# The *.c files that use the features must be patched a little. When
12# there are missing features, the C preprocessor macro HAVE_NBCOMPAT_H 12# there are missing features, the C preprocessor macro HAVE_NBCOMPAT_H
13# will be defined to 1. In this case, the headers from the nbcompat 13# will be defined to 1. In this case, the headers from the nbcompat
14# directory must be included. 14# directory must be included.
@@ -36,42 +36,43 @@ @@ -36,42 +36,43 @@
36# 36#
37# Possible: 37# Possible:
38# * asprintf: The functions asprintf and vasprintf. 38# * asprintf: The functions asprintf and vasprintf.
39# * cdefs: The header sys/cdefs.h. 39# * cdefs: The header sys/cdefs.h.
40# * err: The functions err, verr, errx, verrx. 40# * err: The functions err, verr, errx, verrx.
41# * warn: The functions warn, vwarn, warnx, vwarnx. 41# * warn: The functions warn, vwarn, warnx, vwarnx.
42# * fts_close, fts_open, fts_read, fts_set: Functions 42# * fts_close, fts_open, fts_read, fts_set: Functions
43# for filesystem traversal. 43# for filesystem traversal.
44# * getopt_long: The GNU version of getopt. 44# * getopt_long: The GNU version of getopt.
45# * getprogname, setprogname 45# * getprogname, setprogname
46# * glob 46# * glob
47# * regcomp 47# * regcomp
48# * snprintf, vsnprintf 48# * snprintf, vsnprintf
 49# * strnlen
49# * utimes 50# * utimes
50# * nbcompat: All of the above. 51# * nbcompat: All of the above.
51# 52#
52# Default value: undefined 53# Default value: undefined
53# 54#
54# === Variables defined by this file === 55# === Variables defined by this file ===
55# 56#
56# MISSING_FEATURES 57# MISSING_FEATURES
57# The features listed in USE_FEATURES that are missing on the 58# The features listed in USE_FEATURES that are missing on the
58# current system. Also includes "inet6" if the system doesn't 59# current system. Also includes "inet6" if the system doesn't
59# support IPv6. 60# support IPv6.
60# 61#
61# Keywords: feature features asprintf vasprintf cdefs err errx warn warnx 62# Keywords: feature features asprintf vasprintf cdefs err errx warn warnx
62# Keywords: fts fts_open fts_read fts_set fts_close getopt_long 63# Keywords: fts fts_open fts_read fts_set fts_close getopt_long
63# Keywords: getprogname setprogname glob regcomp setenv snprintf vsnprintf 64# Keywords: getprogname setprogname glob regcomp setenv snprintf strnlen
64# Keywords: utimes libnbcompat nbcompat 65# Keywords: vsnprintf utimes libnbcompat nbcompat
65 66
66_VARGROUPS+= features 67_VARGROUPS+= features
67_USER_VARS.features= # none 68_USER_VARS.features= # none
68_PKG_VARS.features= USE_FEATURES 69_PKG_VARS.features= USE_FEATURES
69_SYS_VARS.features= MISSING_FEATURES 70_SYS_VARS.features= MISSING_FEATURES
70_SORTED_VARS.features= *S 71_SORTED_VARS.features= *S
71 72
72MISSING_FEATURES= # empty 73MISSING_FEATURES= # empty
73USE_FEATURES?= # none 74USE_FEATURES?= # none
74 75
75# 76#
76# Handle "inet6" feature specially -- we always add it to 77# Handle "inet6" feature specially -- we always add it to
77# MISSING_FEATURES if the operating system doesn't support IPv6, 78# MISSING_FEATURES if the operating system doesn't support IPv6,
@@ -173,24 +174,28 @@ MISSING_FEATURES+= ${_feature_} @@ -173,24 +174,28 @@ MISSING_FEATURES+= ${_feature_}
173. endif 174. endif
174. endif 175. endif
175.endfor 176.endfor
176 177
177.for _feature_ in snprintf vsnprintf 178.for _feature_ in snprintf vsnprintf
178. if !empty(USE_FEATURES:M${_feature_}) 179. if !empty(USE_FEATURES:M${_feature_})
179. if ${OPSYS} == "IRIX" || !empty(MACHINE_PLATFORM:MHPUX-11.11-hppa) \ 180. if ${OPSYS} == "IRIX" || !empty(MACHINE_PLATFORM:MHPUX-11.11-hppa) \
180 || ${OS_VARIANT} == "SCOOSR5" 181 || ${OS_VARIANT} == "SCOOSR5"
181MISSING_FEATURES+= ${_feature_} 182MISSING_FEATURES+= ${_feature_}
182. endif 183. endif
183. endif 184. endif
184.endfor 185.endfor
185 186
 187.if !empty(USE_FEATURES:Mstrnlen)
 188MISSING_FEATURES+= strnlen
 189.endif
 190
186.for _feature_ in utimes 191.for _feature_ in utimes
187. if !empty(USE_FEATURES:M${_feature_}) 192. if !empty(USE_FEATURES:M${_feature_})
188. if ${OPSYS} == "Interix" 193. if ${OPSYS} == "Interix"
189MISSING_FEATURES+= ${_feature_} 194MISSING_FEATURES+= ${_feature_}
190. endif 195. endif
191. endif 196. endif
192.endfor 197.endfor
193 198
194.if !empty(USE_FEATURES:Mnbcompat) 199.if !empty(USE_FEATURES:Mnbcompat)
195MISSING_FEATURES+= nbcompat 200MISSING_FEATURES+= nbcompat
196.endif 201.endif

cvs diff -r1.8 -r1.9 pkgsrc/mk/features/features.mk (expand / switch to unified diff)

--- pkgsrc/mk/features/features.mk 2015/01/01 07:51:47 1.8
+++ pkgsrc/mk/features/features.mk 2019/07/08 22:09:22 1.9
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: features.mk,v 1.8 2015/01/01 07:51:47 dholland Exp $ 1# $NetBSD: features.mk,v 1.9 2019/07/08 22:09:22 sevan Exp $
2# 2#
3# This file is included by bsd.pkg.mk. 3# This file is included by bsd.pkg.mk.
4# 4#
5# Variables defined by this file: 5# Variables defined by this file:
6# 6#
7# FEATURE_CPPFLAGS 7# FEATURE_CPPFLAGS
8# FEATURE_LDFLAGS 8# FEATURE_LDFLAGS
9# FEATURE_LIBS 9# FEATURE_LIBS
10# Preprocessor and linker flags needed to build and to link against 10# Preprocessor and linker flags needed to build and to link against
11# the headers and libraries that supply the features missing from 11# the headers and libraries that supply the features missing from
12# the system. 12# the system.
13# 13#
14 14
@@ -26,27 +26,27 @@ PKG_SKIP_REASON+= "${PKGNAME} requires I @@ -26,27 +26,27 @@ PKG_SKIP_REASON+= "${PKGNAME} requires I
26. endif 26. endif
27 27
28FEATURE_CPPFLAGS= # empty 28FEATURE_CPPFLAGS= # empty
29FEATURE_LDFLAGS= # empty 29FEATURE_LDFLAGS= # empty
30FEATURE_LIBS= # empty 30FEATURE_LIBS= # empty
31 31
32CPPFLAGS+= ${FEATURE_CPPFLAGS} 32CPPFLAGS+= ${FEATURE_CPPFLAGS}
33LDFLAGS+= ${FEATURE_LDFLAGS} 33LDFLAGS+= ${FEATURE_LDFLAGS}
34LIBS+= ${FEATURE_LIBS} 34LIBS+= ${FEATURE_LIBS}
35 35
36# libnbcompat provides many of the current features. 36# libnbcompat provides many of the current features.
37# 37#
38_FEATURE_USE_NBCOMPAT?= no 38_FEATURE_USE_NBCOMPAT?= no
39. for f in asprintf cdefs err fts_close fts_open fts_read fts_set getopt_long glob nbcompat regcomp setenv snprintf utimes vsnprintf warn 39. for f in asprintf cdefs err fts_close fts_open fts_read fts_set getopt_long glob nbcompat regcomp setenv snprintf strnlen utimes vsnprintf warn
40. if !empty(MISSING_FEATURES:M${f}) 40. if !empty(MISSING_FEATURES:M${f})
41_FEATURE_USE_NBCOMPAT= yes 41_FEATURE_USE_NBCOMPAT= yes
42. endif 42. endif
43. endfor 43. endfor
44 44
45. if ${_FEATURE_USE_NBCOMPAT} == "yes" 45. if ${_FEATURE_USE_NBCOMPAT} == "yes"
46. include "${PKGSRCDIR}/pkgtools/libnbcompat/inplace.mk" 46. include "${PKGSRCDIR}/pkgtools/libnbcompat/inplace.mk"
47FEATURE_CPPFLAGS+= ${CPPFLAGS.nbcompat} 47FEATURE_CPPFLAGS+= ${CPPFLAGS.nbcompat}
48FEATURE_LDFLAGS+= ${LDFLAGS.nbcompat} 48FEATURE_LDFLAGS+= ${LDFLAGS.nbcompat}
49FEATURE_LIBS+= ${LDADD.nbcompat} 49FEATURE_LIBS+= ${LDADD.nbcompat}
50. endif 50. endif
51 51
52. if (${_FEATURE_USE_NBCOMPAT} == "yes") && !empty(MISSING_FEATURES:Mcdefs) 52. if (${_FEATURE_USE_NBCOMPAT} == "yes") && !empty(MISSING_FEATURES:Mcdefs)