summaryrefslogtreecommitdiff
path: root/devel
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2004-03-10 17:57:14 +0000
committerjlam <jlam@pkgsrc.org>2004-03-10 17:57:14 +0000
commitd0b4c54eb698e718080690cf98ab5b8bbb4001e0 (patch)
tree1226d07b8f66083168895189decc88848b70903f /devel
parent9d61fef8537aed11013bf556e319b2d8e398a11b (diff)
downloadpkgsrc-d0b4c54eb698e718080690cf98ab5b8bbb4001e0.tar.gz
Split out the code that deals with checking whether the software is
built-in or not into a separate builtin.mk file. The code to deal checking for built-in software is much simpler to deal with in pkgsrc. The buildlink3.mk file for a package will be of the usual format regardless of the package, which makes it simpler for packagers to update a package. The builtin.mk file for a package must define a single yes/no variable USE_BUILTIN.<pkg> that is used by bsd.buildlink3.mk to decide whether to use the built-in software or to use the pkgsrc software.
Diffstat (limited to 'devel')
-rw-r--r--devel/binutils/buildlink3.mk82
-rw-r--r--devel/binutils/builtin.mk44
-rw-r--r--devel/gettext-lib/buildlink3.mk155
-rw-r--r--devel/gettext-lib/builtin.mk146
-rw-r--r--devel/libgetopt/buildlink3.mk56
-rw-r--r--devel/libgetopt/builtin.mk26
-rw-r--r--devel/ncurses/buildlink3.mk168
-rw-r--r--devel/ncurses/builtin.mk133
-rw-r--r--devel/readline/buildlink3.mk153
-rw-r--r--devel/readline/builtin.mk116
-rw-r--r--devel/zlib/buildlink3.mk110
-rw-r--r--devel/zlib/builtin.mk81
12 files changed, 597 insertions, 673 deletions
diff --git a/devel/binutils/buildlink3.mk b/devel/binutils/buildlink3.mk
index e240ae1c192..ab6ed1cfa74 100644
--- a/devel/binutils/buildlink3.mk
+++ b/devel/binutils/buildlink3.mk
@@ -1,87 +1,19 @@
-# $NetBSD: buildlink3.mk,v 1.13 2004/02/18 16:35:27 jlam Exp $
+# $NetBSD: buildlink3.mk,v 1.14 2004/03/10 17:57:14 jlam Exp $
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
BINUTILS_BUILDLINK3_MK:= ${BINUTILS_BUILDLINK3_MK}+
-.include "../../mk/bsd.prefs.mk"
+.if !empty(BUILDLINK_DEPTH:M+)
+BUILDLINK_DEPENDS+= binutils
+.endif
+
+BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Nbinutils}
+BUILDLINK_PACKAGES+= binutils
.if !empty(BINUTILS_BUILDLINK3_MK:M+)
-BUILDLINK_PACKAGES+= binutils
BUILDLINK_DEPENDS.binutils+= binutils>=2.14.0
BUILDLINK_PKGSRCDIR.binutils?= ../../devel/binutils
BUILDLINK_DEPMETHOD.binutils?= build
.endif # BINUTILS_BUILDLINK3_MK
-BUILDLINK_CHECK_BUILTIN.binutils?= NO
-
-.if !defined(BUILDLINK_IS_BUILTIN.binutils)
-BUILDLINK_IS_BUILTIN.binutils= YES
-. if !empty(BUILDLINK_CHECK_BUILTIN.binutils:M[nN][oO])
-#
-# These versions of NetBSD didn't have a toolchain that was capable of
-# replacing binutils.
-#
-_INCOMPAT_BINUTILS= NetBSD-0.*-* NetBSD-1.[01234]*-*
-_INCOMPAT_BINUTILS+= NetBSD-1.5.*-* NetBSD-1.5[A-X]-*
-#
-# XXX: _INCOMPAT_BINUTILS settings for other operating systems possibly
-# XXX: needed here
-#
-INCOMPAT_BINUTILS?= # empty
-. for _pattern_ in ${_INCOMPAT_BINUTILS} ${INCOMPAT_BINUTILS}
-. if !empty(MACHINE_PLATFORM:M${_pattern_})
-BUILDLINK_IS_BUILTIN.binutils= NO
-. endif
-. endfor
-. endif
-MAKEFLAGS+= BUILDLINK_IS_BUILTIN.binutils=${BUILDLINK_IS_BUILTIN.binutils}
-.endif
-
-.if !empty(BUILDLINK_CHECK_BUILTIN.binutils:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.binutils= YES
-.endif
-
-.if !defined(BUILDLINK_USE_BUILTIN.binutils)
-. if !empty(BUILDLINK_IS_BUILTIN.binutils:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.binutils= YES
-. else
-BUILDLINK_USE_BUILTIN.binutils= NO
-. endif
-
-. if !empty(PREFER_NATIVE:M[yY][eE][sS]) && \
- !empty(BUILDLINK_IS_BUILTIN.binutils:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.binutils= YES
-. endif
-. if !empty(PREFER_PKGSRC:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.binutils= NO
-. endif
-. if !empty(PREFER_NATIVE:Mbinutils) && \
- !empty(BUILDLINK_IS_BUILTIN.binutils:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.binutils= YES
-. endif
-. if !empty(PREFER_PKGSRC:Mbinutils)
-BUILDLINK_USE_BUILTIN.binutils= NO
-. endif
-
-. if defined(USE_BINUTILS)
-BUILDLINK_USE_BUILTIN.binutils= NO
-. endif
-.endif
-
-.if !empty(BUILDLINK_USE_BUILTIN.binutils:M[nN][oO])
-. if !empty(BUILDLINK_DEPTH:M+)
-BUILDLINK_DEPENDS+= binutils
-. endif
-.endif
-
-.if !empty(BINUTILS_BUILDLINK3_MK:M+)
-. if !empty(BUILDLINK_USE_BUILTIN.binutils:M[nN][oO])
-AR= ${BUILDLINK_PREFIX.binutils}/bin/ar
-AS= ${BUILDLINK_PREFIX.binutils}/bin/as
-LD= ${BUILDLINK_PREFIX.binutils}/bin/ld
-NM= ${BUILDLINK_PREFIX.binutils}/bin/nm
-RANLIB= ${BUILDLINK_PREFIX.binutils}/bin/ranlib
-. endif
-.endif # BINUTILS_BUILDLINK3_MK
-
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
diff --git a/devel/binutils/builtin.mk b/devel/binutils/builtin.mk
new file mode 100644
index 00000000000..e3869b1fe13
--- /dev/null
+++ b/devel/binutils/builtin.mk
@@ -0,0 +1,44 @@
+# $NetBSD: builtin.mk,v 1.1 2004/03/10 17:57:14 jlam Exp $
+
+# XXX Assume that the base OS provides a built-in binutils.
+IS_BUILTIN.binutils?= yes
+
+CHECK_BUILTIN.binutils?= no
+.if !empty(CHECK_BUILTIN.binutils:M[yY][eE][sS])
+USE_BUILTIN.binutils= yes
+.endif
+
+.if !defined(USE_BUILTIN.binutils)
+USE_BUILTIN.binutils?= ${IS_BUILTIN.binutils}
+PREFER.binutils?= pkgsrc
+
+. if defined(USE_BINUTILS)
+. if !empty(IS_BUILTIN.binutils:M[nN][oO]) || \
+ (${PREFER.binutils} == "pkgsrc")
+USE_BUILTIN.binutils= no
+. endif
+. endif
+
+# These versions of NetBSD didn't have a toolchain that was capable of
+# replacing binutils.
+#
+_INCOMPAT_BINUTILS= NetBSD-0.*-* NetBSD-1.[01234]*-*
+_INCOMPAT_BINUTILS+= NetBSD-1.5.*-* NetBSD-1.5[A-X]-*
+#
+# XXX _INCOMPAT_BINUTILS settings for other operating systems possibly
+# XXX needed here
+#
+. for _pattern_ in ${_INCOMPAT_BINUTILS} ${INCOMPAT_BINUTILS}
+. if !empty(MACHINE_PLATFORM:M${_pattern_})
+USE_BUILTIN.binutils= no
+. endif
+. endfor
+.endif # USE_BUILTIN.binutils
+
+.if !empty(USE_BUILTIN.binutils:M[nN][oO])
+AR= ${BUILDLINK_PREFIX.binutils}/bin/ar
+AS= ${BUILDLINK_PREFIX.binutils}/bin/as
+LD= ${BUILDLINK_PREFIX.binutils}/bin/ld
+NM= ${BUILDLINK_PREFIX.binutils}/bin/nm
+RANLIB= ${BUILDLINK_PREFIX.binutils}/bin/ranlib
+.endif
diff --git a/devel/gettext-lib/buildlink3.mk b/devel/gettext-lib/buildlink3.mk
index 9855b406820..96bf0bf2bdf 100644
--- a/devel/gettext-lib/buildlink3.mk
+++ b/devel/gettext-lib/buildlink3.mk
@@ -1,159 +1,22 @@
-# $NetBSD: buildlink3.mk,v 1.16 2004/02/18 16:35:27 jlam Exp $
+# $NetBSD: buildlink3.mk,v 1.17 2004/03/10 17:57:14 jlam Exp $
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
GETTEXT_BUILDLINK3_MK:= ${GETTEXT_BUILDLINK3_MK}+
-.include "../../mk/bsd.prefs.mk"
-
-.if !empty(GETTEXT_BUILDLINK3_MK:M+)
-BUILDLINK_PACKAGES+= gettext
-BUILDLINK_DEPENDS.gettext+= gettext-lib>=0.10.35nb1
-BUILDLINK_PKGSRCDIR.gettext?= ../../devel/gettext-lib
-.endif # GETTEXT_BUILDLINK3_MK
-
-BUILDLINK_CHECK_BUILTIN.gettext?= NO
-
-.if !defined(BUILDLINK_IS_BUILTIN.gettext)
-BUILDLINK_IS_BUILTIN.gettext= NO
-. if exists(/usr/include/libintl.h)
-BUILDLINK_IS_BUILTIN.gettext= YES
-. if !empty(BUILDLINK_CHECK_BUILTIN.gettext:M[nN][oO])
-#
-# Consider the base system libintl to be gettext-lib-0.10.35nb1.
-#
-_GETTEXT_PKG= gettext-lib-0.10.35nb1
-. for _depend_ in ${BUILDLINK_DEPENDS.gettext}
-. if !empty(BUILDLINK_IS_BUILTIN.gettext:M[yY][eE][sS])
-BUILDLINK_IS_BUILTIN.gettext!= \
- if ${PKG_ADMIN} pmatch '${_depend_}' ${_GETTEXT_PKG}; then \
- ${ECHO} "YES"; \
- else \
- ${ECHO} "NO"; \
- fi
-. endif
-. endfor
-. endif
-. endif
-. if !empty(BUILDLINK_CHECK_BUILTIN.gettext:M[nN][oO])
-#
-# The listed platforms have a broken (for the purposes of pkgsrc) version
-# of gettext-lib.
-#
-_INCOMPAT_GETTEXT= SunOS-*-*
-INCOMPAT_GETTEXT?= # empty
-. for _pattern_ in ${_INCOMPAT_GETTEXT} ${INCOMPAT_GETTEXT}
-. if !empty(MACHINE_PLATFORM:M${_pattern_})
-BUILDLINK_IS_BUILTIN.gettext= NO
-. endif
-. endfor
-. endif
-MAKEFLAGS+= BUILDLINK_IS_BUILTIN.gettext=${BUILDLINK_IS_BUILTIN.gettext}
-.endif
-
-.if !empty(BUILDLINK_CHECK_BUILTIN.gettext:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.gettext= YES
-.endif
-
-.if !defined(BUILDLINK_USE_BUILTIN.gettext)
-. if !empty(BUILDLINK_IS_BUILTIN.gettext:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.gettext= YES
-. else
-BUILDLINK_USE_BUILTIN.gettext= NO
-. endif
-
-. if !empty(PREFER_NATIVE:M[yY][eE][sS]) && \
- !empty(BUILDLINK_IS_BUILTIN.gettext:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.gettext= YES
-. endif
-. if !empty(PREFER_PKGSRC:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.gettext= NO
-. endif
-. if !empty(PREFER_NATIVE:Mgettext) && \
- !empty(BUILDLINK_IS_BUILTIN.gettext:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.gettext= YES
-. endif
-. if !empty(PREFER_PKGSRC:Mgettext)
-BUILDLINK_USE_BUILTIN.gettext= NO
-. endif
-
-. if defined(USE_GNU_GETTEXT)
-BUILDLINK_USE_BUILTIN.gettext= NO
-. endif
-.endif
-
-.if !empty(BUILDLINK_USE_BUILTIN.gettext:M[nN][oO])
-. if !empty(BUILDLINK_DEPTH:M+)
+.if !empty(BUILDLINK_DEPTH:M+)
BUILDLINK_DEPENDS+= gettext
-. endif
.endif
+BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ngettext}
+BUILDLINK_PACKAGES+= gettext
+
.if !empty(GETTEXT_BUILDLINK3_MK:M+)
-. if !empty(BUILDLINK_USE_BUILTIN.gettext:M[nN][oO])
-_BLNK_LIBINTL= -lintl
-_GETTEXT_ICONV_DEPENDS= gettext-lib>=0.11.5nb1
-. if !defined(_GETTEXT_NEEDS_ICONV)
-_GETTEXT_NEEDS_ICONV?= NO
-. for _depend_ in ${BUILDLINK_DEPENDS.gettext}
-. if !empty(_GETTEXT_NEEDS_ICONV:M[nN][oO])
-_GETTEXT_NEEDS_ICONV!= \
- if ${PKG_INFO} -qe '${_depend_}'; then \
- pkg=`cd ${_PKG_DBDIR}; ${PKG_ADMIN} -S lsbest '${_depend_}'`; \
- if ${PKG_INFO} -qN "$$pkg" | ${GREP} -q "libiconv-[0-9]"; then \
- ${ECHO} "YES"; \
- else \
- ${ECHO} "NO"; \
- fi; \
- else \
- ${ECHO} "YES"; \
- fi
-. endif
-. endfor
-MAKEFLAGS+= _GETTEXT_NEEDS_ICONV=${_GETTEXT_NEEDS_ICONV}
-. endif
-. if ${_GETTEXT_NEEDS_ICONV} == "YES"
-. include "../../converters/libiconv/buildlink3.mk"
-BUILDLINK_DEPENDS.gettext+= ${_GETTEXT_ICONV_DEPENDS}
-_BLNK_LIBINTL+= ${BUILDLINK_LDADD.iconv}
-. endif
-. else
-. if !defined(_BLNK_LIBINTL_FOUND)
-_BLNK_LIBINTL_FOUND!= \
- if [ "`${ECHO} /usr/lib/libintl.*`" = "/usr/lib/libintl.*" ]; then \
- ${ECHO} "NO"; \
- else \
- ${ECHO} "YES"; \
- fi
-MAKEFLAGS+= _BLNK_LIBINTL_FOUND=${_BLNK_LIBINTL_FOUND}
-. endif
-. if ${_BLNK_LIBINTL_FOUND} == "YES"
-_BLNK_LIBINTL= -lintl
-. else
-_BLNK_LIBINTL= # empty
-BUILDLINK_TRANSFORM+= l:intl:
-. endif
-. endif
+BUILDLINK_DEPENDS.gettext+= gettext-lib>=0.10.35nb1
+BUILDLINK_PKGSRCDIR.gettext?= ../../devel/gettext-lib
-BUILDLINK_LDADD.gettext?= ${_BLNK_LIBINTL}
+# libiconv/buildlink3.mk is included by gettext-lib/builtin.mk
+#.include "../../converters/libiconv/buildlink3.mk"
-# Add -lintl to LIBS in CONFIGURE_ENV to work around broken gettext.m4:
-# older gettext.m4 does not add -lintl where it should, and the resulting
-# configure script fails to detect if libintl.a is the genuine GNU gettext
-# or not.
-#
-. if defined(GNU_CONFIGURE)
-LIBS+= ${BUILDLINK_LDADD.gettext}
-CONFIGURE_ENV+= INTLLIBS="${BUILDLINK_LDADD.gettext}"
-. if !empty(BUILDLINK_USE_BUILTIN.gettext:M[yY][eE][sS])
-. if ${_BLNK_LIBINTL_FOUND} == "YES"
-CONFIGURE_ENV+= gt_cv_func_gnugettext1_libintl="yes"
-. endif
-. endif
-. if !empty(BUILDLINK_USE_BUILTIN.gettext:M[nN][oO])
-CONFIGURE_ARGS+= --with-libintl-prefix=${BUILDLINK_PREFIX.gettext}
-. else
-CONFIGURE_ARGS+= --without-libintl-prefix
-. endif
-. endif
.endif # GETTEXT_BUILDLINK3_MK
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
diff --git a/devel/gettext-lib/builtin.mk b/devel/gettext-lib/builtin.mk
new file mode 100644
index 00000000000..d073634700f
--- /dev/null
+++ b/devel/gettext-lib/builtin.mk
@@ -0,0 +1,146 @@
+# $NetBSD: builtin.mk,v 1.1 2004/03/10 17:57:14 jlam Exp $
+
+.if !defined(_BLNK_LIBINTL_FOUND)
+_BLNK_LIBINTL_FOUND!= \
+ if [ "`${ECHO} /usr/lib/libintl.*`" = "/usr/lib/libintl.*" ]; then \
+ ${ECHO} "no"; \
+ else \
+ ${ECHO} "yes"; \
+ fi
+MAKEFLAGS+= _BLNK_LIBINTL_FOUND=${_BLNK_LIBINTL_FOUND}
+.endif
+
+_LIBINTL_H= /usr/include/libintl.h
+
+.if !defined(IS_BUILTIN.gettext)
+IS_BUILTIN.gettext= no
+. if !empty(_BLNK_LIBINTL_FOUND:M[yY][eE][sS]) && exists(${_LIBINTL_H})
+IS_BUILTIN.gettext!= \
+ if ${GREP} -q "\#define[ ]*__USE_GNU_GETTEXT" ${_LIBINTL_H}; then \
+ ${ECHO} "yes"; \
+ else \
+ ${ECHO} "no"; \
+ fi
+. if !empty(IS_BUILTIN.gettext:M[yY][eE][sS])
+#
+# XXX Consider the base system libintl to be gettext-lib-0.10.35nb1.
+#
+BUILTIN_PKG.gettext= gettext-lib-0.10.35nb1
+MAKEFLAGS+= BUILTIN_PKG.gettext=${BUILTIN_PKG.gettext}
+. endif
+. endif
+MAKEFLAGS+= IS_BUILTIN.gettext=${IS_BUILTIN.gettext}
+.endif
+
+CHECK_BUILTIN.gettext?= no
+.if !empty(CHECK_BUILTIN.gettext:M[yY][eE][sS])
+USE_BUILTIN.gettext= yes
+.endif
+
+.if !defined(USE_BUILTIN.gettext)
+USE_BUILTIN.gettext?= ${IS_BUILTIN.gettext}
+PREFER.getext?= pkgsrc
+
+. if defined(BUILTIN_PKG.gettext)
+USE_BUILTIN.gettext= yes
+. for _depend_ in ${BUILDLINK_DEPENDS.gettext}
+. if !empty(USE_BUILTIN.gettext:M[yY][eE][sS])
+USE_BUILTIN.gettext!= \
+ if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.gettext}; then \
+ ${ECHO} "yes"; \
+ else \
+ ${ECHO} "no"; \
+ fi
+. endif
+. endfor
+. endif
+
+. if ${PREFER.gettext} == "native"
+# XXX
+# XXX By default, assume that the native libintl is good enough.
+# XXX
+. if !empty(_BLNK_LIBINTL_FOUND:M[yY][eE][sS]) && exists(${_LIBINTL_H})
+USE_BUILTIN.gettext= yes
+#
+# The listed platforms have an implementation of libintl that isn't
+# GNUish enough.
+#
+_INCOMPAT_GETTEXT= SunOS-*-*
+. for _pattern_ in ${_INCOMPAT_GETTEXT} ${INCOMPAT_GETTEXT}
+. if !empty(MACHINE_PLATFORM:M${_pattern_})
+USE_BUILTIN.gettext= no
+. endif
+. endfor
+. endif
+. endif
+
+. if defined(USE_GNU_GETTEXT)
+. if !empty(IS_BUILTIN.gettext:M[nN][oO]) || \
+ (${PREFER.gettext} == "pkgsrc")
+USE_BUILTIN.gettext= no
+. endif
+. endif
+.endif # USE_BUILTIN.gettext
+
+.if !empty(USE_BUILTIN.gettext:M[nN][oO])
+_BLNK_LIBINTL= -lintl
+_GETTEXT_ICONV_DEPENDS= gettext-lib>=0.11.5nb1
+. if !defined(_GETTEXT_NEEDS_ICONV)
+_GETTEXT_NEEDS_ICONV?= no
+. for _depend_ in ${BUILDLINK_DEPENDS.gettext}
+. if !empty(_GETTEXT_NEEDS_ICONV:M[nN][oO])
+_GETTEXT_NEEDS_ICONV!= \
+ if ${PKG_INFO} -qe '${_depend_}'; then \
+ pkg=`cd ${_PKG_DBDIR}; ${PKG_ADMIN} -S lsbest '${_depend_}'`; \
+ if ${PKG_INFO} -qN "$$pkg" | ${GREP} -q "libiconv-[0-9]"; then \
+ ${ECHO} "yes"; \
+ else \
+ ${ECHO} "no"; \
+ fi; \
+ else \
+ ${ECHO} "yes"; \
+ fi
+. endif
+. endfor
+. endif
+. if ${_GETTEXT_NEEDS_ICONV} == "yes"
+. for _mkfile_ in buildlink3.mk builtin.mk
+. if exists(../../converters/libiconv/${_mkfile_})
+. include "../../converters/libiconv/${_mkfile_}"
+. endif
+. endfor
+BUILDLINK_DEPENDS.gettext+= ${_GETTEXT_ICONV_DEPENDS}
+_BLNK_LIBINTL+= ${BUILDLINK_LDADD.iconv}
+. endif
+.endif
+
+.if !empty(USE_BUILTIN.gettext:M[yY][eE][sS])
+. if ${_BLNK_LIBINTL_FOUND} == "yes"
+_BLNK_LIBINTL= -lintl
+. else
+_BLNK_LIBINTL= # empty
+BUILDLINK_TRANSFORM+= l:intl:
+. endif
+.endif
+
+BUILDLINK_LDADD.gettext?= ${_BLNK_LIBINTL}
+
+# Add -lintl to LIBS in CONFIGURE_ENV to work around broken gettext.m4:
+# older gettext.m4 does not add -lintl where it should, and the resulting
+# configure script fails to detect if libintl.a is the genuine GNU gettext
+# or not.
+#
+.if defined(GNU_CONFIGURE)
+LIBS+= ${BUILDLINK_LDADD.gettext}
+CONFIGURE_ENV+= INTLLIBS="${BUILDLINK_LDADD.gettext}"
+. if !empty(USE_BUILTIN.gettext:M[yY][eE][sS])
+. if ${_BLNK_LIBINTL_FOUND} == "yes"
+CONFIGURE_ENV+= gt_cv_func_gnugettext1_libintl="yes"
+. endif
+. endif
+. if !empty(USE_BUILTIN.gettext:M[nN][oO])
+CONFIGURE_ARGS+= --with-libintl-prefix=${BUILDLINK_PREFIX.gettext}
+. else
+CONFIGURE_ARGS+= --without-libintl-prefix
+. endif
+.endif
diff --git a/devel/libgetopt/buildlink3.mk b/devel/libgetopt/buildlink3.mk
index 3049327ab69..1d2ceb33792 100644
--- a/devel/libgetopt/buildlink3.mk
+++ b/devel/libgetopt/buildlink3.mk
@@ -1,52 +1,18 @@
-# $NetBSD: buildlink3.mk,v 1.5 2004/01/24 03:12:32 jlam Exp $
+# $NetBSD: buildlink3.mk,v 1.6 2004/03/10 17:57:14 jlam Exp $
-BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
-GETOPT_BUILDLINK3_MK:= ${GETOPT_BUILDLINK3_MK}+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+LIBGETOPT_BUILDLINK3_MK:= ${LIBGETOPT_BUILDLINK3_MK}+
-.if !empty(GETOPT_BUILDLINK3_MK:M+)
-BUILDLINK_PACKAGES+= getopt
-BUILDLINK_DEPENDS.getopt+= libgetopt>=1.3
-BUILDLINK_PKGSRCDIR.getopt?= ../../devel/libgetopt
-.endif # GETOPT_BUILDLINK3_MK
-
-BUILDLINK_CHECK_BUILTIN.getopt?= NO
-
-.if !defined(BUILDLINK_IS_BUILTIN.getopt)
-BUILDLINK_IS_BUILTIN.getopt= NO
-. if exists(/usr/include/getopt.h)
-BUILDLINK_IS_BUILTIN.getopt= YES
-. endif
-.endif
-
-.if !empty(BUILDLINK_CHECK_BUILTIN.getopt:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.getopt= YES
-.endif
-
-.if !defined(BUILDLINK_USE_BUILTIN.getopt)
-. if !empty(BUILDLINK_IS_BUILTIN.getopt:M[nN][oO])
-BUILDLINK_USE_BUILTIN.getopt= NO
-. else
-BUILDLINK_USE_BUILTIN.getopt= YES
-. endif
-.endif
-
-.if !empty(BUILDLINK_USE_BUILTIN.getopt:M[nN][oO])
-. if !empty(BUILDLINK_DEPTH:M+)
+.if !empty(BUILDLINK_DEPTH:M+)
BUILDLINK_DEPENDS+= getopt
-. endif
.endif
-.if !empty(GETOPT_BUILDLINK3_MK:M+)
-. if !empty(BUILDLINK_USE_BUILTIN.getopt:M[nN][oO])
-LIBGETOPT= -lgetopt
-. else
-LIBGETOPT= # empty
-. endif
+BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ngetopt}
+BUILDLINK_PACKAGES+= getopt
-BUILDLINK_LDADD.getopt?= ${LIBGETOPT}
-
-CONFIGURE_ENV+= LIBGETOPT="${LIBGETOPT}"
-MAKE_ENV+= LIBGETOPT="${LIBGETOPT}"
-.endif # GETOPT_BUILDLINK3_MK
+.if !empty(LIBGETOPT_BUILDLINK3_MK:M+)
+BUILDLINK_DEPENDS.getopt+= libgetopt>=1.3
+BUILDLINK_PKGSRCDIR.getopt?= ../../devel/libgetopt
+.endif # LIBGETOPT_BUILDLINK3_MK
-BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
diff --git a/devel/libgetopt/builtin.mk b/devel/libgetopt/builtin.mk
new file mode 100644
index 00000000000..74615cdb8be
--- /dev/null
+++ b/devel/libgetopt/builtin.mk
@@ -0,0 +1,26 @@
+# $NetBSD: builtin.mk,v 1.1 2004/03/10 17:57:14 jlam Exp $
+
+.if !defined(IS_BUILTIN.getopt)
+IS_BUILTIN.getopt= no
+. if exists(/usr/include/getopt.h)
+IS_BUILTIN.getopt= yes
+. endif
+.endif
+
+CHECK_BUILTIN.getopt?= no
+.if !empty(CHECK_BUILTIN.getopt:M[yY][eE][sS])
+USE_BUILTIN.getopt= yes
+.endif
+
+USE_BUILTIN.getopt?= ${IS_BUILTIN.getopt}
+
+.if !empty(USE_BUILTIN.getopt:M[nN][oO])
+LIBGETOPT= -lgetopt
+.else
+LIBGETOPT= # empty
+.endif
+
+BUILDLINK_LDADD.getopt?= ${LIBGETOPT}
+
+CONFIGURE_ENV+= LIBGETOPT="${LIBGETOPT}"
+MAKE_ENV+= LIBGETOPT="${LIBGETOPT}"
diff --git a/devel/ncurses/buildlink3.mk b/devel/ncurses/buildlink3.mk
index 89c9f90fe2d..e9a45bf445f 100644
--- a/devel/ncurses/buildlink3.mk
+++ b/devel/ncurses/buildlink3.mk
@@ -1,172 +1,18 @@
-# $NetBSD: buildlink3.mk,v 1.22 2004/02/19 17:36:38 jlam Exp $
+# $NetBSD: buildlink3.mk,v 1.23 2004/03/10 17:57:14 jlam Exp $
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
NCURSES_BUILDLINK3_MK:= ${NCURSES_BUILDLINK3_MK}+
-.include "../../mk/bsd.prefs.mk"
-
-.if !empty(NCURSES_BUILDLINK3_MK:M+)
-BUILDLINK_PACKAGES+= ncurses
-BUILDLINK_DEPENDS.ncurses+= ncurses>=5.3nb1
-BUILDLINK_PKGSRCDIR.ncurses?= ../../devel/ncurses
-.endif # NCURSES_BUILDLINK3_MK
-
-BUILDLINK_CHECK_BUILTIN.ncurses?= NO
-
-.if !defined(_BLNK_LIBNCURSES_FOUND)
-_BLNK_LIBNCURSES_FOUND!= \
- if [ "`${ECHO} /usr/lib/libncurses.*`" = "/usr/lib/libncurses.*" ]; then \
- ${ECHO} "NO"; \
- else \
- ${ECHO} "YES"; \
- fi
-MAKEFLAGS+= _BLNK_LIBNCURSES_FOUND=${_BLNK_LIBNCURSES_FOUND}
-.endif
-
-_NCURSES_H= /usr/include/curses.h
-
-.if !defined(BUILDLINK_IS_BUILTIN.ncurses)
-BUILDLINK_IS_BUILTIN.ncurses= NO
-. if !empty(_BLNK_LIBNCURSES_FOUND:M[yY][eE][sS])
-BUILDLINK_IS_BUILTIN.ncurses= YES
-. elif exists(${_NCURSES_H})
-_IS_BUILTIN.ncurses!= \
- if ${GREP} -q "\#define[ ]*NCURSES_VERSION" ${_NCURSES_H}; then \
- ${ECHO} "YES"; \
- else \
- ${ECHO} "NO"; \
- fi
-BUILDLINK_IS_BUILTIN.ncurses= ${_IS_BUILTIN.ncurses}
-. if !empty(BUILDLINK_CHECK_BUILTIN.ncurses:M[nN][oO]) && \
- !empty(_IS_BUILTIN.ncurses:M[yY][eE][sS])
-#
-# Create an appropriate name for the built-in package distributed
-# with the system. This package name can be used to check against
-# BUILDLINK_DEPENDS.<pkg> to see if we need to install the pkgsrc
-# version or if the built-in one is sufficient.
-#
-_NCURSES_VERSION!= \
- ${AWK} '/\#define[ ]*NCURSES_VERSION[ ]/ { \
- vers = $$3; \
- gsub("\"", "", vers); \
- print vers; \
- } \
- ' ${_NCURSES_H}
-_NCURSES_PKG= ncurses-${_NCURSES_VERSION}
-BUILDLINK_IS_BUILTIN.ncurses= YES
-. for _depend_ in ${BUILDLINK_DEPENDS.ncurses}
-. if !empty(BUILDLINK_IS_BUILTIN.ncurses:M[yY][eE][sS])
-BUILDLINK_IS_BUILTIN.ncurses!= \
- if ${PKG_ADMIN} pmatch '${_depend_}' ${_NCURSES_PKG}; then \
- ${ECHO} "YES"; \
- else \
- ${ECHO} "NO"; \
- fi
-. endif
-. endfor
-. endif
-. endif
-#
-# XXX By default, assume that the native curses on NetBSD systems
-# XXX supports ncurses.
-#
-. if ${OPSYS} == "NetBSD"
-BUILDLINK_IS_BUILTIN.ncurses= YES
-#
-# These versions of NetBSD didn't have a curses library that was
-# capable of replacing ncurses.
-#
-# XXX In reality, no version of NetBSD has a curses library that can
-# XXX completely replace ncurses; however, some versions implement
-# XXX enough of ncurses that some packages are happy.
-#
-_INCOMPAT_CURSES= NetBSD-0.*-* NetBSD-1.[0123]*-*
-_INCOMPAT_CURSES+= NetBSD-1.4.*-* NetBSD-1.4[A-X]-*
-. for _pattern_ in ${_INCOMPAT_CURSES} ${INCOMPAT_CURSES}
-. if !empty(MACHINE_PLATFORM:M${_pattern_})
-BUILDLINK_IS_BUILTIN.ncurses= NO
-. endif
-. endfor
-. endif
-MAKEFLAGS+= BUILDLINK_IS_BUILTIN.ncurses=${BUILDLINK_IS_BUILTIN.ncurses}
-.endif
-
-.if !empty(BUILDLINK_CHECK_BUILTIN.ncurses:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.ncurses= YES
-.endif
-
-.if !defined(BUILDLINK_USE_BUILTIN.ncurses)
-. if !empty(BUILDLINK_IS_BUILTIN.ncurses:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.ncurses= YES
-. else
-BUILDLINK_USE_BUILTIN.ncurses= NO
-. endif
-
-. if !empty(PREFER_NATIVE:M[yY][eE][sS]) && \
- !empty(BUILDLINK_IS_BUILTIN.ncurses:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.ncurses= YES
-. endif
-. if !empty(PREFER_PKGSRC:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.ncurses= NO
-. endif
-. if !empty(PREFER_NATIVE:Mncurses) && \
- !empty(BUILDLINK_IS_BUILTIN.ncurses:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.ncurses= YES
-. endif
-. if !empty(PREFER_PKGSRC:Mncurses)
-BUILDLINK_USE_BUILTIN.ncurses= NO
-. endif
-
-. if defined(USE_NCURSES)
-. if !empty(BUILDLINK_IS_BUILTIN.ncurses:M[yY][eE][sS]) && \
- !empty(_BLNK_LIBNCURSES_FOUND:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.ncurses= YES
-. else
-BUILDLINK_USE_BUILTIN.ncurses= NO
-. endif
-. endif
-.endif
-
-.if !empty(BUILDLINK_USE_BUILTIN.ncurses:M[nN][oO])
-. if !empty(BUILDLINK_DEPTH:M+)
+.if !empty(BUILDLINK_DEPTH:M+)
BUILDLINK_DEPENDS+= ncurses
-. endif
.endif
-.if !empty(NCURSES_BUILDLINK3_MK:M+)
-. if !empty(BUILDLINK_USE_BUILTIN.ncurses:M[yY][eE][sS])
-. if !empty(_BLNK_LIBNCURSES_FOUND:M[nN][oO])
-BUILDLINK_TRANSFORM.ncurses+= -e "s|/curses\.h|/ncurses.h|g"
-BUILDLINK_TRANSFORM+= l:ncurses:curses
-. endif
-. endif
-
-BUILDLINK_FILES.ncurses= include/curses.h
-BUILDLINK_FILES.ncurses+= include/term.h
-
-BUILDLINK_TARGETS+= buildlink-ncurses-curses-h
-BUILDLINK_TARGETS+= buildlink-ncurses-extra-includes
-
-.PHONY: buildlink-ncurses-extra-includes
-buildlink-ncurses-extra-includes:
- ${_PKG_SILENT}${_PKG_DEBUG} \
- extra_includes="include/term.h"; \
- for f in $${extra_includes}; do \
- if [ ! -f ${BUILDLINK_DIR}/$${f} ]; then \
- ${ECHO_BUILDLINK_MSG} "Touching extra ncurses header ($${f}) in ${BUILDLINK_DIR}."; \
- ${TOUCH} ${TOUCH_FLAGS} ${BUILDLINK_DIR}/$${f}; \
- fi; \
- done
+BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Nncurses}
+BUILDLINK_PACKAGES+= ncurses
-.PHONY: buildlink-ncurses-curses-h
-buildlink-ncurses-curses-h:
- ${_PKG_SILENT}${_PKG_DEBUG} \
- if [ ! -f ${BUILDLINK_DIR}/include/curses.h -a \
- -f ${BUILDLINK_PREFIX.ncurses}/include/ncurses.h ]; then \
- ${ECHO_BUILDLINK_MSG} "Linking curses.h to ncurses.h."; \
- ${LN} -s ${BUILDLINK_PREFIX.ncurses}/include/ncurses.h \
- ${BUILDLINK_DIR}/include/curses.h; \
- fi
+.if !empty(NCURSES_BUILDLINK3_MK:M+)
+BUILDLINK_DEPENDS.ncurses+= ncurses>=5.3nb1
+BUILDLINK_PKGSRCDIR.ncurses?= ../../devel/ncurses
.endif # NCURSES_BUILDLINK3_MK
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
diff --git a/devel/ncurses/builtin.mk b/devel/ncurses/builtin.mk
new file mode 100644
index 00000000000..0303309a723
--- /dev/null
+++ b/devel/ncurses/builtin.mk
@@ -0,0 +1,133 @@
+# $NetBSD: builtin.mk,v 1.1 2004/03/10 17:57:14 jlam Exp $
+
+.if !defined(_BLNK_LIBNCURSES_FOUND)
+_BLNK_LIBNCURSES_FOUND!= \
+ if [ "`${ECHO} /usr/lib/libncurses.*`" = "/usr/lib/libncurses.*" ]; then \
+ ${ECHO} "no"; \
+ else \
+ ${ECHO} "yes"; \
+ fi
+MAKEFLAGS+= _BLNK_LIBNCURSES_FOUND=${_BLNK_LIBNCURSES_FOUND}
+.endif
+
+_NCURSES_H= /usr/include/curses.h
+
+.if !defined(IS_BUILTIN.ncurses)
+IS_BUILTIN.ncurses= no
+. if !empty(_BLNK_LIBNCURSES_FOUND:M[yY][eE][sS])
+IS_BUILTIN.ncurses= yes
+. elif exists(${_NCURSES_H})
+IS_BUILTIN.ncurses!= \
+ if ${GREP} -q "\#define[ ]*NCURSES_VERSION" ${_NCURSES_H}; then \
+ ${ECHO} "yes"; \
+ else \
+ ${ECHO} "no"; \
+ fi
+. if !empty(IS_BUILTIN.ncurses:M[yY][eE][sS])
+#
+# Create an appropriate name for the built-in package distributed
+# with the system. This package name can be used to check against
+# BUILDLINK_DEPENDS.<pkg> to see if we need to install the pkgsrc
+# version or if the built-in one is sufficient.
+#
+_NCURSES_VERSION!= \
+ ${AWK} '/\#define[ ]*NCURSES_VERSION[ ]/ { \
+ vers = $$3; \
+ gsub("\"", "", vers); \
+ print vers; \
+ } \
+ ' ${_NCURSES_H}
+BUILTIN_PKG.ncurses= ncurses-${_NCURSES_VERSION}
+MAKEFLAGS+= BUILTIN_PKG.ncurses=${BUILTIN_PKG.ncurses}
+. endif
+. endif
+MAKEFLAGS+= IS_BUILTIN.ncurses=${IS_BUILTIN.ncurses}
+.endif
+
+CHECK_BUILTIN.ncurses?= no
+.if !empty(CHECK_BUILTIN.ncurses:M[yY][eE][sS])
+USE_BUILTIN.ncurses= yes
+.endif
+
+.if !defined(USE_BUILTIN.ncurses)
+USE_BUILTIN.ncurses?= ${IS_BUILTIN.ncurses}
+PREFER.ncurses?= pkgsrc
+
+. if defined(BUILTIN_PKG.ncurses)
+USE_BUILTIN.ncurses= yes
+. for _depend_ in ${BUILDLINK_DEPENDS.ncurses}
+. if !empty(IS_BUILTIN.ncurses:M[yY][eE][sS])
+USE_BUILTIN.ncurses!= \
+ if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.ncurses}; then \
+ ${ECHO} "yes"; \
+ else \
+ ${ECHO} "no"; \
+ fi
+. endif
+. endfor
+. endif
+
+. if ${PREFER.ncurses} == "native"
+# XXX
+# XXX By default, assume that the native curses on NetBSD systems
+# XXX supports ncurses.
+# XXX
+. if ${OPSYS} == "NetBSD"
+USE_BUILTIN.ncurses= yes
+#
+# These versions of NetBSD didn't have a curses library that was
+# capable of replacing ncurses.
+#
+# XXX In reality, no version of NetBSD has a curses library that can
+# XXX completely replace ncurses; however, some versions implement
+# XXX enough of ncurses that some packages are happy.
+#
+_INCOMPAT_CURSES= NetBSD-0.*-* NetBSD-1.[0123]*-*
+_INCOMPAT_CURSES+= NetBSD-1.4.*-* NetBSD-1.4[A-X]-*
+. for _pattern_ in ${_INCOMPAT_CURSES} ${INCOMPAT_CURSES}
+. if !empty(MACHINE_PLATFORM:M${_pattern_})
+USE_BUILTIN.ncurses= no
+. endif
+. endfor
+. endif
+. endif
+
+. if defined(USE_NCURSES)
+. if !empty(IS_BUILTIN.ncurses:M[nN][oO]) || \
+ (${PREFER.ncurses} == "pkgsrc")
+USE_BUILTIN.ncurses= no
+. endif
+. endif
+.endif # USE_BUILTIN.ncurses
+
+.if !empty(USE_BUILTIN.ncurses:M[yY][eE][sS])
+. if !empty(_BLNK_LIBNCURSES_FOUND:M[nN][oO])
+BUILDLINK_TRANSFORM.ncurses+= -e "s|/curses\.h|/ncurses.h|g"
+BUILDLINK_TRANSFORM+= l:ncurses:curses
+. endif
+BUILDLINK_FILES.ncurses+= include/curses.h
+
+BUILDLINK_TARGETS+= buildlink-ncurses-curses-h
+BUILDLINK_TARGETS+= buildlink-ncurses-extra-includes
+
+.PHONY: buildlink-ncurses-extra-includes
+buildlink-ncurses-extra-includes:
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ extra_includes="include/term.h"; \
+ for f in $${extra_includes}; do \
+ if [ ! -f ${BUILDLINK_PREFIX.ncurses}/$$f ]; then \
+ ${ECHO_BUILDLINK_MSG} "Touching extra ncurses header ($$f) in ${BUILDLINK_DIR}."; \
+ ${TOUCH} ${TOUCH_FLAGS} ${BUILDLINK_DIR}/$$f; \
+ fi; \
+ done
+
+.PHONY: buildlink-ncurses-curses-h
+buildlink-ncurses-curses-h:
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ if [ ! -f ${BUILDLINK_DIR}/include/curses.h -a \
+ -f ${BUILDLINK_PREFIX.ncurses}/include/ncurses.h ]; then \
+ ${ECHO_BUILDLINK_MSG} "Linking curses.h -> ncurses.h."; \
+ ${LN} -s ${BUILDLINK_PREFIX.ncurses}/include/ncurses.h \
+ ${BUILDLINK_DIR}/include/curses.h; \
+ fi
+.endif
diff --git a/devel/readline/buildlink3.mk b/devel/readline/buildlink3.mk
index 830ea6b65b4..0b8a1030e99 100644
--- a/devel/readline/buildlink3.mk
+++ b/devel/readline/buildlink3.mk
@@ -1,159 +1,26 @@
-# $NetBSD: buildlink3.mk,v 1.16 2004/02/20 06:51:16 jlam Exp $
+# $NetBSD: buildlink3.mk,v 1.17 2004/03/10 17:57:14 jlam Exp $
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
READLINE_BUILDLINK3_MK:= ${READLINE_BUILDLINK3_MK}+
-.include "../../mk/bsd.prefs.mk"
-
-.if !empty(READLINE_BUILDLINK3_MK:M+)
-BUILDLINK_PACKAGES+= readline
-BUILDLINK_DEPENDS.readline+= readline>=2.2
-BUILDLINK_PKGSRCDIR.readline?= ../../devel/readline
-.endif # READLINE_BUILDLINK3_MK
-
-BUILDLINK_CHECK_BUILTIN.readline?= NO
-
-.if !defined(_BLNK_LIBREADLINE_FOUND)
-_BLNK_LIBREADLINE_FOUND!= \
- if [ "`${ECHO} /usr/lib/libreadline.*`" = "/usr/lib/libreadline.*" ]; then \
- ${ECHO} "NO"; \
- else \
- ${ECHO} "YES"; \
- fi
-MAKEFLAGS+= _BLNK_LIBREADLINE_FOUND=${_BLNK_LIBREADLINE_FOUND}
-.endif
-
-.if !defined(_BLNK_LIBEDIT_FOUND)
-_BLNK_LIBEDIT_FOUND!= \
- if [ "`${ECHO} /usr/lib/libedit.*`" = "/usr/lib/libedit.*" ]; then \
- ${ECHO} "NO"; \
- else \
- ${ECHO} "YES"; \
- fi
-MAKEFLAGS+= _BLNK_LIBEDIT_FOUND=${_BLNK_LIBEDIT_FOUND}
-.endif
-
-_READLINE_H= /usr/include/readline.h
-_READLINE_READLINE_H= /usr/include/readline/readline.h
-
-.if !defined(BUILDLINK_IS_BUILTIN.readline)
-BUILDLINK_IS_BUILTIN.readline= NO
-. if !empty(_BLNK_LIBREADLINE_FOUND:M[yY][eE][sS])
-BUILDLINK_IS_BUILTIN.readline= YES
-. elif exists(${_READLINE_H}) || exists(${_READLINE_READLINE_H})
-. if exists(${_READLINE_H})
-_READLINE_HEADER= ${_READLINE_H}
-. else
-_READLINE_HEADER= ${_READLINE_READLINE_H}
-. endif
-_IS_BUILTIN.readline!= \
- if ${GREP} -q "\#define[ ]*RL_VERSION_MAJOR" ${_READLINE_HEADER}; then \
- ${ECHO} "YES"; \
- else \
- ${ECHO} "NO"; \
- fi
-BUILDLINK_IS_BUILTIN.readline= ${_IS_BUILTIN.readline}
-. if !empty(BUILDLINK_CHECK_BUILTIN.readline:M[nN][oO]) && \
- !empty(_IS_BUILTIN.readline:M[yY][eE][sS])
-#
-# Create an appropriate name for the built-in package distributed
-# with the system. This package name can be used to check against
-# BUILDLINK_DEPENDS.<pkg> to see if we need to install the pkgsrc
-# version or if the built-in one is sufficient.
-#
-_READLINE_MAJOR!= \
- ${AWK} '/\#define[ ]*RL_VERSION_MAJOR/ { print $$3 }' \
- ${_READLINE_HEADER}
-_READLINE_MINOR!= \
- ${AWK} '/\#define[ ]*RL_VERSION_MINOR/ { print $$3 }' \
- ${_READLINE_HEADER}
-_READLINE_VERSION= ${_READLINE_MAJOR}.${_READLINE_MINOR}
-_READLINE_PKG= readline-${_READLINE_VERSION}
-BUILDLINK_IS_BUILTIN.readline= YES
-. for _depend_ in ${BUILDLINK_DEPENDS.readline}
-. if !empty(BUILDLINK_IS_BUILTIN.readline:M[yY][eE][sS])
-BUILDLINK_IS_BUILTIN.readline!= \
- if ${PKG_ADMIN} pmatch '${_depend_}' ${_READLINE_PKG}; then \
- ${ECHO} "YES"; \
- else \
- ${ECHO} "NO"; \
- fi
-. endif
-. endfor
-. endif
-. endif
-#
-# XXX By default, assume that the native editline library supports readline.
-#
-. if !empty(_BLNK_LIBREADLINE_FOUND:M[nN][oO]) && \
- !empty(_BLNK_LIBEDIT_FOUND:M[yY][eE][sS])
-BUILDLINK_IS_BUILTIN.readline= YES
-_INCOMPAT_READLINE?= SunOS-*-*
-. for _pattern_ in ${_INCOMPAT_READLINE} ${INCOMPAT_READLINE}
-. if !empty(MACHINE_PLATFORM:M${_pattern_})
-BUILDLINK_IS_BUILTIN.readline= NO
-. endif
-. endfor
-. endif
-MAKEFLAGS+= BUILDLINK_IS_BUILTIN.readline=${BUILDLINK_IS_BUILTIN.readline}
-.endif
-
-.if !empty(BUILDLINK_CHECK_BUILTIN.readline:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.readline= YES
-.endif
-
-.if !defined(BUILDLINK_USE_BUILTIN.readline)
-. if !empty(BUILDLINK_IS_BUILTIN.readline:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.readline= YES
-. else
-BUILDLINK_USE_BUILTIN.readline= NO
-. endif
-
-. if !empty(PREFER_NATIVE:M[yY][eE][sS]) && \
- !empty(BUILDLINK_IS_BUILTIN.readline:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.readline= YES
-. endif
-. if !empty(PREFER_PKGSRC:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.readline= NO
-. endif
-. if !empty(PREFER_NATIVE:Mreadline) && \
- !empty(BUILDLINK_IS_BUILTIN.readline:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.readline= YES
-. endif
-. if !empty(PREFER_PKGSRC:Mreadline)
-BUILDLINK_USE_BUILTIN.readline= NO
-. endif
-
-. if defined(USE_GNU_READLINE)
-. if !empty(BUILDLINK_IS_BUILTIN.readline:M[yY][eE][sS]) && \
- !empty(_BLNK_LIBREADLINE_FOUND:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.readline= YES
-. else
-BUILDLINK_USE_BUILTIN.readline= NO
-. endif
-. endif
-.endif
-
-.if !empty(BUILDLINK_USE_BUILTIN.readline:M[nN][oO])
-. if !empty(BUILDLINK_DEPTH:M+)
+.if !empty(BUILDLINK_DEPTH:M+)
BUILDLINK_DEPENDS+= readline
-. endif
.endif
+BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Nreadline}
+BUILDLINK_PACKAGES+= readline
+
.if !empty(READLINE_BUILDLINK3_MK:M+)
-. if !empty(BUILDLINK_USE_BUILTIN.readline:M[yY][eE][sS])
-. if !empty(_BLNK_LIBREADLINE_FOUND:M[nN][oO]) && \
- !empty(_BLNK_LIBEDIT_FOUND:M[yY][eE][sS])
-BUILDLINK_TRANSFORM+= l:history:edit
-BUILDLINK_TRANSFORM+= l:readline:edit:termcap
-. endif
-. endif
+BUILDLINK_DEPENDS.readline+= readline>=2.2
+BUILDLINK_PKGSRCDIR.readline?= ../../devel/readline
-BUILDLINK_FILES.readline= include/history.h
+BUILDLINK_FILES.readline+= include/history.h
BUILDLINK_FILES.readline+= include/readline.h
+
BUILDLINK_TRANSFORM.readline= \
-e "s|include/history\.h|include/readline/history.h|g" \
-e "s|include/readline\.h|include/readline/readline.h|g"
+
.endif # READLINE_BUILDLINK3_MK
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
diff --git a/devel/readline/builtin.mk b/devel/readline/builtin.mk
new file mode 100644
index 00000000000..0c7594fcb24
--- /dev/null
+++ b/devel/readline/builtin.mk
@@ -0,0 +1,116 @@
+# $NetBSD: builtin.mk,v 1.1 2004/03/10 17:57:14 jlam Exp $
+
+.if !defined(_BLNK_LIBREADLINE_FOUND)
+_BLNK_LIBREADLINE_FOUND!= \
+ if [ "`${ECHO} /usr/lib/libreadline.*`" = "/usr/lib/libreadline.*" ]; then \
+ ${ECHO} "no"; \
+ else \
+ ${ECHO} "yes"; \
+ fi
+MAKEFLAGS+= _BLNK_LIBREADLINE_FOUND=${_BLNK_LIBREADLINE_FOUND}
+.endif
+
+.if !defined(_BLNK_LIBEDIT_FOUND)
+_BLNK_LIBEDIT_FOUND!= \
+ if [ "`${ECHO} /usr/lib/libedit.*`" = "/usr/lib/libedit.*" ]; then \
+ ${ECHO} "no"; \
+ else \
+ ${ECHO} "yes"; \
+ fi
+MAKEFLAGS+= _BLNK_LIBEDIT_FOUND=${_BLNK_LIBEDIT_FOUND}
+.endif
+
+_READLINE_H= /usr/include/readline.h
+_READLINE_READLINE_H= /usr/include/readline/readline.h
+
+.if !defined(IS_BUILTIN.readline)
+IS_BUILTIN.readline= no
+. if !empty(_BLNK_LIBREADLINE_FOUND:M[yY][eE][sS])
+IS_BUILTIN.readline= yes
+. elif exists(${_READLINE_H}) || exists(${_READLINE_READLINE_H})
+. if exists(${_READLINE_H})
+_READLINE_HEADER= ${_READLINE_H}
+. else
+_READLINE_HEADER= ${_READLINE_READLINE_H}
+. endif
+IS_BUILTIN.readline!= \
+ if ${GREP} -q "\#define[ ]*RL_VERSION_MAJOR" ${_READLINE_HEADER}; then \
+ ${ECHO} "yes"; \
+ else \
+ ${ECHO} "no"; \
+ fi
+. if !empty(IS_BUILTIN.readline:M[yY][eE][sS])
+#
+# Create an appropriate name for the built-in package distributed
+# with the system. This package name can be used to check against
+# BUILDLINK_DEPENDS.<pkg> to see if we need to install the pkgsrc
+# version or if the built-in one is sufficient.
+#
+_READLINE_MAJOR!= \
+ ${AWK} '/\#define[ ]*RL_VERSION_MAJOR/ { print $$3 }' \
+ ${_READLINE_HEADER}
+_READLINE_MINOR!= \
+ ${AWK} '/\#define[ ]*RL_VERSION_MINOR/ { print $$3 }' \
+ ${_READLINE_HEADER}
+_READLINE_VERSION= ${_READLINE_MAJOR}.${_READLINE_MINOR}
+BUILTIN_PKG.readline= readline-${_READLINE_VERSION}
+MAKEFLAGS+= BUILTIN_PKG.readline=${BUILTIN_PKG.readline}
+. endif
+. endif
+MAKEFLAGS+= IS_BUILTIN.readline=${IS_BUILTIN.readline}
+.endif
+
+CHECK_BUILTIN.readline?= no
+.if !empty(CHECK_BUILTIN.readline:M[yY][eE][sS])
+USE_BUILTIN.readline= yes
+.endif
+
+.if !defined(USE_BUILTIN.readline)
+USE_BUILTIN.readline?= ${IS_BUILTIN.readline}
+PREFER.readline?= pkgsrc
+
+. if defined(BUILTIN_PKG.readline)
+USE_BUILTIN.readline= yes
+. for _depend_ in ${BUILDLINK_DEPENDS.readline}
+. if !empty(USE_BUILTIN.readline:M[yY][eE][sS])
+USE_BUILTIN.readline!= \
+ if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.readline}; then \
+ ${ECHO} "yes"; \
+ else \
+ ${ECHO} "no"; \
+ fi
+. endif
+. endfor
+. endif
+
+. if ${PREFER.readline} == "native"
+# XXX
+# XXX By default, assume that the native editline library supports readline.
+# XXX
+. if !empty(_BLNK_LIBREADLINE_FOUND:M[nN][oO]) && \
+ !empty(_BLNK_LIBEDIT_FOUND:M[yY][eE][sS])
+USE_BUILTIN.readline= yes
+_INCOMPAT_READLINE?= SunOS-*-*
+. for _pattern_ in ${_INCOMPAT_READLINE} ${INCOMPAT_READLINE}
+. if !empty(MACHINE_PLATFORM:M${_pattern_})
+USE_BUILTIN.readline= no
+. endif
+. endfor
+. endif
+. endif
+
+. if defined(USE_GNU_READLINE)
+. if !empty(IS_BUILTIN.readline:M[nN][oO]) && \
+ (${PREFER.readline} == "pkgsrc")
+USE_BUILTIN.readline= no
+. endif
+. endif
+.endif # USE_BUILTIN.readline
+
+.if !empty(USE_BUILTIN.readline:M[yY][eE][sS])
+. if !empty(_BLNK_LIBREADLINE_FOUND:M[nN][oO]) && \
+ !empty(_BLNK_LIBEDIT_FOUND:M[yY][eE][sS])
+BUILDLINK_TRANSFORM+= l:history:edit
+BUILDLINK_TRANSFORM+= l:readline:edit:termcap
+. endif
+.endif
diff --git a/devel/zlib/buildlink3.mk b/devel/zlib/buildlink3.mk
index c9f47b1d6e7..05772b6bf27 100644
--- a/devel/zlib/buildlink3.mk
+++ b/devel/zlib/buildlink3.mk
@@ -1,114 +1,18 @@
-# $NetBSD: buildlink3.mk,v 1.15 2004/02/18 16:35:27 jlam Exp $
+# $NetBSD: buildlink3.mk,v 1.16 2004/03/10 17:57:14 jlam Exp $
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
ZLIB_BUILDLINK3_MK:= ${ZLIB_BUILDLINK3_MK}+
-.include "../../mk/bsd.prefs.mk"
+.if !empty(BUILDLINK_DEPTH:M+)
+BUILDLINK_DEPENDS+= zlib
+.endif
+
+BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Nzlib}
+BUILDLINK_PACKAGES+= zlib
.if !empty(ZLIB_BUILDLINK3_MK:M+)
-BUILDLINK_PACKAGES+= zlib
BUILDLINK_DEPENDS.zlib+= zlib>=1.1.4nb1
BUILDLINK_PKGSRCDIR.zlib?= ../../devel/zlib
.endif # ZLIB_BUILDLINK3_MK
-BUILDLINK_CHECK_BUILTIN.zlib?= NO
-
-_ZLIB_H= /usr/include/zlib.h
-
-.if !defined(BUILDLINK_IS_BUILTIN.zlib)
-BUILDLINK_IS_BUILTIN.zlib= NO
-. if exists(${_ZLIB_H})
-BUILDLINK_IS_BUILTIN.zlib= YES
-. if !empty(BUILDLINK_CHECK_BUILTIN.zlib:M[nN][oO])
-#
-# Create an appropriate name for the built-in package distributed
-# with the system. This package name can be used to check against
-# BUILDLINK_DEPENDS.<pkg> to see if we need to install the pkgsrc
-# version or if the built-in one is sufficient.
-#
-_ZLIB_VERSION!= \
- ${AWK} '/\#define[ ]*ZLIB_VERSION/ { \
- vers = $$3; \
- gsub("\"", "", vers); \
- print vers; \
- } \
- ' ${_ZLIB_H}
-_ZLIB_PKG= zlib-${_ZLIB_VERSION}
-#
-# If the built-in zlib is 1.1.4, then check whether it has the security
-# fix for CAN-2003-0107, which was a buffer overflow in the gzprintf
-# function. If it does, then treat it as the equivalent of zlib-1.1.4nb1.
-#
-_HAVE_CAN_2003_0107_FIX= NetBSD-1.3[I-Z]*-* NetBSD-1.[456]*-*
-_HAVE_CAN_2003_0107_FIX+= NetBSD-[2-9]*-* NetBSD-1[0-9]*-*
-#
-# XXX These patterns for {Free,Open}BSD are too permissive, but I'm not
-# XXX sure which versions of those OSes provide secure versions of
-# XXX zlib-1.1.4.
-#
-_HAVE_CAN_2003_0107_FIX+= FreeBSD-*-* OpenBSD-*-*
-. if ${_ZLIB_VERSION} == "1.1.4"
-. for _pattern_ in ${_HAVE_CAN_2003_0107_FIX}
-. if !empty(MACHINE_PLATFORM:M${_pattern_})
-_ZLIB_PKG= zlib-1.1.4nb1
-. endif
-. endfor
-. endif
-. for _depend_ in ${BUILDLINK_DEPENDS.zlib}
-. if !empty(BUILDLINK_IS_BUILTIN.zlib:M[yY][eE][sS])
-BUILDLINK_IS_BUILTIN.zlib!= \
- if ${PKG_ADMIN} pmatch '${_depend_}' ${_ZLIB_PKG}; then \
- ${ECHO} "YES"; \
- else \
- ${ECHO} "NO"; \
- fi
-. endif
-. endfor
-. endif
-. endif
-MAKEFLAGS+= BUILDLINK_IS_BUILTIN.zlib=${BUILDLINK_IS_BUILTIN.zlib}
-.endif
-
-.if !empty(BUILDLINK_CHECK_BUILTIN.zlib:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.zlib= YES
-.endif
-
-.if !defined(BUILDLINK_USE_BUILTIN.zlib)
-. if !empty(BUILDLINK_IS_BUILTIN.zlib:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.zlib= YES
-. else
-BUILDLINK_USE_BUILTIN.zlib= NO
-. endif
-
-. if !empty(PREFER_NATIVE:M[yY][eE][sS]) && \
- !empty(BUILDLINK_IS_BUILTIN.zlib:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.zlib= YES
-. endif
-. if !empty(PREFER_PKGSRC:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.zlib= NO
-. endif
-. if !empty(PREFER_NATIVE:Mzlib) && \
- !empty(BUILDLINK_IS_BUILTIN.zlib:M[yY][eE][sS])
-BUILDLINK_USE_BUILTIN.zlib= YES
-. endif
-. if !empty(PREFER_PKGSRC:Mzlib)
-BUILDLINK_USE_BUILTIN.zlib= NO
-. endif
-
-. if defined(USE_ZLIB)
-BUILDLINK_USE_BUILTIN.zlib= NO
-. endif
-.endif
-
-.if !empty(BUILDLINK_USE_BUILTIN.zlib:M[nN][oO])
-#
-# If we depend on the package, depend on the latest version with a library
-# major number bump.
-#
-BUILDLINK_DEPENDS.zlib+= zlib>=1.2.1
-. if !empty(BUILDLINK_DEPTH:M+)
-BUILDLINK_DEPENDS+= zlib
-. endif
-.endif
-
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
diff --git a/devel/zlib/builtin.mk b/devel/zlib/builtin.mk
new file mode 100644
index 00000000000..7df7fe471b4
--- /dev/null
+++ b/devel/zlib/builtin.mk
@@ -0,0 +1,81 @@
+# $NetBSD: builtin.mk,v 1.1 2004/03/10 17:57:14 jlam Exp $
+
+_ZLIB_H= /usr/include/zlib.h
+
+.if !defined(IS_BUILTIN.zlib)
+IS_BUILTIN.zlib= no
+. if exists(${_ZLIB_H})
+IS_BUILTIN.zlib= yes
+#
+# Create an appropriate name for the built-in package distributed
+# with the system. This package name can be used to check against
+# BUILDLINK_DEPENDS.<pkg> to see if we need to install the pkgsrc
+# version or if the built-in one is sufficient.
+#
+_ZLIB_VERSION!= \
+ ${AWK} '/\#define[ ]*ZLIB_VERSION/ { \
+ vers = $$3; \
+ gsub("\"", "", vers); \
+ print vers; \
+ } \
+ ' ${_ZLIB_H}
+BUILTIN_PKG.zlib= zlib-${_ZLIB_VERSION}
+#
+# If the built-in zlib is 1.1.4, then check whether it has the security
+# fix for CAN-2003-0107, which was a buffer overflow in the gzprintf
+# function. If it does, then treat it as the equivalent of zlib-1.1.4nb1.
+#
+_HAVE_CAN_2003_0107_FIX= NetBSD-1.3[I-Z]*-* NetBSD-1.[456]*-*
+_HAVE_CAN_2003_0107_FIX+= NetBSD-[2-9]*-* NetBSD-1[0-9]*-*
+#
+# XXX These patterns for {Free,Open}BSD are too permissive, but I'm not
+# XXX sure which versions of those OSes provide secure versions of
+# XXX zlib-1.1.4.
+#
+_HAVE_CAN_2003_0107_FIX+= FreeBSD-*-* OpenBSD-*-*
+. if ${_ZLIB_VERSION} == "1.1.4"
+. for _pattern_ in ${_HAVE_CAN_2003_0107_FIX}
+. if !empty(MACHINE_PLATFORM:M${_pattern_})
+BUILTIN_PKG.zlib= zlib-1.1.4nb1
+. endif
+. endfor
+. endif
+MAKEFLAGS+= BUILTIN_PKG.zlib=${BUILTIN_PKG.zlib}
+. endif
+MAKEFLAGS+= IS_BUILTIN.zlib=${IS_BUILTIN.zlib}
+.endif
+
+CHECK_BUILTIN.zlib?= no
+.if !empty(CHECK_BUILTIN.zlib:M[yY][eE][sS])
+USE_BUILTIN.zlib= yes
+.endif
+
+.if !defined(USE_BUILTIN.zlib)
+USE_BUILTIN.zlib?= ${IS_BUILTIN.zlib}
+PREFER.zlib?= pkgsrc
+
+. if defined(BUILTIN_PKG.zlib)
+USE_BUILTIN.zlib= yes
+. for _depend_ in ${BUILDLINK_DEPENDS.zlib}
+. if !empty(USE_BUILTIN.zlib:M[yY][eE][sS])
+USE_BUILTIN.zlib!= \
+ if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.zlib}; then \
+ ${ECHO} "yes"; \
+ else \
+ ${ECHO} "no"; \
+ fi
+. endif
+. endfor
+. endif
+
+. if defined(USE_ZLIB)
+. if !empty(IS_BUILTIN.zlib:M[nN][oO]) && \
+ (${PREFER.zlib} == "pkgsrc")
+USE_BUILTIN.zlib= no
+. endif
+. endif
+.endif # USE_BUILTIN.zlib
+
+.if !empty(USE_BUILTIN.zlib:M[nN][oO])
+BUILDLINK_DEPENDS.zlib+= zlib>=1.2.1
+.endif