pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk Add a "system features" framework that will eventua...
details: https://anonhg.NetBSD.org/pkgsrc/rev/6a378830f4c0
branches: trunk
changeset: 533069:6a378830f4c0
user: jlam <jlam%pkgsrc.org@localhost>
date: Fri Sep 07 21:55:44 2007 +0000
description:
Add a "system features" framework that will eventually be used to
automatically supply missing "basic" headers and libraries from an
older system, e.g. IRIX 5.x or Interix or AIX, etc.
Example usage:
USE_FEATURES+= snprintf glob regex
For now, we just pull in libnbcompat to supply the missing bits.
diffstat:
mk/bsd.pkg.mk | 4 +-
mk/bsd.prefs.mk | 5 ++-
mk/features/features-vars.mk | 82 ++++++++++++++++++++++++++++++++++++++++++++
mk/features/features.mk | 50 ++++++++++++++++++++++++++
4 files changed, 139 insertions(+), 2 deletions(-)
diffs (177 lines):
diff -r ada2e518cc79 -r 6a378830f4c0 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk Fri Sep 07 21:30:33 2007 +0000
+++ b/mk/bsd.pkg.mk Fri Sep 07 21:55:44 2007 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1923 2007/09/07 15:51:53 rillig Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1924 2007/09/07 21:55:44 jlam Exp $
#
# This file is in the public domain.
#
@@ -25,6 +25,8 @@
. include "${.PARSEDIR}/emulator/emulator.mk"
.endif
+.include "${.PARSEDIR}/features/features.mk"
+
.include "${.PARSEDIR}/flavor/bsd.flavor-vars.mk"
.include "${.PARSEDIR}/check/bsd.check-vars.mk"
.include "${.PARSEDIR}/depends/bsd.depends-vars.mk"
diff -r ada2e518cc79 -r 6a378830f4c0 mk/bsd.prefs.mk
--- a/mk/bsd.prefs.mk Fri Sep 07 21:30:33 2007 +0000
+++ b/mk/bsd.prefs.mk Fri Sep 07 21:55:44 2007 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.prefs.mk,v 1.265 2007/08/17 20:27:30 joerg Exp $
+# $NetBSD: bsd.prefs.mk,v 1.266 2007/09/07 21:55:44 jlam Exp $
#
# This file includes the mk.conf file, which contains the user settings.
#
@@ -619,6 +619,9 @@
. include "${PKGSRCDIR}/mk/emulator/emulator-vars.mk"
.endif
+# System features framework
+.include "${PKGSRCDIR}/mk/features/features-vars.mk"
+
# Package system flavor definitions
.include "${PKGSRCDIR}/mk/flavor/bsd.flavor-vars.mk"
diff -r ada2e518cc79 -r 6a378830f4c0 mk/features/features-vars.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/features/features-vars.mk Fri Sep 07 21:55:44 2007 +0000
@@ -0,0 +1,82 @@
+# $NetBSD: features-vars.mk,v 1.1 2007/09/07 21:55:46 jlam Exp $
+#
+# This file is include by bsd.prefs.mk.
+#
+# Package-settable variables:
+#
+# USE_FEATURES
+# Lists the system features required by the package.
+#
+# Default value: undefined
+#
+# Variables defined by this file:
+#
+# MISSING_FEATURES
+# The features listed in USE_FEATURES that are missing on the
+# current system. Also includes "inet6" if the system doesn't
+# support IPv6.
+#
+
+MISSING_FEATURES= # empty
+
+#
+# Handle "inet6" feature specially -- we always add it to
+# MISSING_FEATURES if the operating system doesn't support IPv6,
+# regardless of whether or not "inet6" is a requested feature
+# in USE_FEATURES.
+#
+.if defined(_OPSYS_HAS_INET6) && empty(_OPSYS_HAS_INET6:M[nN][oO])
+MISSING_FEATURES+= inet6
+.endif
+
+.for _feature_ in err warn
+. if defined(USE_FEATURES) && !empty(USE_FEATURES:M${_feature_})
+. if (${OPSYS} != NetBSD) && (${OPSYS} != FreeBSD) && (${OPSYS} != DragonFly)
+MISSING_FEATURES+= ${_feature_}
+. endif
+. endif
+.endfor
+
+.if defined(USE_FEATURES) && !empty(USE_FEATURES:Mgetopt_long)
+. if !exists(/usr/include/getopt.h)
+MISSING_FEATURES+= getopt_long
+. endif
+.endif
+
+.for _feature_ in getprogname setprogname
+. if defined(USE_FEATURES) && !empty(USE_FEATURES:M${_feature_})
+. if (${OPSYS} != NetBSD) && (${OPSYS} != FreeBSD) && (${OPSYS} != DragonFly)
+MISSING_FEATURES+= ${_feature_}
+. endif
+. endif
+.endfor
+
+.if defined(USE_FEATURES) && !empty(USE_FEATURES:Mglob)
+. if !exists(/usr/include/glob.h)
+MISSING_FEATURES+= glob
+. endif
+.endif
+
+.if defined(USE_FEATURES) && !empty(USE_FEATURES:Mregex)
+. if !exists(/usr/include/regex.h)
+MISSING_FEATURES+= regex
+. endif
+.endif
+
+.for _feature_ in snprintf vsnprintf
+. if defined(USE_FEATURES) && !empty(USE_FEATURES:M${_feature_})
+. if !empty(LOWER_OPSYS:Mirix5*)
+MISSING_FEATURES+= snprintf
+. endif
+. endif
+.endfor
+
+.if defined(USE_FEATURES) && !empty(USE_FEATURES:Mutimes)
+. if ${OPSYS} == "Interix"
+MISSING_FEATURES+= utimes
+. endif
+.endif
+
+.if defined(USE_FEATURES) && !empty(USE_FEATURES:Mnbcompat)
+MISSING_FEATURES+= nbcompat
+.endif
diff -r ada2e518cc79 -r 6a378830f4c0 mk/features/features.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/features/features.mk Fri Sep 07 21:55:44 2007 +0000
@@ -0,0 +1,50 @@
+# $NetBSD: features.mk,v 1.1 2007/09/07 21:55:47 jlam Exp $
+#
+# This file is included by bsd.pkg.mk.
+#
+# Variables defined by this file:
+#
+# FEATURE_CPPFLAGS
+# FEATURE_LDFLAGS
+# FEATURE_LIBS
+# Preprocessor and linker flags needed to build and to link against
+# the headers and libraries that supply the features missing from
+# the system.
+#
+
+.if defined(MISSING_FEATURES)
+#
+# Handle "inet6" feature specially -- "inet6" could be in
+# MISSING_FEATURES even though it's not requested in USE_FEATURES
+# so check that it appears in both before failing the package
+# build.
+#
+. if defined(USE_FEATURES) && !empty(USE_FEATURES:Minet6)
+. if !empty(MISSING_FEATURES:Minet6)
+PKG_FAIL_REASON+= "${PKGNAME} requires IPv6 support"
+. endif
+. endif
+
+FEATURE_CPPFLAGS= # empty
+FEATURE_LDFLAGS= # empty
+FEATURE_LIBS= # empty
+
+. if !empty(MISSING_FEATURES:Merr) || \
+ !empty(MISSING_FEATURES:Mgetopt_long) || \
+ !empty(MISSING_FEATURES:Mglob) || \
+ !empty(MISSING_FEATURES:Mnbcompat) || \
+ !empty(MISSING_FEATURES:Mregex) || \
+ !empty(MISSING_FEATURES:Msnprintf) || \
+ !empty(MISSING_FEATURES:Mutimes) || \
+ !empty(MISSING_FEATURES:Mvsnprintf) || \
+ !empty(MISSING_FEATURES:Mwarn)
+_FEATURE_NEED_NBCOMPAT= yes
+. endif
+_FEATURE_NEED_NBCOMPAT?= no
+
+. if ${_FEATURE_NEED_NBCOMPAT} == "yes"
+. include "${PKGSRCDIR}/pkgtools/libnbcompat/inplace.mk"
+FEATURE_LIBS+= ${LDADD.nbcompat}
+. endif
+
+.endif # MISSING_FEATURES
Home |
Main Index |
Thread Index |
Old Index