summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archivers/bzip2/buildlink3.mk70
-rw-r--r--audio/SDL_mixer/buildlink3.mk22
-rw-r--r--audio/esound/buildlink3.mk21
-rw-r--r--audio/libaudiofile/buildlink3.mk19
-rw-r--r--audio/libogg/buildlink3.mk19
-rw-r--r--audio/oss/buildlink3.mk49
-rw-r--r--converters/libiconv/buildlink3.mk84
-rw-r--r--databases/db/buildlink3.mk41
-rw-r--r--databases/db3/buildlink3.mk19
-rw-r--r--databases/db4/buildlink3.mk20
-rw-r--r--databases/mysql-client/buildlink3.mk24
-rw-r--r--databases/openldap/buildlink3.mk28
-rw-r--r--databases/p5-DBI/buildlink3.mk22
-rw-r--r--databases/postgresql-lib/buildlink3.mk22
-rw-r--r--devel/SDL/buildlink3.mk29
-rw-r--r--devel/binutils/buildlink3.mk74
-rw-r--r--devel/boehm-gc/buildlink3.mk19
-rw-r--r--devel/dlcompat/buildlink3.mk19
-rw-r--r--devel/gettext-lib/buildlink3.mk129
-rw-r--r--devel/glib/buildlink3.mk23
-rw-r--r--devel/libgetopt/buildlink3.mk54
-rw-r--r--devel/libmm/buildlink3.mk19
-rw-r--r--devel/libslang/buildlink3.mk26
-rw-r--r--devel/ncurses/buildlink3.mk116
-rw-r--r--devel/pcre/buildlink3.mk19
-rw-r--r--devel/pkgconfig/buildlink3.mk24
-rw-r--r--devel/popt/buildlink3.mk21
-rw-r--r--devel/pth/buildlink3.mk19
-rw-r--r--devel/readline/buildlink3.mk88
-rw-r--r--devel/smpeg/buildlink3.mk22
-rw-r--r--devel/zlib/buildlink3.mk72
-rw-r--r--graphics/SDL_image/buildlink3.mk25
-rw-r--r--graphics/aalib-x11/buildlink3.mk27
-rw-r--r--graphics/freetype-lib/buildlink3.mk21
-rw-r--r--graphics/gd/buildlink3.mk25
-rw-r--r--graphics/glut/buildlink3.mk21
-rw-r--r--graphics/jpeg/buildlink3.mk19
-rw-r--r--graphics/libungif/buildlink3.mk19
-rw-r--r--graphics/png/buildlink3.mk21
-rw-r--r--graphics/tiff/buildlink3.mk22
-rw-r--r--lang/libperl/buildlink3.mk22
-rw-r--r--lang/ocaml/buildlink3.mk20
-rw-r--r--lang/perl5/buildlink3.mk84
-rw-r--r--lang/tcl/buildlink3.mk27
-rw-r--r--mk/ossaudio.buildlink3.mk85
-rw-r--r--mk/pthread.buildlink3.mk188
-rw-r--r--net/libpcap/buildlink3.mk49
-rw-r--r--net/openslp/buildlink3.mk19
-rw-r--r--net/socks4/buildlink3.mk20
-rw-r--r--net/socks5/buildlink3.mk19
-rw-r--r--pkgtools/libnbcompat/buildlink3.mk25
-rw-r--r--print/cups/buildlink3.mk22
-rw-r--r--security/PAM/buildlink3.mk49
-rw-r--r--security/cyrus-sasl2/buildlink3.mk19
-rw-r--r--security/libcrack/buildlink3.mk19
-rw-r--r--security/openssl/buildlink3.mk161
-rw-r--r--security/rsaref/buildlink3.mk19
-rw-r--r--security/tcp_wrappers/buildlink3.mk49
-rw-r--r--textproc/expat/buildlink3.mk19
-rw-r--r--www/apache/buildlink3.mk29
-rw-r--r--x11/gtk/buildlink3.mk24
-rw-r--r--x11/tk/buildlink3.mk30
62 files changed, 2431 insertions, 0 deletions
diff --git a/archivers/bzip2/buildlink3.mk b/archivers/bzip2/buildlink3.mk
new file mode 100644
index 00000000000..dbfc951e797
--- /dev/null
+++ b/archivers/bzip2/buildlink3.mk
@@ -0,0 +1,70 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+BZIP2_BUILDLINK3_MK:= ${BZIP2_BUILDLINK3_MK}+
+
+.if !empty(BZIP2_BUILDLINK3_MK:M\+)
+. include "../../mk/bsd.prefs.mk"
+
+BUILDLINK_DEPENDS.bzip2?= bzip2>=1.0.1
+BUILDLINK_PKGSRCDIR.bzip2?= ../../archivers/bzip2
+.endif # BZIP2_BUILDLINK3_MK
+
+BUILDLINK_CHECK_BUILTIN.bzip2?= NO
+
+.if !defined(BUILDLINK_IS_BUILTIN.bzip2)
+BUILDLINK_IS_BUILTIN.bzip2= NO
+. if exists(/usr/include/bzlib.h)
+BUILDLINK_IS_BUILTIN.bzip2!= \
+ if ${GREP} -q "BZ2_" /usr/include/bzlib.h; then \
+ ${ECHO} YES; \
+ else \
+ ${ECHO} NO; \
+ fi
+. endif
+MAKEFLAGS+= BUILDLINK_IS_BUILTIN.bzip2=${BUILDLINK_IS_BUILTIN.bzip2}
+.endif
+
+.if defined(USE_BZIP2)
+_NEED_BZIP2= YES
+.endif
+
+.if !empty(BUILDLINK_CHECK_BUILTIN.bzip2:M[yY][eE][sS])
+_NEED_BZIP2= NO
+.endif
+
+.if !defined(_NEED_BZIP2)
+. if !empty(BUILDLINK_IS_BUILTIN.bzip2:M[nN][oO])
+_NEED_BZIP2= YES
+. else
+_NEED_BZIP2= NO
+#
+# Solaris 9 has bzip2 1.0.1, build it on older versions.
+# Darwin only has static libbz2.a, which can't be buildlinked.
+#
+_INCOMPAT_BZIP2= SunOS-5.[678]-* Darwin-*
+INCOMPAT_BZIP2?= # empty
+. for _pattern_ in ${_INCOMPAT_BZIP2} ${INCOMPAT_BZIP2}
+. if !empty(MACHINE_PLATFORM:M${_pattern_})
+_NEED_BZIP2= YES
+. endif
+. endfor
+. endif
+MAKEFLAGS+= _NEED_BZIP2="${_NEED_BZIP2}"
+.endif
+
+.if ${_NEED_BZIP2} == "YES"
+. if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= bzip2
+. endif
+.endif
+
+.if !empty(BZIP2_BUILDLINK3_MK:M\+)
+. if ${_NEED_BZIP2} == "YES"
+BUILDLINK_PACKAGES+= bzip2
+. else
+BUILDLINK_PREFIX.bzip2= /usr
+. endif
+.endif # BZIP2_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/audio/SDL_mixer/buildlink3.mk b/audio/SDL_mixer/buildlink3.mk
new file mode 100644
index 00000000000..c2d217ddede
--- /dev/null
+++ b/audio/SDL_mixer/buildlink3.mk
@@ -0,0 +1,22 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+SDL_MIXER_BUILDLINK3_MK:= ${SDL_MIXER_BUILDLINK3_MK}+
+
+.if !empty(SDL_MIXER_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.SDL_mixer?= SDL_mixer>=1.2.5nb1
+BUILDLINK_PKGSRCDIR.SDL_mixer?= ../../audio/SDL_mixer
+.endif # SDL_MIXER_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= SDL_mixer
+.endif
+
+.if !empty(SDL_MIXER_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= SDL_mixer
+BUILDLINK_INCDIRS.SDL_mixer?= include/SDL
+
+. include "../../devel/SDL/buildlink3.mk"
+.endif # SDL_MIXER_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/audio/esound/buildlink3.mk b/audio/esound/buildlink3.mk
new file mode 100644
index 00000000000..0b981268b0e
--- /dev/null
+++ b/audio/esound/buildlink3.mk
@@ -0,0 +1,21 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+ESOUND_BUILDLINK3_MK:= ${ESOUND_BUILDLINK3_MK}+
+
+.if !empty(ESOUND_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.esound?= esound>=0.2.18
+BUILDLINK_PKGSRCDIR.esound?= ../../audio/esound
+.endif # ESOUND_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= esound
+.endif
+
+.if !empty(ESOUND_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= esound
+
+. include "../../audio/libaudiofile/buildlink3.mk"
+.endif # ESOUND_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/audio/libaudiofile/buildlink3.mk b/audio/libaudiofile/buildlink3.mk
new file mode 100644
index 00000000000..d7cb8d0b478
--- /dev/null
+++ b/audio/libaudiofile/buildlink3.mk
@@ -0,0 +1,19 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+AUDIOFILE_BUILDLINK3_MK:= ${AUDIOFILE_BUILDLINK3_MK}+
+
+.if !empty(AUDIOFILE_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.audiofile?= libaudiofile>=0.2.1
+BUILDLINK_PKGSRCDIR.audiofile?= ../../audio/libaudiofile
+.endif # AUDIOFILE_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= audiofile
+.endif
+
+.if !empty(AUDIOFILE_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= audiofile
+.endif # AUDIOFILE_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/audio/libogg/buildlink3.mk b/audio/libogg/buildlink3.mk
new file mode 100644
index 00000000000..ae252c23631
--- /dev/null
+++ b/audio/libogg/buildlink3.mk
@@ -0,0 +1,19 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+LIBOGG_BUILDLINK3_MK:= ${LIBOGG_BUILDLINK3_MK}+
+
+.if !empty(LIBOGG_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.libogg?= libogg>=1.0.0.8
+BUILDLINK_PKGSRCDIR.libogg?= ../../audio/libogg
+.endif # LIBOGG_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= libogg
+.endif
+
+.if !empty(LIBOGG_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= libogg
+.endif # LIBOGG_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/audio/oss/buildlink3.mk b/audio/oss/buildlink3.mk
new file mode 100644
index 00000000000..9e00efe8f92
--- /dev/null
+++ b/audio/oss/buildlink3.mk
@@ -0,0 +1,49 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+OSS_BUILDLINK3_MK:= ${OSS_BUILDLINK3_MK}+
+
+.if !empty(OSS_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.oss?= oss-[0-9]*
+BUILDLINK_PKGSRCDIR.oss?= ../../audio/oss
+.endif # OSS_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= oss
+.endif
+
+.if !empty(OSS_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= oss
+BUILDLINK_INCDIRS.oss= include lib/oss/include
+
+# If we are using audio/oss, then we don't need the NetBSD OSS
+# compatibility library.
+#
+BUILDLINK_TRANSFORM+= S:-lossaudio:
+
+BUILDLINK_TARGETS+= buildlink-oss-soundcard-h
+
+LIBOSSAUDIO= # empty
+DEVOSSAUDIO= /dev/dsp
+DEVOSSSOUND= ${DEVOSSAUDIO}
+
+# Many source files mistakenly include both <sys/soundcard.h> and
+# <soundcard.h>, which causes errors since the definitions in the OSS
+# sys/soundcard.h conflict with the definitions in the system soundcard.h.
+# We fix this by making <sys/soundcard.h> and <soundcard.h> point to the
+# same file and rely on multiple inclusion protection to prevent conflicts.
+#
+.PHONY: buildlink-oss-soundcard-h
+buildlink-oss-soundcard-h:
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ soundcard_h=${BUILDLINK_DIR}/include/soundcard.h; \
+ sys_soundcard_h=${BUILDLINK_PREFIX.oss}/lib/oss/include/sys/soundcard.h; \
+ if [ ! -f $${soundcard_h} -a -f $${sys_soundcard_h} ]; then \
+ ${ECHO_BUILDLINK_MSG} \
+ "Linking $${sys_soundcard_h} to $${soundcard_h}."; \
+ ${MKDIR} `${DIRNAME} $${soundcard_h}`; \
+ ${LN} -s $${sys_soundcard_h} $${soundcard_h}; \
+ fi
+.endif # OSS_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/converters/libiconv/buildlink3.mk b/converters/libiconv/buildlink3.mk
new file mode 100644
index 00000000000..49c559135eb
--- /dev/null
+++ b/converters/libiconv/buildlink3.mk
@@ -0,0 +1,84 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+ICONV_BUILDLINK3_MK:= ${ICONV_BUILDLINK3_MK}+
+
+.if !empty(ICONV_BUILDLINK3_MK:M\+)
+. include "../../mk/bsd.prefs.mk"
+
+BUILDLINK_DEPENDS.iconv?= libiconv>=1.9.1
+BUILDLINK_PKGSRCDIR.iconv?= ../../converters/libiconv
+.endif # ICONV_BUILDLINK3_MK
+
+BUILDLINK_CHECK_BUILTIN.iconv?= NO
+
+.if !defined(BUILDLINK_IS_BUILTIN.iconv)
+BUILDLINK_IS_BUILTIN.iconv= NO
+. if exists(/usr/include/iconv.h)
+BUILDLINK_IS_BUILTIN.iconv= YES
+. endif
+.endif
+
+.if !empty(BUILDLINK_CHECK_BUILTIN.iconv:M[yY][eE][sS])
+_NEED_GNU_ICONV= NO
+.endif
+
+.if !defined(_NEED_GNU_ICONV)
+. if !empty(BUILDLINK_IS_BUILTIN.iconv:M[nN][oO])
+_NEED_GNU_ICONV= YES
+. else
+_NEED_GNU_ICONV= NO
+_INCOMPAT_ICONV?= # should be set from defs.${OPSYS}.mk
+INCOMPAT_ICONV?= # empty
+. for _pattern_ in ${_INCOMPAT_ICONV} ${INCOMPAT_ICONV}
+. if !empty(MACHINE_PLATFORM:M${_pattern_})
+_NEED_GNU_ICONV= YES
+. endif
+. endfor
+. endif
+. if defined(USE_GNU_ICONV)
+_NEED_GNU_ICONV= YES
+. endif
+MAKEFLAGS+= _NEED_GNU_ICONV=${_NEED_GNU_ICONV}
+.endif
+
+.if ${_NEED_GNU_ICONV} == "YES"
+. if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= iconv
+. endif
+.endif
+
+.if !empty(ICONV_BUILDLINK3_MK:M\+)
+. if ${_NEED_GNU_ICONV} == "YES"
+BUILDLINK_PACKAGES+= iconv
+_BLNK_LIBICONV= -liconv
+. else
+. if !defined(_BLNK_LIBICONV_FOUND)
+_BLNK_LIBICONV_FOUND!= \
+ if [ "`${ECHO} /usr/lib/libiconv.*`" = "/usr/lib/libiconv.*" ]; then \
+ ${ECHO} NO; \
+ else \
+ ${ECHO} YES; \
+ fi
+MAKEFLAGS+= _BLNK_LIBICONV_FOUND=${_BLNK_LIBICONV_FOUND}
+. endif
+. if ${_BLNK_LIBICONV_FOUND} == "YES"
+_BLNK_LIBICONV= -liconv
+. else
+_BLNK_LIBICONV= # empty
+BUILDLINK_TRANSFORM+= S:-liconv:
+. endif
+BUILDLINK_LDADD.iconv?= ${_BLNK_LIBICONV}
+BUILDLINK_PREFIX.iconv= /usr
+. endif
+
+. if defined(GNU_CONFIGURE)
+. if ${_NEED_GNU_ICONV} == "YES"
+CONFIGURE_ARGS+= --with-libiconv-prefix=${BUILDLINK_PREFIX.iconv}
+. else
+CONFIGURE_ARGS+= --without-libiconv-prefix
+. endif
+. endif
+.endif # ICONV_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/databases/db/buildlink3.mk b/databases/db/buildlink3.mk
new file mode 100644
index 00000000000..a9518948b67
--- /dev/null
+++ b/databases/db/buildlink3.mk
@@ -0,0 +1,41 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+DB2_BUILDLINK3_MK:= ${DB2_BUILDLINK3_MK}+
+
+.if !empty(DB2_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= db
+BUILDLINK_DEPENDS.db?= db>=2.7.3
+BUILDLINK_PKGSRCDIR.db?= ../../databases/db
+.endif # DB2_BUILDLINK3_MK
+
+.if !defined(_NEED_DB2)
+_NEED_DB2= YES
+. if defined(USE_DB185)
+. if exists(/usr/include/db.h) # NetBSD, Darwin
+BUILDLINK_PREFIX.db= /usr
+_NEED_DB2= NO
+. elif exists(/usr/include/db1/db.h) # Linux
+BUILDLINK_PREFIX.db= /usr
+BUILDLINK_INCDIRS.db= include/db1
+BUILDLINK_TRANSFORM+= l:db:db1
+_NEED_DB2= NO
+. endif
+. endif
+MAKEFLAGS+= _NEED_DB2="${_NEED_DB2}"
+.endif
+
+.if ${_NEED_DB2} == "YES"
+. if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= db
+. endif
+.endif
+
+.if !empty(DB2_BUILDLINK3_MK:M\+)
+. if ${_NEED_DB2} == "YES"
+BUILDLINK_INCDIRS.db= include/db2
+BUILDLINK_TRANSFORM+= l:db:db2
+. endif
+.endif # DB2_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/databases/db3/buildlink3.mk b/databases/db3/buildlink3.mk
new file mode 100644
index 00000000000..bd5f19685cc
--- /dev/null
+++ b/databases/db3/buildlink3.mk
@@ -0,0 +1,19 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+DB3_BUILDLINK3_MK:= ${DB3_BUILDLINK3_MK}+
+
+.if !empty(DB3_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.db3?= db3>=2.9.2
+BUILDLINK_PKGSRCDIR.db3?= ../../databases/db3
+.endif # DB3_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= db3
+.endif
+
+.if !empty(DB3_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= db3
+.endif # DB3_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/databases/db4/buildlink3.mk b/databases/db4/buildlink3.mk
new file mode 100644
index 00000000000..14524df16c0
--- /dev/null
+++ b/databases/db4/buildlink3.mk
@@ -0,0 +1,20 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+DB4_BUILDLINK3_MK:= ${DB4_BUILDLINK3_MK}+
+
+.if !empty(DB4_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.db4?= db4>=4.1.25
+BUILDLINK_PKGSRCDIR.db4?= ../../databases/db4
+BUILDLINK_CPPFLAGS.db4?= -I${BUILDLINK_PREFIX.db4}/include/db4
+.endif # DB4_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= db4
+.endif
+
+.if !empty(DB4_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= db4
+.endif # DB4_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/databases/mysql-client/buildlink3.mk b/databases/mysql-client/buildlink3.mk
new file mode 100644
index 00000000000..6b19103f3b3
--- /dev/null
+++ b/databases/mysql-client/buildlink3.mk
@@ -0,0 +1,24 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+MYSQL_CLIENT_BUILDLINK3_MK:= ${MYSQL_CLIENT_BUILDLINK3_MK}+
+
+.if !empty(MYSQL_CLIENT_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.mysql-client?= mysql-client>=3.23.58
+BUILDLINK_PKGSRCDIR.mysql-client?= ../../databases/mysql-client
+BUILDLINK_LDFLAGS.mysql-client?= \
+ -L${BUILDLINK_PREFIX.mysql-client}/lib/mysql \
+ -Wl,${RPATH_FLAG}${BUILDLINK_PREFIX.mysql-client}/lib/mysql
+.endif # MYSQL_CLIENT_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= mysql-client
+.endif
+
+.if !empty(MYSQL_CLIENT_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= mysql-client
+
+. include "../../devel/zlib/buildlink3.mk"
+.endif # MYSQL_CLIENT_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/databases/openldap/buildlink3.mk b/databases/openldap/buildlink3.mk
new file mode 100644
index 00000000000..85194a528b0
--- /dev/null
+++ b/databases/openldap/buildlink3.mk
@@ -0,0 +1,28 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+OPENLDAP_BUILDLINK3_MK:= ${OPENLDAP_BUILDLINK3_MK}+
+
+.if !empty(OPENLDAP_BUILDLINK3_MK:M\+)
+. include "../../mk/bsd.prefs.mk"
+
+BUILDLINK_DEPENDS.openldap?= openldap>=2.1.22
+BUILDLINK_PKGSRCDIR.openldap?= ../../databases/openldap
+.endif # OPENLDAP_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= openldap
+.endif
+
+.if !empty(OPENLDAP_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= openldap
+
+. if defined(USE_SASL2) && (${USE_SASL2} == "YES")
+. include "../../security/cyrus-sasl2/buildlink3.mk"
+. elif defined(USE_SASL) && (${USE_SASL} == "YES")
+. include "../../security/cyrus-sasl/buildlink3.mk"
+. endif
+. include "../../security/openssl/buildlink3.mk"
+.endif # OPENLDAP_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/databases/p5-DBI/buildlink3.mk b/databases/p5-DBI/buildlink3.mk
new file mode 100644
index 00000000000..ff21b0785b0
--- /dev/null
+++ b/databases/p5-DBI/buildlink3.mk
@@ -0,0 +1,22 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+P5_DBI_BUILDLINK3_MK:= ${P5_DBI_BUILDLINK3_MK}+
+
+.if !empty(P5_DBI_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.p5-DBI?= p5-DBI>=1.30
+BUILDLINK_PKGSRCDIR.p5-DBI?= ../../databases/p5-DBI
+BUILDLINK_INCDIRS.p5-DBI?= ${PERL5_SUB_INSTALLSITEARCH}/auto/DBI
+.endif # P5_DBI_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= p5-DBI
+.endif
+
+.if !empty(P5_DBI_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= p5-DBI
+
+. include "../../lang/perl5/buildlink3.mk"
+.endif # P5_DBI_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/databases/postgresql-lib/buildlink3.mk b/databases/postgresql-lib/buildlink3.mk
new file mode 100644
index 00000000000..d4533bc1934
--- /dev/null
+++ b/databases/postgresql-lib/buildlink3.mk
@@ -0,0 +1,22 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+POSTGRESQL_LIB_BUILDLINK3_MK:= ${POSTGRESQL_LIB_BUILDLINK3_MK}+
+
+.if !empty(POSTGRESQL_LIB_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.postgresql-lib?= postgresql-lib>=7.3.1
+BUILDLINK_PKGSRCDIR.postgresql-lib?= ../../databases/postgresql-lib
+BUILDLINK_INCDIRS.postgresql-lib?= include/postgresql
+.endif # POSTGRESQL_LIB_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= postgresql-lib
+.endif
+
+.if !empty(POSTGRESQL_LIB_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= postgresql-lib
+
+. include "../../security/openssl/buildlink3.mk"
+.endif # POSTGRESQL_LIB_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/devel/SDL/buildlink3.mk b/devel/SDL/buildlink3.mk
new file mode 100644
index 00000000000..ed859ccd975
--- /dev/null
+++ b/devel/SDL/buildlink3.mk
@@ -0,0 +1,29 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+SDL_BUILDLINK3_MK:= ${SDL_BUILDLINK3_MK}+
+
+.if !empty(SDL_BUILDLINK3_MK:M\+)
+. include "../../mk/bsd.prefs.mk"
+
+BUILDLINK_DEPENDS.SDL?= SDL>=1.2.5nb5
+BUILDLINK_PKGSRCDIR.SDL?= ../../devel/SDL
+.endif # SDL_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= SDL
+.endif
+
+.if !empty(SDL_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= SDL
+
+USE_X11= YES
+PTHREAD_OPTS+= require
+
+. include "../../graphics/MesaLib/buildlink3.mk"
+. include "../../graphics/glut/buildlink3.mk"
+. include "../../graphics/aalib-x11/buildlink3.mk"
+. include "../../mk/pthread.buildlink3.mk"
+.endif # SDL_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/devel/binutils/buildlink3.mk b/devel/binutils/buildlink3.mk
new file mode 100644
index 00000000000..020c265a1e6
--- /dev/null
+++ b/devel/binutils/buildlink3.mk
@@ -0,0 +1,74 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+BINUTILS_BUILDLINK3_MK:= ${BINUTILS_BUILDLINK3_MK}+
+
+.if !defined(BINUTILS_BUILDLINK3_MK)
+BINUTILS_BUILDLINK3_MK= # defined
+
+.if !empty(BINUTILS_BUILDLINK3_MK:M\+)
+. include "../../mk/bsd.prefs.mk"
+
+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
+.endif
+
+.if defined(USE_BINUTILS)
+_NEED_BINUTILS= YES
+.endif
+
+.if !empty(BUILDLINK_CHECK_BUILTIN.binutils:M[yY][eE][sS])
+_NEED_BINUTILS= NO
+.endif
+
+.if !defined(_NEED_BINUTILS)
+. if !empty(BUILDLINK_IS_BUILTIN.binutils:M[nN][oO])
+_NEED_BINUTILS= YES
+. else
+_NEED_BINUTILS= NO
+#
+# 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_})
+_NEED_BINUTILS= YES
+. endif
+. endfor
+. endif
+MAKEFLAGS+= _NEED_BINUTILS="${_NEED_BINUTILS}"
+.endif
+
+.if ${_NEED_BINUTILS} == "YES"
+. if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= binutils
+. endif
+.endif
+
+.if !empty(BINUTILS_BUILDLINK3_MK:M\+)
+. if ${_NEED_BINUTILS} == "YES"
+BUILDLINK_PACKAGES+= binutils
+
+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:C/\+$//}
diff --git a/devel/boehm-gc/buildlink3.mk b/devel/boehm-gc/buildlink3.mk
new file mode 100644
index 00000000000..8c77f114c5c
--- /dev/null
+++ b/devel/boehm-gc/buildlink3.mk
@@ -0,0 +1,19 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+BOEHM_GC_BUILDLINK3_MK:= ${BOEHM_GC_BUILDLINK3_MK}+
+
+.if !empty(BOEHM_GC_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.boehm-gc?= boehm-gc>=6.2nb1
+BUILDLINK_PKGSRCDIR.boehm-gc?= ../../devel/boehm-gc
+.endif # BOEHM_GC_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= boehm-gc
+.endif
+
+.if !empty(BOEHM_GC_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= boehm-gc
+.endif # BOEHM_GC_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/devel/dlcompat/buildlink3.mk b/devel/dlcompat/buildlink3.mk
new file mode 100644
index 00000000000..704334f42bb
--- /dev/null
+++ b/devel/dlcompat/buildlink3.mk
@@ -0,0 +1,19 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+DLCOMPAT_BUILDLINK3_MK:= ${DLCOMPAT_BUILDLINK3_MK}+
+
+.if !empty(DLCOMPAT_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.dlcompat?= dlcompat>=20020606
+BUILDLINK_PKGSRCDIR.dlcompat?= ../../devel/dlcompat
+.endif # DLCOMPAT_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= dlcompat
+.endif
+
+.if !empty(DLCOMPAT_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= dlcompat
+.endif # DLCOMPAT_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/devel/gettext-lib/buildlink3.mk b/devel/gettext-lib/buildlink3.mk
new file mode 100644
index 00000000000..b720068110c
--- /dev/null
+++ b/devel/gettext-lib/buildlink3.mk
@@ -0,0 +1,129 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+GETTEXT_BUILDLINK3_MK:= ${GETTEXT_BUILDLINK3_MK}+
+
+.if !empty(GETTEXT_BUILDLINK3_MK:M\+)
+. include "../../mk/bsd.prefs.mk"
+
+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
+. endif
+.endif
+
+.if !empty(BUILDLINK_CHECK_BUILTIN.gettext:M[yY][eE][sS])
+_NEED_GNU_GETTEXT= NO
+.endif
+
+.if !defined(_NEED_GNU_GETTEXT)
+. if !empty(BUILDLINK_IS_BUILTIN.gettext:M[nN][oO])
+_NEED_GNU_GETTEXT= YES
+. else
+#
+# Consider the base system libintl to be gettext-lib-0.10.35nb1.
+#
+_GETTEXT_PKG= gettext-lib-0.10.35nb1
+_GETTEXT_DEPENDS= ${BUILDLINK_DEPENDS.gettext}
+_NEED_GNU_GETTEXT!= \
+ if ${PKG_ADMIN} pmatch '${_GETTEXT_DEPENDS}' ${_GETTEXT_PKG}; then \
+ ${ECHO} "NO"; \
+ else \
+ ${ECHO} "YES"; \
+ fi
+#
+# 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_})
+_NEED_GNU_GETTEXT= YES
+. endif
+. endfor
+. endif
+MAKEFLAGS+= _NEED_GNU_GETTEXT=${_NEED_GNU_GETTEXT}
+.endif
+
+.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 ${_NEED_GNU_GETTEXT} == "YES"
+. if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= gettext
+. endif
+.endif
+
+.if !empty(GETTEXT_BUILDLINK3_MK:M\+)
+. if ${_NEED_GNU_GETTEXT} == "YES"
+BUILDLINK_PACKAGES+= gettext
+_BLNK_LIBINTL= -lintl
+_GETTEXT_ICONV_DEPENDS= gettext-lib>=0.11.5nb1
+. if !defined(_GETTEXT_NEEDS_ICONV)
+_GETTEXT_NEEDS_ICONV!= \
+ if ${PKG_INFO} -qe "${BUILDLINK_DEPENDS.gettext}"; then \
+ pkg=`cd ${_PKG_DBDIR}; ${PKG_ADMIN} -s "" lsbest '${BUILDLINK_DEPENDS.gettext}'`; \
+ if ${PKG_INFO} -qN "$$pkg" | ${GREP} -q "libiconv-[0-9]"; then \
+ ${ECHO} YES; \
+ else \
+ ${ECHO} NO; \
+ fi; \
+ else \
+ ${ECHO} YES; \
+ fi
+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
+BUILDLINK_PREFIX.gettext= /usr
+. if ${_BLNK_LIBINTL_FOUND} == "YES"
+_BLNK_LIBINTL= -lintl
+. else
+_BLNK_LIBINTL= # empty
+BUILDLINK_TRANSFORM+= S:-lintl:
+. 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 ${_NEED_GNU_GETTEXT} == "NO"
+. if ${_BLNK_LIBINTL_FOUND} == "YES"
+CONFIGURE_ENV+= gt_cv_func_gnugettext1_libintl="yes"
+. endif
+. endif
+. if ${_NEED_GNU_GETTEXT} == "YES"
+CONFIGURE_ARGS+= --with-libintl-prefix=${BUILDLINK_PREFIX.gettext}
+. else
+CONFIGURE_ARGS+= --without-libintl-prefix
+. endif
+. endif
+.endif # GETTEXT_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/devel/glib/buildlink3.mk b/devel/glib/buildlink3.mk
new file mode 100644
index 00000000000..5f0043674a7
--- /dev/null
+++ b/devel/glib/buildlink3.mk
@@ -0,0 +1,23 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+GLIB_BUILDLINK3_MK:= ${GLIB_BUILDLINK3_MK}+
+
+.if !empty(GLIB_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.glib?= glib>=1.2.10nb5
+BUILDLINK_PKGSRCDIR.glib?= ../../devel/glib
+.endif # GLIB_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= glib
+.endif
+
+.if !empty(GLIB_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= glib
+
+PTHREAD_OPTS+= require
+
+. include "../../mk/pthread.buildlink3.mk"
+.endif # GLIB_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/devel/libgetopt/buildlink3.mk b/devel/libgetopt/buildlink3.mk
new file mode 100644
index 00000000000..3c4780d687c
--- /dev/null
+++ b/devel/libgetopt/buildlink3.mk
@@ -0,0 +1,54 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+GETOPT_BUILDLINK3_MK:= ${GETOPT_BUILDLINK3_MK}+
+
+.if !empty(GETOPT_BUILDLINK3_MK:M\+)
+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])
+_NEED_GETOPT= NO
+.endif
+
+.if !defined(_NEED_GETOPT)
+. if !empty(BUILDLINK_IS_BUILTIN.getopt:M[nN][oO])
+_NEED_GETOPT= YES
+. else
+_NEED_GETOPT= NO
+. endif
+MAKEFLAGS+= _NEED_GETOPT="${_NEED_GETOPT}"
+.endif
+
+.if ${_NEED_GETOPT} == "YES"
+. if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= getopt
+. endif
+.endif
+
+.if !empty(GETOPT_BUILDLINK3_MK:M\+)
+. if ${_NEED_GETOPT} == "YES"
+BUILDLINK_PACKAGES+= getopt
+LIBGETOPT= -lgetopt
+. else
+BUILDLINK_PREFIX.getopt= /usr
+LIBGETOPT= # empty
+. endif
+
+BUILDLINK_LDADD.getopt?= ${LIBGETOPT}
+
+CONFIGURE_ENV+= LIBGETOPT="${LIBGETOPT}"
+MAKE_ENV+= LIBGETOPT="${LIBGETOPT}"
+.endif # GETOPT_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/devel/libmm/buildlink3.mk b/devel/libmm/buildlink3.mk
new file mode 100644
index 00000000000..8eb94f0c2f8
--- /dev/null
+++ b/devel/libmm/buildlink3.mk
@@ -0,0 +1,19 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+LIBMM_BUILDLINK3_MK:= ${LIBMM_BUILDLINK3_MK}+
+
+.if !empty(LIBMM_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.libmm?= libmm>=1.2.1
+BUILDLINK_PKGSRCDIR.libmm?= ../../devel/libmm
+.endif # LIBMM_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= libmm
+.endif
+
+.if !empty(LIBMM_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= libmm
+.endif # LIBMM_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/devel/libslang/buildlink3.mk b/devel/libslang/buildlink3.mk
new file mode 100644
index 00000000000..7fe19fc17a4
--- /dev/null
+++ b/devel/libslang/buildlink3.mk
@@ -0,0 +1,26 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+LIBSLANG_BUILDLINK3_MK:= ${LIBSLANG_BUILDLINK3_MK}+
+
+.include "../../mk/bsd.prefs.mk"
+
+.if !empty(LIBSLANG_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.libslang?= libslang>=1.4.9nb1
+BUILDLINK_PKGSRCDIR.libslang?= ../../devel/libslang
+.endif # LIBSLANG_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= libslang
+.endif
+
+.if !empty(LIBSLANG_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= libslang
+
+# Debian adds a dependency on ncurses.
+. if ${OPSYS} == "Linux" && ${LOWER_VENDOR} == "debian"
+. include "../../devel/ncurses/buildlink3.mk"
+. endif
+.endif # LIBSLANG_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/devel/ncurses/buildlink3.mk b/devel/ncurses/buildlink3.mk
new file mode 100644
index 00000000000..5c4634971d5
--- /dev/null
+++ b/devel/ncurses/buildlink3.mk
@@ -0,0 +1,116 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+#
+# Optionally define:
+#
+# USE_NCURSES force use of ncurses
+# INCOMPAT_CURSES specify MACHINE_PLATFORM versions that are missing
+# some needed functions.
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+NCURSES_BUILDLINK3_MK:= ${NCURSES_BUILDLINK3_MK}+
+
+.if !empty(NCURSES_BUILDLINK3_MK:M\+)
+. include "../../mk/bsd.prefs.mk"
+
+BUILDLINK_DEPENDS.ncurses?= ncurses>=5.3nb1
+BUILDLINK_PKGSRCDIR.ncurses?= ../../devel/ncurses
+.endif # NCURSES_BUILDLINK3_MK
+
+BUILDLINK_CHECK_BUILTIN.ncurses?= NO
+
+.if !defined(BUILDLINK_IS_BUILTIN.ncurses)
+BUILDLINK_IS_BUILTIN.ncurses= NO
+.endif
+
+.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
+
+.if ${_BLNK_LIBNCURSES_FOUND} == "YES"
+BUILDLINK_IS_BUILTIN.ncurses= YES
+.endif
+
+.if !empty(BUILDLINK_CHECK_BUILTIN.ncurses:M[yY][eE][sS])
+_NEED_NCURSES= NO
+.endif
+
+.if !defined(_NEED_NCURSES)
+. if !empty(BUILDLINK_IS_BUILTIN.ncurses:M[nN][oO])
+_NEED_NCURSES= NO
+. else
+#
+# These versions of NetBSD didn't have a curses library that was capable of
+# replacing ncurses.
+#
+_INCOMPAT_CURSES= NetBSD-0.*-* NetBSD-1.[0123]*-*
+_INCOMPAT_CURSES+= NetBSD-1.4.*-* NetBSD-1.4[A-X]-*
+#
+# These catch-alls are probably too broad, but better to err on the safe
+# side. We can narrow down the match when we have better information.
+#
+_INCOMPAT_CURSES+= SunOS-*-*
+_INCOMPAT_CURSES+= IRIX-*-*
+_INCOMPAT_CURSES+= Darwin-*-*
+
+INCOMPAT_CURSES?= # empty
+. for _pattern_ in ${_INCOMPAT_CURSES} ${INCOMPAT_CURSES}
+. if !empty(MACHINE_PLATFORM:M${_pattern_})
+_NEED_NCURSES= YES
+. endif
+. endfor
+. endif
+MAKEFLAGS+= _NEED_NCURSES="${_NEED_NCURSES}"
+.endif
+
+.if ${_NEED_NCURSES} == "YES"
+. if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= ncurses
+. endif
+.endif
+
+.if !empty(NCURSES_BUILDLINK3_MK:M\+)
+. if ${_NEED_NCURSES} == "YES"
+BUILDLINK_PACKAGES+= ncurses
+. else
+BUILDLINK_PREFIX.ncurses= /usr
+. if ${_BLNK_LIBNCURSES_FOUND} == "NO"
+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
+
+.PHONY: buildlink-ncurses-curses-h
+buildlink-ncurses-curses-h:
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ if [ ! -f ${BUILDLINK_DIR}/include/curses.h ]; then \
+ ${ECHO_BUILDLINK_MSG} "Linking curses.h to ncurses.h in ${BUILDLINK_DIR}."; \
+ ${LN} -s ncurses.h ${BUILDLINK_DIR}/include/curses.h; \
+ fi
+.endif # NCURSES_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/devel/pcre/buildlink3.mk b/devel/pcre/buildlink3.mk
new file mode 100644
index 00000000000..07180cac848
--- /dev/null
+++ b/devel/pcre/buildlink3.mk
@@ -0,0 +1,19 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+PCRE_BUILDLINK3_MK:= ${PCRE_BUILDLINK3_MK}+
+
+.if !empty(PCRE_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.pcre?= pcre>=3.4nb1
+BUILDLINK_PKGSRCDIR.pcre?= ../../devel/pcre
+.endif # PCRE_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= pcre
+.endif
+
+.if !empty(PCRE_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= pcre
+.endif # PCRE_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/devel/pkgconfig/buildlink3.mk b/devel/pkgconfig/buildlink3.mk
new file mode 100644
index 00000000000..838ae571330
--- /dev/null
+++ b/devel/pkgconfig/buildlink3.mk
@@ -0,0 +1,24 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+PKGCONFIG_BUILDLINK3_MK:= ${PKGCONFIG_BUILDLINK3_MK}+
+
+.if !empty(PKGCONFIG_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.pkgconfig?= pkgconfig>=0.15.0
+BUILDLINK_PKGSRCDIR.pkgconfig?= ../../devel/pkgconfig
+BUILDLINK_DEPMETHOD.pkgconfig?= build
+.endif # PKGCONFIG_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= pkgconfig
+.endif
+
+.if !empty(PKGCONFIG_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= pkgconfig
+
+PKG_CONFIG_PATH?= ${LOCALBASE}/lib/pkgconfig:${X11BASE}/lib/pkgconfig
+CONFIGURE_ENV+= PKG_CONFIG_PATH="${PKG_CONFIG_PATH}"
+MAKE_ENV+= PKG_CONFIG_PATH="${PKG_CONFIG_PATH}"
+.endif # PKGCONFIG_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/devel/popt/buildlink3.mk b/devel/popt/buildlink3.mk
new file mode 100644
index 00000000000..117a591eb34
--- /dev/null
+++ b/devel/popt/buildlink3.mk
@@ -0,0 +1,21 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:43 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+POPT_BUILDLINK3_MK:= ${POPT_BUILDLINK3_MK}+
+
+.if !empty(POPT_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.popt?= popt>=1.7nb3
+BUILDLINK_PKGSRCDIR.popt?= ../../devel/popt
+.endif # POPT_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= popt
+.endif
+
+.if !empty(POPT_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= popt
+
+. include "../../devel/gettext-lib/buildlink3.mk"
+.endif # POPT_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/devel/pth/buildlink3.mk b/devel/pth/buildlink3.mk
new file mode 100644
index 00000000000..8ac152f2645
--- /dev/null
+++ b/devel/pth/buildlink3.mk
@@ -0,0 +1,19 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+PTH_BUILDLINK3_MK:= ${PTH_BUILDLINK3_MK}+
+
+.if !empty(PTH_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.pth?= pth>=2.0.0
+BUILDLINK_PKGSRCDIR.pth?= ../../devel/pth
+.endif # PTH_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= pth
+.endif
+
+.if !empty(PTH_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= pth
+.endif # PTH_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/devel/readline/buildlink3.mk b/devel/readline/buildlink3.mk
new file mode 100644
index 00000000000..9a8b28c10bd
--- /dev/null
+++ b/devel/readline/buildlink3.mk
@@ -0,0 +1,88 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+#
+# Optionally define USE_GNU_READLINE to force use of GNU readline.
+#
+# NOTE: You may need to do some more work to get libedit recognized over
+# libreadline, especially by GNU configure scripts.
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+READLINE_BUILDLINK3_MK:= ${READLINE_BUILDLINK3_MK}+
+
+.if !empty(READLINE_BUILDLINK3_MK:M\+)
+. include "../../mk/bsd.prefs.mk"
+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(BUILDLINK_IS_BUILTIN.readline)
+BUILDLINK_IS_BUILTIN.readline= NO
+. if exists(/usr/include/readline.h) || \
+ exists(/usr/include/readline/readline.h)
+BUILDLINK_IS_BUILTIN.readline= YES
+. endif
+.endif
+
+.if defined(USE_GNU_READLINE)
+BUILDLINK_USE_BUILTIN.readline= NO
+.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[nN][oO])
+BUILDLINK_USE_BUILTIN.readline= NO
+. else
+BUILDLINK_USE_BUILTIN.readline= YES
+#
+# These catch-alls are probably too broad, but better to err on the safe
+# side. We can narrow down the match when we have better information.
+#
+_INCOMPAT_READLINE= SunOS-*-*
+INCOMPAT_READLINE?= # empty
+. for _pattern_ in ${_INCOMPAT_READLINE} ${INCOMPAT_READLINE}
+. if !empty(MACHINE_PLATFORM:M${_pattern_})
+BUILDLINK_USE_BUILTIN.readline= NO
+. endif
+. endfor
+. endif
+MAKEFLAGS+= \
+ BUILDLINK_USE_BUILTIN.readline="${BUILDLINK_USE_BUILTIN.readline}"
+.endif
+
+.if ${BUILDLINK_USE_BUILTIN.readline} == "NO"
+. if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= readline
+. endif
+.endif
+
+.if !empty(READLINE_BUILDLINK3_MK:M\+)
+. if ${BUILDLINK_USE_BUILTIN.readline} == "YES"
+BUILDLINK_PREFIX.readline= /usr
+. 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
+. if ${_BLNK_LIBEDIT_FOUND} == "YES"
+BUILDLINK_TRANSFORM+= l:history:edit
+BUILDLINK_TRANSFORM+= l:readline:edit:termcap
+. endif
+. endif
+
+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:C/\+$//}
diff --git a/devel/smpeg/buildlink3.mk b/devel/smpeg/buildlink3.mk
new file mode 100644
index 00000000000..2a567fa91a5
--- /dev/null
+++ b/devel/smpeg/buildlink3.mk
@@ -0,0 +1,22 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+SPMEG_BUILDLINK3_MK:= ${SPMEG_BUILDLINK3_MK}+
+
+.if !empty(SPMEG_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.smpeg?= smpeg>=0.4.4nb3
+BUILDLINK_PKGSRCDIR.smpeg?= ../../devel/smpeg
+.endif # SMPEG_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= smpeg
+.endif
+
+.if !empty(SPMEG_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= smpeg
+
+. include "../../devel/SDL/buildlink3.mk"
+. include "../../devel/gettext-lib/buildlink3.mk"
+.endif # SMPEG_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/devel/zlib/buildlink3.mk b/devel/zlib/buildlink3.mk
new file mode 100644
index 00000000000..195bdfb1687
--- /dev/null
+++ b/devel/zlib/buildlink3.mk
@@ -0,0 +1,72 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+ZLIB_BUILDLINK3_MK:= ${ZLIB_BUILDLINK3_MK}+
+
+.if !empty(ZLIB_BUILDLINK3_MK:M\+)
+. include "../../mk/bsd.prefs.mk"
+
+BUILDLINK_DEPENDS.zlib?= zlib>=1.1.4nb1
+BUILDLINK_PKGSRCDIR.zlib?= ../../devel/zlib
+.endif # ZLIB_BUILDLINK3_MK
+
+BUILDLINK_CHECK_BUILTIN.zlib?= NO
+
+.if !defined(BUILDLINK_IS_BUILTIN.zlib)
+BUILDLINK_IS_BUILTIN.zlib= NO
+. if exists(/usr/include/zlib.h)
+BUILDLINK_IS_BUILTIN.zlib= YES
+. endif
+.endif
+
+.if !empty(BUILDLINK_CHECK_BUILTIN.zlib:M[yY][eE][sS])
+_NEED_ZLIB= NO
+.endif
+
+.if !defined(_NEED_ZLIB)
+. if !empty(BUILDLINK_IS_BUILTIN.zlib:M[nN][oO])
+_NEED_ZLIB= YES
+. else
+_NEED_ZLIB= NO
+#
+# The listed platforms have a broken (for the purposes of pkgsrc) version
+# of this package.
+#
+_INCOMPAT_ZLIB= SunOS-*-*
+_INCOMPAT_ZLIB+= IRIX-*-*
+_INCOMPAT_ZLIB+= Darwin-*-*
+_INCOMPAT_ZLIB+= Linux-*-*
+#
+# Some NetBSD versions shipped with zlib versions lower than 1.1.3.
+#
+_INCOMPAT_ZLIB+= NetBSD-0.*-* NetBSD-1.[012]*-*
+_INCOMPAT_ZLIB+= NetBSD-1.3-* NetBSD-1.3.*-* NetBSD-1.3[A-H]-*
+
+INCOMPAT_ZLIB?= # empty
+. for _pattern_ in ${_INCOMPAT_ZLIB} ${INCOMPAT_ZLIB}
+. if !empty(MACHINE_PLATFORM:M${_pattern_})
+_NEED_ZLIB= YES
+. endif
+. endfor
+. endif
+. if defined(USE_ZLIB)
+_NEED_ZLIB= YES
+. endif
+MAKEFLAGS+= _NEED_ZLIB="${_NEED_ZLIB}"
+.endif
+
+.if ${_NEED_ZLIB} == "YES"
+. if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= zlib
+. endif
+.endif
+
+.if !empty(ZLIB_BUILDLINK3_MK:M\+)
+. if ${_NEED_ZLIB} == "YES"
+BUILDLINK_PACKAGES+= zlib
+. else
+BUILDLINK_PREFIX.zlib= /usr
+. endif
+.endif # ZLIB_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/graphics/SDL_image/buildlink3.mk b/graphics/SDL_image/buildlink3.mk
new file mode 100644
index 00000000000..fbb3c3b54d8
--- /dev/null
+++ b/graphics/SDL_image/buildlink3.mk
@@ -0,0 +1,25 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+SDL_IMAGE_BUILDLINK3_MK:= ${SDL_IMAGE_BUILDLINK3_MK}+
+
+.if !empty(SDL_IMAGE_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.SDL_image?= SDL_image>=1.2.2nb2
+BUILDLINK_PKGSRCDIR.SDL_image?= ../../graphics/SDL_image
+.endif # SDL_IMAGE_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= SDL_image
+.endif
+
+.if !empty(SDL_IMAGE_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= SDL_image
+BUILDLINK_INCDIRS.SDL_image?= include/SDL
+
+. include "../../graphics/jpeg/buildlink3.mk"
+. include "../../graphics/png/buildlink3.mk"
+. include "../../graphics/tiff/buildlink3.mk"
+. include "../../devel/SDL/buildlink3.mk"
+.endif # SDL_IMAGE_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/graphics/aalib-x11/buildlink3.mk b/graphics/aalib-x11/buildlink3.mk
new file mode 100644
index 00000000000..ac1a61750cc
--- /dev/null
+++ b/graphics/aalib-x11/buildlink3.mk
@@ -0,0 +1,27 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+AALIB_X11_BUILDLINK3_MK:= ${AALIB_X11_BUILDLINK3_MK}+
+
+.if !empty(AALIB_X11_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.aalib-x11?= aalib-x11>=1.4.0.4nb1
+BUILDLINK_PKGSRCDIR.aalib-x11?= ../../graphics/aalib-x11
+.endif # AALIB_X11_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= aalib-x11
+.endif
+
+.if !empty(AALIB_X11_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= aalib-x11
+
+BUILDLINK_FILES.aalib-x11= include/aalib-x11.h
+BUILDLINK_TRANSFORM.aalib-x11+= -e "s|/aalib-x11.h|/aalib.h|g"
+BUILDLINK_TRANSFORM+= l:aa:aa-x11
+
+AALIB_CONFIG= ${BUILDLINK_PREFIX.aalib-x11}/bin/aalib-x11-config
+CONFIGURE_ENV+= AALIB_CONFIG="${AALIB_CONFIG}"
+MAKE_ENV+= AALIB_CONFIG="${AALIB_CONFIG}"
+.endif # AALIB_X11_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/graphics/freetype-lib/buildlink3.mk b/graphics/freetype-lib/buildlink3.mk
new file mode 100644
index 00000000000..cc74e905284
--- /dev/null
+++ b/graphics/freetype-lib/buildlink3.mk
@@ -0,0 +1,21 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+FREETYPE_BUILDLINK3_MK:= ${FREETYPE_BUILDLINK3_MK}+
+
+.if !empty(FREETYPE_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.freetype?= freetype-lib>=1.3.1nb1
+BUILDLINK_PKGSRCDIR.freetype?= ../../graphics/freetype-lib
+.endif # FREETYPE_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= freetype
+.endif
+
+.if !empty(FREETYPE_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= freetype
+
+. include "../../devel/gettext-lib/buildlink3.mk"
+.endif # FREETYPE_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/graphics/gd/buildlink3.mk b/graphics/gd/buildlink3.mk
new file mode 100644
index 00000000000..865d959f18a
--- /dev/null
+++ b/graphics/gd/buildlink3.mk
@@ -0,0 +1,25 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+GD_BUILDLINK3_MK:= ${GD_BUILDLINK3_MK}+
+
+.if !empty(GD_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.gd?= gd>=2.0.15
+BUILDLINK_PKGSRCDIR.gd?= ../../graphics/gd
+.endif # GD_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= gd
+.endif
+
+.if !empty(GD_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= gd
+
+. include "../../devel/zlib/buildlink3.mk"
+. include "../../graphics/freetype2/buildlink3.mk"
+. include "../../graphics/jpeg/buildlink3.mk"
+. include "../../graphics/png/buildlink3.mk"
+. include "../../graphics/xpm/buildlink3.mk"
+.endif # GD_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/graphics/glut/buildlink3.mk b/graphics/glut/buildlink3.mk
new file mode 100644
index 00000000000..75ae012bf87
--- /dev/null
+++ b/graphics/glut/buildlink3.mk
@@ -0,0 +1,21 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+GLUT_BUILDLINK3_MK:= ${GLUT_BUILDLINK3_MK}+
+
+.if !empty(GLUT_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.glut?= glut>=${MESA_VERSION}
+BUILDLINK_PKGSRCDIR.glut?= ../../graphics/glut
+.endif # GLUT_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= glut
+.endif
+
+.if !empty(GLUT_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= glut
+
+. include "../../graphics/MesaLib/buildlink3.mk"
+.endif # GLUT_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/graphics/jpeg/buildlink3.mk b/graphics/jpeg/buildlink3.mk
new file mode 100644
index 00000000000..16649eb7959
--- /dev/null
+++ b/graphics/jpeg/buildlink3.mk
@@ -0,0 +1,19 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+JPEG_BUILDLINK3_MK:= ${JPEG_BUILDLINK3_MK}+
+
+.if !empty(JPEG_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.jpeg?= jpeg>=6b
+BUILDLINK_PKGSRCDIR.jpeg?= ../../graphics/jpeg
+.endif # JPEG_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= jpeg
+.endif
+
+.if !empty(JPEG_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= jpeg
+.endif # JPEG_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/graphics/libungif/buildlink3.mk b/graphics/libungif/buildlink3.mk
new file mode 100644
index 00000000000..fad48c44a93
--- /dev/null
+++ b/graphics/libungif/buildlink3.mk
@@ -0,0 +1,19 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+LIBUNGIF_BUILDLINK3_MK:= ${LIBUNGIF_BUILDLINK3_MK}+
+
+.if !empty(LIBUNGIF_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.libungif?= libungif>=4.1.0
+BUILDLINK_PKGSRCDIR.libungif?= ../../graphics/libungif
+.endif # LIBUNGIF_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= libungif
+.endif
+
+.if !empty(LIBUNGIF_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= libungif
+.endif # LIBUNGIF_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/graphics/png/buildlink3.mk b/graphics/png/buildlink3.mk
new file mode 100644
index 00000000000..0b9894da10b
--- /dev/null
+++ b/graphics/png/buildlink3.mk
@@ -0,0 +1,21 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+PNG_BUILDLINK3_MK:= ${PNG_BUILDLINK3_MK}+
+
+.if !empty(PNG_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.png?= png>=1.2.4
+BUILDLINK_PKGSRCDIR.png?= ../../graphics/png
+.endif # PNG_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= png
+.endif
+
+.if !empty(PNG_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= png
+
+. include "../../devel/zlib/buildlink3.mk"
+.endif # PNG_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/graphics/tiff/buildlink3.mk b/graphics/tiff/buildlink3.mk
new file mode 100644
index 00000000000..05bdfa5fdf6
--- /dev/null
+++ b/graphics/tiff/buildlink3.mk
@@ -0,0 +1,22 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
+
+.if !empty(TIFF_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.tiff?= tiff>=3.5.4
+BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
+.endif # TIFF_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= tiff
+.endif
+
+.if !empty(TIFF_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= tiff
+
+. include "../../devel/zlib/buildlink3.mk"
+. include "../../graphics/jpeg/buildlink3.mk"
+.endif # TIFF_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/lang/libperl/buildlink3.mk b/lang/libperl/buildlink3.mk
new file mode 100644
index 00000000000..c410f8be273
--- /dev/null
+++ b/lang/libperl/buildlink3.mk
@@ -0,0 +1,22 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+LIBPERL_BUILDLINK3_MK:= ${LIBPERL_BUILDLINK3_MK}+
+
+.if !empty(LIBPERL_BUILDLINK3_MK:M\+)
+LIBPERL5_REQD?= ${PERL5_REQD}
+BUILDLINK_DEPENDS.libperl?= {libperl>=${LIBPERL5_REQD},perl>=5.8.0}
+BUILDLINK_PKGSRCDIR.libperl?= ../../lang/libperl
+.endif # LIBPERL_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= libperl
+.endif
+
+.if !empty(LIBPERL_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= libperl
+
+. include "../../lang/perl5/buildlink3.mk"
+.endif # LIBPERL_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/lang/ocaml/buildlink3.mk b/lang/ocaml/buildlink3.mk
new file mode 100644
index 00000000000..d3f9174f2bc
--- /dev/null
+++ b/lang/ocaml/buildlink3.mk
@@ -0,0 +1,20 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+OCAML_BUILDLINK3_MK:= ${OCAML_BUILDLINK3_MK}+
+
+.if !empty(OCAML_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.ocaml?= ocaml>=3.06
+BUILDLINK_PKGSRCDIR.ocaml?= ../../lang/ocaml
+BUILDLINK_DEPMETHOD.ocaml?= build
+.endif # OCAML_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= ocaml
+.endif
+
+.if !empty(OCAML_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= ocaml
+.endif # OCAML_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/lang/perl5/buildlink3.mk b/lang/perl5/buildlink3.mk
new file mode 100644
index 00000000000..571476e6bc7
--- /dev/null
+++ b/lang/perl5/buildlink3.mk
@@ -0,0 +1,84 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+PERL5_BUILDLINK3_MK:= ${PERL5_BUILDLINK3_MK}+
+
+.if !empty(PERL5_BUILDLINK3_MK:M\+)
+. include "../../mk/bsd.prefs.mk"
+
+USE_PERL5?= run
+PERL5_REQD?= 5.0
+
+BUILDLINK_DEPENDS.perl?= perl>=${PERL5_REQD}
+BUILDLINK_PKGSRCDIR.perl?= ../../lang/perl5
+
+. if !empty(USE_PERL5:M[bB][uU][iI][lL][dD])
+BUILDLINK_DEPMETHOD.perl?= build
+. endif
+.endif # PERL5_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= perl
+.endif
+
+.if !empty(PERL5_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= perl
+
+_PERL5_SITEVARS= \
+ INSTALLSITEBIN INSTALLSITELIB INSTALLSITEARCH \
+ INSTALLSITEMAN1DIR INSTALLSITEMAN3DIR \
+ SITELIBEXP SITEARCHEXP
+
+_PERL5_SITEVAR.INSTALLSITEBIN= installsitebin
+_PERL5_SITEVAR.INSTALLSITELIB= installsitelib
+_PERL5_SITEVAR.INSTALLSITEARCH= installsitearch
+_PERL5_SITEVAR.INSTALLSITEMAN1DIR= installsiteman1dir
+_PERL5_SITEVAR.INSTALLSITEMAN3DIR= installsiteman3dir
+_PERL5_SITEVAR.SITELIBEXP= sitelibexp
+_PERL5_SITEVAR.SITEARCHEXP= sitearchexp
+
+.if !defined(_PERL5_SITEPREFIX)
+. if exists(${PERL5})
+_PERL5_PREFIX!= \
+ eval `${PERL5} -V:prefix 2>/dev/null`; ${ECHO} $$prefix
+_PERL5_SITEPREFIX!= \
+ eval `${PERL5} -V:siteprefix 2>/dev/null`; ${ECHO} $$siteprefix
+MAKEFLAGS+= _PERL5_PREFIX="${_PERL5_PREFIX}"
+MAKEFLAGS+= _PERL5_SITEPREFIX="${_PERL5_SITEPREFIX}"
+
+. for _var_ in ${_PERL5_SITEVARS}
+PERL5_SUB_${_var_}!= \
+ eval `${PERL5} -V:${_PERL5_SITEVAR.${_var_}} 2>/dev/null`; \
+ ${ECHO} $${${_PERL5_SITEVAR.${_var_}}} | \
+ ${SED} -e "s,^${_PERL5_SITEPREFIX}/,,"
+MAKEFLAGS+= PERL5_SUB_${_var_}="${PERL5_SUB_${_var_}}"
+. endfor
+PERL5_SUB_INSTALLSCRIPT!= \
+ eval `${PERL5} -V:installscript 2>/dev/null`; \
+ ${ECHO} $$installscript | \
+ ${SED} -e "s,^${_PERL5_PREFIX}/,,"
+MAKEFLAGS+= PERL5_SUB_INSTALLSCRIPT="${PERL5_SUB_INSTALLSCRIPT}"
+. endif
+.endif
+
+. if ${PKG_INSTALLATION_TYPE} == "overwrite"
+#
+# Perl keeps headers and odd libraries in an odd path not caught by the
+# default BUILDLINK_FILES_CMD, so name them to be symlinked into
+# ${BUILDLINK_DIR}.
+#
+. if !defined(_PERL5_INSTALLARCHLIB)
+_PERL5_INSTALLARCHLIB!= \
+ eval `${PERL5} -V:installarchlib 2>/dev/null`; \
+ ${ECHO} $$installarchlib
+MAKEFLAGS+= _PERL5_INSTALLARCHLIB="${_PERL5_INSTALLARCHLIB}"
+. endif
+_PERL5_SUB_INSTALLARCHLIB= \
+ ${_PERL5_INSTALLARCHLIB:S,^${BUILDLINK_PREFIX.perl}/,,}
+BUILDLINK_FILES.perl= \
+ ${_PERL5_SUB_INSTALLARCHLIB}/CORE/* \
+ ${_PERL5_SUB_INSTALLARCHLIB}/auto/DynaLoader/DynaLoader.a
+. endif
+.endif # PERL5_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/lang/tcl/buildlink3.mk b/lang/tcl/buildlink3.mk
new file mode 100644
index 00000000000..f07d0b27dd9
--- /dev/null
+++ b/lang/tcl/buildlink3.mk
@@ -0,0 +1,27 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+TCL_BUILDLINK3_MK:= ${TCL_BUILDLINK3_MK}+
+
+.if !empty(TCL_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.tcl?= tcl>=8.3.4
+BUILDLINK_PKGSRCDIR.tcl?= ../../lang/tcl
+.endif # TCL_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= tcl
+.endif
+
+.if !empty(TCL_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= tcl
+BUILDLINK_FILES.tcl= bin/tclsh*
+#
+# Make "-ltcl" resolve into "-ltcl83", so that we don't need to patch so
+# many Makefiles.
+#
+BUILDLINK_TRANSFORM+= l:tcl:tcl83
+
+TCLCONFIG_SH?= ${BUILDLINK_PREFIX.tcl}/lib/tclConfig.sh
+.endif # TCL_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/mk/ossaudio.buildlink3.mk b/mk/ossaudio.buildlink3.mk
new file mode 100644
index 00000000000..48985b1dae9
--- /dev/null
+++ b/mk/ossaudio.buildlink3.mk
@@ -0,0 +1,85 @@
+# $NetBSD: ossaudio.buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+#
+# This file should be included by Makefiles for packages that use OSS.
+# By checking the value of HAVE_OSS after including this file, it's possible
+# to check whether audio/oss is installed, or if ossaudio OSS emulation
+# should be used instead:
+#
+# .include "../../mk/ossaudio.buildlink3.mk"
+#
+# .if defined(HAVE_OSS) && (${HAVE_OSS} == "YES")
+# CONFIGURE_ENV+= ac_cv_libossaudio__oss_ioctl=no
+# .endif
+#
+.if !defined(OSSAUDIO_BUILDLINK3_MK)
+OSSAUDIO_BUILDLINK3_MK= # defined
+
+.include "../../mk/bsd.prefs.mk"
+
+.if defined(USE_OSS)
+BUILD_DEFS+= USE_OSS
+.endif
+
+.if !defined(_HAVE_OSS)
+_HAVE_OSS!= if ${PKG_INFO} -qe oss; then ${ECHO} YES; else ${ECHO} NO; fi
+MAKEFLAGS+= _HAVE_OSS=${_HAVE_OSS}
+.endif
+
+HAVE_OSS?= ${_HAVE_OSS}
+
+.if defined(HAVE_OSS) && (${HAVE_OSS} == "YES")
+. include "../../audio/oss/buildlink3.mk"
+.else
+BUILDLINK_PREFIX.oss= /usr
+. if ${OPSYS} == "NetBSD"
+LIBOSSAUDIO?= -lossaudio
+DEVOSSAUDIO?= /dev/audio
+DEVOSSSOUND?= /dev/sound
+. elif ${OPSYS} == "Linux"
+LIBOSSAUDIO?= # empty
+DEVOSSAUDIO?= /dev/dsp
+DEVOSSSOUND?= /dev/dsp
+. else
+LIBOSSAUDIO?= # empty
+DEVOSSAUDIO?= /dev/audio
+DEVOSSSOUND?= /dev/sound
+. endif
+.endif
+
+CONFIGURE_ENV+= LIBOSSAUDIO="${LIBOSSAUDIO}"
+CONFIGURE_ENV+= DEVOSSAUDIO="${DEVOSSAUDIO}"
+CONFIGURE_ENV+= DEVOSSSOUND="${DEVOSSSOUND}"
+
+MAKE_ENV+= LIBOSSAUDIO="${LIBOSSAUDIO}"
+MAKE_ENV+= DEVOSSAUDIO="${DEVOSSAUDIO}"
+MAKE_ENV+= DEVOSSSOUND="${DEVOSSSOUND}"
+
+BUILDLINK_TARGETS+= buildlink-ossaudio-soundcard-h
+
+# Many programs expect <soundcard.h> to be found as <sys/soundcard.h>.
+# Also include <sys/ioctl.h> prior to include <soundcard.h> since we need
+# definitions for _IOWR and friends.
+#
+.PHONY: buildlink-ossaudio-soundcard-h
+buildlink-ossaudio-soundcard-h:
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ sys_soundcard_h=${BUILDLINK_DIR}/include/sys/soundcard.h; \
+ soundcard_h=${BUILDLINK_PREFIX.oss}/include/soundcard.h; \
+ if [ ! -f $${sys_soundcard_h} -a -f $${soundcard_h} ]; then \
+ ${ECHO_BUILDLINK_MSG} "Creating $${sys_soundcard_h}."; \
+ ${MKDIR} `${DIRNAME} $${sys_soundcard_h}`; \
+ ( ${ECHO} "#ifndef BUILDLINK_SYS_SOUNDCARD_H"; \
+ ${ECHO} "#define BUILDLINK_SYS_SOUNDCARD_H"; \
+ ${ECHO} "#include <sys/ioctl.h>"; \
+ ${ECHO} "#include <soundcard.h>"; \
+ ${ECHO} "#endif"; \
+ ) > $${sys_soundcard_h}; \
+ fi; \
+ mach_soundcard_h=${BUILDLINK_DIR}/include/machine/soundcard.h; \
+ if [ ! -f $${mach_soundcard_h} -a -f $${sys_soundcard_h} ]; then \
+ ${ECHO_BUILDLINK_MSG} "Creating $${mach_soundcard_h}."; \
+ ${MKDIR} `${DIRNAME} $${mach_soundcard_h}`; \
+ ${LN} -s $${sys_soundcard_h} $${mach_soundcard_h}; \
+ fi
+
+.endif # OSSAUDIO_BUILDLINK3_MK
diff --git a/mk/pthread.buildlink3.mk b/mk/pthread.buildlink3.mk
new file mode 100644
index 00000000000..73324e81c0b
--- /dev/null
+++ b/mk/pthread.buildlink3.mk
@@ -0,0 +1,188 @@
+# $NetBSD: pthread.buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+#
+# The pthreads strategy for pkgsrc is to "bless" a particular pthread
+# package as the Official Pthread Replacement (OPR). A package that uses
+# pthreads may do one of the following:
+#
+# (1) Simply include pthread.buildlink3.mk. This will make the package
+# use the native pthread library if it's available, or else the OPR
+# package. The value of PTHREAD_TYPE may be checked to be either
+# "native", or the name of the OPR package, or "none", e.g.
+#
+# #
+# # package Makefile stuff...
+# #
+# .include "../../mk/pthread.buildlink3.mk"
+#
+# .if defined(PTHREAD_TYPE) && ${PTHREAD_TYPE} == "none"
+# CONFIGURE_ARGS+= --without-pthreads
+# .endif
+#
+# .include "../../mk/bsd.pkg.mk"
+#
+# Note that it's only safe to check and use the value of PTHREAD_TYPE
+# after all other buildlink3.mk files have been included.
+#
+# (2) Add "native" to PTHREAD_OPTS prior to including
+# pthread.buildlink3.mk. This is like case (1), but we only check for
+# the native pthread library, e.g.,
+#
+# PTHREAD_OPTS+= native
+# #
+# # package Makefile stuff...
+# #
+# .include "../../mk/pthread.buildlink3.mk"
+#
+# .if defined(PTHREAD_TYPE) && ${PTHREAD_TYPE} == "none"
+# CONFIGURE_ARGS+= --without-pthreads
+# .endif
+#
+# .include "../../mk/bsd.pkg.mk"
+#
+# (3) Add "require" to PTHREAD_OPTS prior to including
+# pthread.buildlink3.mk. This will make the package use the native
+# pthread library or else use the OPR package, and will otherwise set
+# PKG_SKIP_REASON if neither can be used, e.g.,
+#
+# PTHREAD_OPTS+= require
+# #
+# # package Makefile stuff...
+# #
+# .include "../../mk/pthread.buildlink3.mk"
+# .include "../../mk/bsd.pkg.mk"
+#
+# (4) Add both "require" and "native" to PTHREAD_OPTS prior to including
+# pthread.buildlink3.mk. This is like case (3), but we only check for
+# the native pthread library, e.g.,
+#
+# PTHREAD_OPTS+= require native
+# #
+# # more package Makefile stuff...
+# #
+# .include "../../mk/pthread.buildlink3.mk"
+# .include "../../mk/bsd.pkg.mk"
+#
+# The case where a package must use either the native pthread library or
+# some pthread package aside from the OPR is a special case of (2), e.g.,
+# if the required pthread package is "ptl2", then:
+#
+# PTHREAD_OPTS+= native
+# #
+# # more package Makefile stuff...
+# #
+# .include "../../mk/pthread.buildlink3.mk"
+#
+# .if defined(PTHREAD_TYPE) && ${PTHREAD_TYPE} == "none"
+# . include "../../devel/ptl2/buildlink3.mk"
+# .endif
+#
+# .include "../../mk/bsd.pkg.mk"
+#
+# A package Makefile may add the word "optional" to PTHREAD_OPTS, which
+# will override the effects of any instance of the word "require". This
+# should _only_ be used by those packages that can be built with or
+# without pthreads _independently_ of whether any of its dependencies need
+# pthreads. Currently, this only only www/mozilla, which uses its own
+# threading library if native pthreads is unavailable, despite that it
+# uses GTK+, which _does_ need pthreads.
+#
+###########################################################################
+#
+# PTHREAD_OPTS represents whether this package requires pthreads, and also
+# whether it needs to be native. It may include the word "require"
+# to denote that a pthreads implementation is required, and may also
+# include the word "native" to denote that only native pthreads are
+# acceptable.
+#
+# _PKG_PTHREAD is the fall-back package pthread implementation use by
+# pthread.buildlink3.mk.
+#
+# _PKG_PTHREAD_COMPAT_PATTERNS matches the ONLY_FOR_PLATFORMS from the
+# Makefile for ${_PKG_PTHREAD}. It's used to see if ${_PKG_PTHREADS}
+# can actually be used to replace a native pthreads.
+#
+_PKG_PTHREAD?= pth
+_PKG_PTHREAD_DEPENDS?= pth>=2.0.0
+_PKG_PTHREAD_PKGSRCDIR?= ../../devel/${_PKG_PTHREAD}
+_PKG_PTHREAD_BUILDLINK3_MK?= ${_PKG_PTHREAD_PKGSRCDIR}/buildlink3.mk
+_PKG_PTHREAD_COMPAT_PATTERNS= *-*-*
+
+.include "../../mk/bsd.prefs.mk"
+
+PTHREAD_OPTS?= # empty
+#
+# We check for a native pthreads implementation by checking for the presence
+# of /usr/include/pthread.h (we might want to make this check stricter).
+#
+.undef PTHREAD_TYPE
+PREFER_NATIVE_PTHREADS?= YES
+.if exists(/usr/include/pthread.h) && ${PREFER_NATIVE_PTHREADS} == "YES"
+PTHREAD_TYPE= native
+.else
+. if !empty(PTHREAD_OPTS:Mnative)
+PTHREAD_TYPE= none
+. if !empty(PTHREAD_OPTS:Mrequire) && empty(PTHREAD_OPTS:Moptional)
+PKG_SKIP_REASON= "${PKGNAME} requires a native pthreads implementation."
+. endif
+. else
+PTHREAD_TYPE= none
+. for _pattern_ in ${_PKG_PTHREAD_COMPAT_PATTERNS}
+. if !empty(MACHINE_PLATFORM:M${_pattern_})
+PTHREAD_TYPE= ${_PKG_PTHREAD}
+. endif
+. endfor
+. if ${PTHREAD_TYPE} == "none" && \
+ !empty(PTHREAD_OPTS:Mrequire) && empty(PTHREAD_OPTS:Moptional)
+PKG_SKIP_REASON= "${PKGNAME} requires a working pthreads implementation."
+. endif
+. endif
+.endif
+
+.if !defined(PTHREAD_BUILDLINK3_MK)
+PTHREAD_BUILDLINK3_MK= # defined
+
+.if ${PTHREAD_TYPE} == "native"
+#
+# Link the native pthread libraries and headers into ${BUILDLINK_DIR}.
+#
+BUILDLINK_PREFIX.pthread= /usr
+BUILDLINK_CFLAGS.pthread= -pthread
+BUILDLINK_LDFLAGS.pthread= # empty
+#
+# Handle systems which have pthreads functions in libc_r such as
+# FreeBSD 5.x, or fall back to libc if we don't find libc_r.
+#
+. if exists(/usr/lib/libpthread.so) || exists(/lib/libpthread.so)
+BUILDLINK_LDADD.pthread= -lpthread
+. elif exists(/usr/lib/libc_r.so)
+BUILDLINK_LDADD.pthread= -lc_r
+. else
+BUILDLINK_LDADD.pthread= # empty
+. endif
+
+.elif ${PTHREAD_TYPE} == "${_PKG_PTHREAD}"
+. if exists(${_PKG_PTHREAD_BUILDLINK3_MK})
+. if !empty(_PKG_PTHREAD_DEPENDS)
+BUILDLINK_DEPENDS.${_PKG_PTHREAD}= ${_PKG_PTHREAD_DEPENDS}
+. endif
+BUILDLINK_PREFIX.pthread= ${BUILDLINK_PREFIX.${_PKG_PTHREAD}}
+BUILDLINK_CFLAGS.pthread= ${BUILDLINK_CFLAGS.${_PKG_PTHREAD}}
+BUILDLINK_LDFLAGS.pthread= ${BUILDLINK_LDFLAGS.${_PKG_PTHREAD}}
+BUILDLINK_LDADD.pthread= -lpthread
+. include "${_PKG_PTHREAD_BUILDLINK3_MK}"
+. else
+PKG_SKIP_REASON= "${PKGNAME} needs pthreads, but ${_PKG_PTHREAD_BUILDLINK3_MK} is missing."
+. endif
+.endif
+
+# Define user-visible PTHREAD_CFLAGS and PTHREAD_LDFLAGS as compiler
+# options used to compile/link pthreaded code.
+#
+PTHREAD_CFLAGS= ${BUILDLINK_CFLAGS.pthread}
+PTHREAD_LDFLAGS= ${BUILDLINK_LDFLAGS.pthread} ${BUILDLINK_LDADD.pthread}
+
+PTHREADBASE= ${BUILDLINK_PREFIX.pthread}
+CONFIGURE_ENV+= PTHREADBASE=${PTHREADBASE}
+MAKE_ENV+= PTHREADBASE=${PTHREADBASE}
+
+.endif # PTHREAD_BUILDLINK3_MK
diff --git a/net/libpcap/buildlink3.mk b/net/libpcap/buildlink3.mk
new file mode 100644
index 00000000000..7ff95f37034
--- /dev/null
+++ b/net/libpcap/buildlink3.mk
@@ -0,0 +1,49 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+LIBPCAP_BUILDLINK3_MK:= ${LIBPCAP_BUILDLINK3_MK}+
+
+.if !empty(LIBPCAP_BUILDLINK3_MK:M\+)
+. include "../../mk/bsd.prefs.mk"
+
+BUILDLINK_DEPENDS.libpcap?= libpcap>=0.7.2
+BUILDLINK_PKGSRCDIR.libpcap?= ../../net/libpcap
+.endif # LIBPCAP_BUILDLINK3_MK
+
+BUILDLINK_CHECK_BUILTIN.libpcap?= NO
+
+.if !defined(BUILDLINK_IS_BUILTIN.libpcap)
+BUILDLINK_IS_BUILTIN.libpcap= NO
+. if exists(/usr/include/pcap.h)
+BUILDLINK_IS_BUILTIN.libpcap= YES
+. endif
+.endif
+
+.if !empty(BUILDLINK_CHECK_BUILTIN.libpcap:M[yY][eE][sS])
+_NEED_LIBPCAP= NO
+.endif
+
+.if !defined(_NEED_LIBPCAP)
+. if !empty(BUILDLINK_IS_BUILTIN.libpcap:M[nN][oO])
+_NEED_LIBPCAP= YES
+. else
+_NEED_LIBPCAP= NO
+. endif
+MAKEFLAGS+= _NEED_LIBPCAP="${_NEED_LIBPCAP}"
+.endif
+
+.if ${_NEED_LIBPCAP} == "YES"
+. if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= libpcap
+. endif
+.endif
+
+.if !empty(LIBPCAP_BUILDLINK3_MK:M\+)
+. if ${_NEED_LIBPCAP} == "YES"
+BUILDLINK_PACKAGES+= libpcap
+. else
+BUILDLINK_PREFIX.libpcap= /usr
+. endif
+.endif # LIBPCAP_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/net/openslp/buildlink3.mk b/net/openslp/buildlink3.mk
new file mode 100644
index 00000000000..3bdee1a3154
--- /dev/null
+++ b/net/openslp/buildlink3.mk
@@ -0,0 +1,19 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+OPENSLP_BUILDLINK3_MK:= ${OPENSLP_BUILDLINK3_MK}+
+
+.if !empty(OPENSLP_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.openslp?= openslp>=1.0.1
+BUILDLINK_PKGSRCDIR.openslp?= ../../net/openslp
+.endif # OPENSLP_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= openslp
+.endif
+
+.if !empty(OPENSLP_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= openslp
+.endif # OPENSLP_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/net/socks4/buildlink3.mk b/net/socks4/buildlink3.mk
new file mode 100644
index 00000000000..1b6d11de656
--- /dev/null
+++ b/net/socks4/buildlink3.mk
@@ -0,0 +1,20 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:44 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+SOCKS4_BUILDLINK3_MK:= ${SOCKS4_BUILDLINK3_MK}+
+
+.if !empty(SOCKS4_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.socks4?= socks4>=2.2
+BUILDLINK_PKGSRCDIR.socks4?= ../../net/socks4
+.endif # SOCKS4_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= socks4
+.endif
+
+.if !empty(SOCKS4_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= socks4
+BUILDLINK_TRANSFORM+= l:socks:socks4
+.endif # SOCKS4_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/net/socks5/buildlink3.mk b/net/socks5/buildlink3.mk
new file mode 100644
index 00000000000..99da0a1c2e9
--- /dev/null
+++ b/net/socks5/buildlink3.mk
@@ -0,0 +1,19 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:45 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+SOCKS5_BUILDLINK3_MK:= ${SOCKS5_BUILDLINK3_MK}+
+
+.if !empty(SOCKS5_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.socks5?= socks5>=1.0.2
+BUILDLINK_PKGSRCDIR.socks5?= ../../net/socks5
+.endif # SOCKS5_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= socks5
+.endif
+
+.if !empty(SOCKS5_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= socks5
+.endif # SOCKS5_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/pkgtools/libnbcompat/buildlink3.mk b/pkgtools/libnbcompat/buildlink3.mk
new file mode 100644
index 00000000000..1047dec0ff9
--- /dev/null
+++ b/pkgtools/libnbcompat/buildlink3.mk
@@ -0,0 +1,25 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:45 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+LIBNBCOMPAT_BUILDLINK3_MK:= ${LIBNBCOMPAT_BUILDLINK3_MK}+
+
+.if !empty(LIBNBCOMPAT_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.libnbcompat?= libnbcompat>=20030830
+BUILDLINK_PKGSRCDIR.libnbcompat?= ../../pkgtools/libnbcompat
+BUILDLINK_DEPMETHOD.libnbcompat?= build
+.endif # LIBNBCOMPAT_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= libnbcompat
+.endif
+
+.if !empty(LIBNBCOMPAT_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= libnbcompat
+BUILDLINK_LDADD.libnbcompat= -lnbcompat
+
+. if defined(GNU_CONFIGURE)
+LIBS+= ${BUILDLINK_LDADD.libnbcompat}
+. endif
+.endif # LIBNBCOMPAT_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/print/cups/buildlink3.mk b/print/cups/buildlink3.mk
new file mode 100644
index 00000000000..b7c545d2307
--- /dev/null
+++ b/print/cups/buildlink3.mk
@@ -0,0 +1,22 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:45 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+CUPS_BUILDLINK3_MK:= ${CUPS_BUILDLINK3_MK}+
+
+.if !empty(CUPS_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.cups?= cups>=1.1.14nb1
+BUILDLINK_PKGSRCDIR.cups?= ../../print/cups
+.endif # CUPS_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= cups
+.endif
+
+.if !empty(CUPS_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= cups
+
+. include "../../graphics/png/buildlink3.mk"
+. include "../../graphics/tiff/buildlink3.mk"
+.endif # CUPS_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/security/PAM/buildlink3.mk b/security/PAM/buildlink3.mk
new file mode 100644
index 00000000000..393cb0a66f9
--- /dev/null
+++ b/security/PAM/buildlink3.mk
@@ -0,0 +1,49 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:45 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+PAM_BUILDLINK3_MK:= ${PAM_BUILDLINK3_MK}+
+
+.if !empty(PAM_BUILDLINK3_MK:M\+)
+. include "../../mk/bsd.prefs.mk"
+
+BUILDLINK_DEPENDS.pam?= PAM>=0.75
+BUILDLINK_PKGSRCDIR.pam?= ../../security/PAM
+.endif # PAM_BUILDLINK3_MK
+
+BUILDLINK_CHECK_BUILTIN.pam?= NO
+
+.if !defined(BUILDLINK_IS_BUILTIN.pam)
+BUILDLINK_IS_BUILTIN.pam= NO
+. if exists(/usr/include/security/pam_appl.h)
+BUILDLINK_IS_BUILTIN.pam= YES
+. endif
+.endif
+
+.if !empty(BUILDLINK_CHECK_BUILTIN.pam:M[yY][eE][sS])
+_NEED_PAM= NO
+.endif
+
+.if !defined(_NEED_PAM)
+. if !empty(BUILDLINK_IS_BUILTIN.pam:M[nN][oO])
+_NEED_PAM= YES
+. else
+_NEED_PAM= NO
+. endif
+MAKEFLAGS+= _NEED_PAM="${_NEED_PAM}"
+.endif
+
+.if ${_NEED_PAM} == "YES"
+. if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= pam
+. endif
+.endif
+
+.if !empty(PAM_BUILDLINK3_MK:M\+)
+. if ${_NEED_PAM} == "YES"
+BUILDLINK_PACKAGES+= pam
+. else
+BUILDLINK_PREFIX.pam= /usr
+. endif
+.endif # PAM_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/security/cyrus-sasl2/buildlink3.mk b/security/cyrus-sasl2/buildlink3.mk
new file mode 100644
index 00000000000..b4db1364cff
--- /dev/null
+++ b/security/cyrus-sasl2/buildlink3.mk
@@ -0,0 +1,19 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:45 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+CYRUS_SASL_BUILDLINK3_MK:= ${CYRUS_SASL_BUILDLINK3_MK}+
+
+.if !empty(CYRUS_SASL_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.cyrus-sasl?= cyrus-sasl>=2.1.12
+BUILDLINK_PKGSRCDIR.cyrus-sasl?= ../../security/cyrus-sasl2
+.endif # CYRUS_SASL_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= cyrus-sasl
+.endif
+
+.if !empty(CYRUS_SASL_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= cyrus-sasl
+.endif # CYRUS_SASL_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/security/libcrack/buildlink3.mk b/security/libcrack/buildlink3.mk
new file mode 100644
index 00000000000..c5f444d3736
--- /dev/null
+++ b/security/libcrack/buildlink3.mk
@@ -0,0 +1,19 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:45 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+LIBCRACK_BUILDLINK3_MK:= ${LIBCRACK_BUILDLINK3_MK}+
+
+.if !empty(LIBCRACK_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.libcrack?= libcrack>=2.7
+BUILDLINK_PKGSRCDIR.libcrack?= ../../security/libcrack
+.endif # LIBCRACK_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= libcrack
+.endif
+
+.if !empty(LIBCRACK_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= libcrack
+.endif # LIBCRACK_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/security/openssl/buildlink3.mk b/security/openssl/buildlink3.mk
new file mode 100644
index 00000000000..9ae9ba3a0f3
--- /dev/null
+++ b/security/openssl/buildlink3.mk
@@ -0,0 +1,161 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:45 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+OPENSSL_BUILDLINK3_MK:= ${OPENSSL_BUILDLINK3_MK}+
+
+.if !empty(OPENSSL_BUILDLINK3_MK:M\+)
+. include "../../mk/bsd.prefs.mk"
+
+# This is the ${PKGNAME} of the version of the OpenSSL package installed
+# by pkgsrc.
+#
+_OPENSSL_PKGSRC_PKGNAME= openssl-0.9.6l
+
+BUILDLINK_PACKAGES+= openssl
+BUILDLINK_DEPENDS.openssl?= openssl>=0.9.6l
+BUILDLINK_PKGSRCDIR.openssl?= ../../security/openssl
+.endif # OPENSSL_BUILDLINK3_MK
+
+BUILDLINK_CHECK_BUILTIN.openssl?= NO
+
+_OPENSSL_OPENSSLV_H= /usr/include/openssl/opensslv.h
+
+.if !defined(BUILDLINK_IS_BUILTIN.openssl)
+BUILDLINK_IS_BUILTIN.openssl= NO
+. if exists(${_OPENSSL_OPENSSLV_H})
+BUILDLINK_IS_BUILTIN.openssl= YES
+. endif
+.endif
+
+.if !empty(BUILDLINK_CHECK_BUILTIN.openssl:M[yY][eE][sS])
+_NEED_OPENSSL= NO
+.endif
+
+.if !defined(_NEED_OPENSSL)
+. if !empty(BUILDLINK_IS_BUILTIN.openssl:M[nN][oO])
+_NEED_OPENSSL= YES
+. else
+#
+# 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.
+#
+_OPENSSL_MAJOR!= \
+ ${AWK} 'BEGIN { hex="0123456789abcdef" } \
+ /\#define[ ]*OPENSSL_VERSION_NUMBER/ { \
+ i = index(hex, substr($$3, 3, 1)) - 1; \
+ print i; \
+ exit 0; \
+ } \
+ ' ${_OPENSSL_OPENSSLV_H}
+_OPENSSL_MINOR!= \
+ ${AWK} 'BEGIN { hex="0123456789abcdef" } \
+ /\#define[ ]*OPENSSL_VERSION_NUMBER/ { \
+ i = 16 * (index(hex, substr($$3, 4, 1)) - 1); \
+ i += index(hex, substr($$3, 5, 1)) - 1; \
+ print i; \
+ exit 0; \
+ } \
+ ' ${_OPENSSL_OPENSSLV_H}
+_OPENSSL_TEENY!= \
+ ${AWK} 'BEGIN { hex="0123456789abcdef" } \
+ /\#define[ ]*OPENSSL_VERSION_NUMBER/ { \
+ i = 16 * (index(hex, substr($$3, 6, 1)) - 1); \
+ i += index(hex, substr($$3, 7, 1)) - 1; \
+ print i; \
+ exit 0; \
+ } \
+ ' ${_OPENSSL_OPENSSLV_H}
+_OPENSSL_PATCHLEVEL!= \
+ ${AWK} 'BEGIN { hex="0123456789abcdef"; \
+ split("abcdefghijklmnopqrstuvwxyz", alpha, ""); \
+ } \
+ /\#define[ ]*OPENSSL_VERSION_NUMBER/ { \
+ i = 16 * (index(hex, substr($$3, 8, 1)) - 1); \
+ i += index(hex, substr($$3, 9, 1)) - 1; \
+ if (i == 0) { \
+ print ""; \
+ } else if (i > 26) { \
+ print "a"; \
+ } else { \
+ print alpha[i]; \
+ } \
+ exit 0; \
+ } \
+ ' ${_OPENSSL_OPENSSLV_H}
+_OPENSSL_VERSION= ${_OPENSSL_MAJOR}.${_OPENSSL_MINOR}.${_OPENSSL_TEENY}${_OPENSSL_PATCHLEVEL}
+_OPENSSL_PKG= openssl-${_OPENSSL_VERSION}
+#
+# If the built-in OpenSSL software is 0.9.6g, then check whether it
+# contains the security fixes pulled up to netbsd-1-6 on 2003-11-07.
+# If it does, then treat it as the equivalent of openssl-0.9.6l. This
+# is not strictly true, but is good enough since the main differences
+# between 0.9.6g and 0.9.6l are security fixes that NetBSD has already
+# patched into its built-in OpenSSL software.
+#
+_OPENSSL_HAS_FIX!= \
+ ${AWK} 'BEGIN { ans = "NO" } \
+ /OPENSSL_HAS_20031107_FIX/ { ans = "YES" } \
+ END { print ans; exit 0 } \
+ ' ${_OPENSSL_OPENSSLV_H}
+. if !empty(_OPENSSL_VERSION:M0\.9\.6g) && (${_OPENSSL_HAS_FIX} == "YES")
+_OPENSSL_PKG= openssl-0.9.6l
+. endif
+
+_OPENSSL_DEPENDS= ${BUILDLINK_DEPENDS.openssl}
+_NEED_OPENSSL!= \
+ if ${PKG_ADMIN} pmatch '${_OPENSSL_DEPENDS}' ${_OPENSSL_PKG}; then \
+ ${ECHO} "NO"; \
+ else \
+ ${ECHO} "YES"; \
+ fi
+. endif
+MAKEFLAGS+= _NEED_OPENSSL="${_NEED_OPENSSL}"
+.endif
+
+.if !defined(_NEED_NEWER_OPENSSL)
+_NEED_NEWER_OPENSSL!= \
+ if ${PKG_ADMIN} pmatch '${BUILDLINK_DEPENDS.openssl}' ${_OPENSSL_PKGSRC_PKGNAME}; then \
+ ${ECHO} "NO"; \
+ else \
+ ${ECHO} "YES"; \
+ fi
+MAKEFLAGS+= _NEED_NEWER_OPENSSL="${_NEED_NEWER_OPENSSL}"
+.endif
+
+.if (${_NEED_OPENSSL} == "YES") && (${_NEED_NEWER_OPENSSL} == "YES")
+PKG_SKIP_REASON= "Unable to satisfy dependency: ${BUILDLINK_DEPENDS.openssl}"
+.endif
+
+.if ${_NEED_OPENSSL} == "YES"
+. if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= openssl
+. endif
+.endif
+
+.if !empty(OPENSSL_BUILDLINK3_MK:M\+)
+. if ${_NEED_OPENSSL} == "NO"
+BUILDLINK_PREFIX.openssl= /usr
+. endif
+SSLBASE= ${BUILDLINK_PREFIX.openssl}
+BUILD_DEFS+= SSLBASE
+
+. if defined(PKG_SYSCONFDIR.openssl)
+SSLCERTS= ${PKG_SYSCONFDIR.openssl}/certs
+. elif ${OPSYS} == "NetBSD"
+SSLCERTS= /etc/openssl/certs
+. else
+SSLCERTS= ${PKG_SYSCONFBASE}/openssl/certs
+. endif
+BUILD_DEFS+= SSLCERTS
+
+. if ${_NEED_OPENSSL} == "YES"
+. if defined(USE_RSAREF2) && !empty(USE_RSAREF2:M[yY][eE][sS])
+BUILDLINK_DEPENDS+= rsaref
+. include "../../security/rsaref/buildlink3.mk"
+. endif
+. endif
+.endif # OPENSSL_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/security/rsaref/buildlink3.mk b/security/rsaref/buildlink3.mk
new file mode 100644
index 00000000000..812464aee64
--- /dev/null
+++ b/security/rsaref/buildlink3.mk
@@ -0,0 +1,19 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:45 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+RSAREF_BUILDLINK3_MK:= ${RSAREF_BUILDLINK3_MK}+
+
+.if !empty(RSAREF_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.rsaref?= rsaref-2.0p3
+BUILDLINK_PKGSRCDIR.rsaref?= ../../security/rsaref
+.endif # RSAREF_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= rsaref
+.endif
+
+.if !empty(RSAREF_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= rsaref
+.endif # RSAREF_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/security/tcp_wrappers/buildlink3.mk b/security/tcp_wrappers/buildlink3.mk
new file mode 100644
index 00000000000..b4dd96870ee
--- /dev/null
+++ b/security/tcp_wrappers/buildlink3.mk
@@ -0,0 +1,49 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:45 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+TCP_WRAPPERS_BUILDLINK3_MK:= ${TCP_WRAPPERS_BUILDLINK3_MK}+
+
+.if !empty(TCP_WRAPPERS_BUILDLINK3_MK:M\+)
+. include "../../mk/bsd.prefs.mk"
+
+BUILDLINK_DEPENDS.tcp_wrappers?= tcp_wrappers>=7.6.1nb1
+BUILDLINK_PKGSRCDIR.tcp_wrappers?= ../../security/tcp_wrappers
+.endif # TCP_WRAPPERS_BUILDLINK3_MK
+
+BUILDLINK_CHECK_BUILTIN.tcp_wrappers?= NO
+
+.if !defined(BUILDLINK_IS_BUILTIN.tcp_wrappers)
+BUILDLINK_IS_BUILTIN.tcp_wrappers= NO
+. if exists(/usr/include/tcpd.h)
+BUILDLINK_IS_BUILTIN.tcp_wrappers= YES
+. endif
+.endif
+
+.if !empty(BUILDLINK_CHECK_BUILTIN.tcp_wrappers:M[yY][eE][sS])
+_NEED_TCP_WRAPPERS= NO
+.endif
+
+.if !defined(_NEED_TCP_WRAPPERS)
+. if !empty(BUILDLINK_IS_BUILTIN.tcp_wrappers:M[nN][oO])
+_NEED_TCP_WRAPPERS= YES
+. else
+_NEED_TCP_WRAPPERS= NO
+. endif
+MAKEFLAGS+= _NEED_TCP_WRAPPERS="${_NEED_TCP_WRAPPERS}"
+.endif
+
+.if ${_NEED_TCP_WRAPPERS} == "YES"
+. if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= tcp_wrappers
+. endif
+.endif
+
+.if !empty(TCP_WRAPPERS_BUILDLINK3_MK:M\+)
+. if ${_NEED_TCP_WRAPPERS} == "YES"
+BUILDLINK_PACKAGES+= tcp_wrappers
+. else
+BUILDLINK_PREFIX.tcp_wrappers= /usr
+. endif
+.endif # TCP_WRAPPERS_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/textproc/expat/buildlink3.mk b/textproc/expat/buildlink3.mk
new file mode 100644
index 00000000000..6a49f030bf8
--- /dev/null
+++ b/textproc/expat/buildlink3.mk
@@ -0,0 +1,19 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:45 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+EXPAT_BUILDLINK3_MK:= ${EXPAT_BUILDLINK3_MK}+
+
+.if !empty(EXPAT_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.expat?= expat>=1.95.4
+BUILDLINK_PKGSRCDIR.expat?= ../../textproc/expat
+.endif # EXPAT_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= expat
+.endif
+
+.if !empty(EXPAT_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= expat
+.endif # EXPAT_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/www/apache/buildlink3.mk b/www/apache/buildlink3.mk
new file mode 100644
index 00000000000..4662bba775f
--- /dev/null
+++ b/www/apache/buildlink3.mk
@@ -0,0 +1,29 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:45 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+APACHE_BUILDLINK3_MK:= ${APACHE_BUILDLINK3_MK}+
+
+.if !empty(APACHE_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.apache?= apache{,6}-1.3.*
+BUILDLINK_PKGSRCDIR.apache?= ../../lang/apache
+. if defined(APACHE_MODULE)
+BUILDLINK_DEPMETHOD.apache+= full
+. else
+BUILDLINK_DEPMETHOD.apache?= build
+. endif
+.endif # APACHE_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= apache
+USE_PERL5?= build # for "apxs"
+.endif
+
+.if !empty(APACHE_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= apache
+APXS?= ${BUILDLINK_PREFIX.apache}/sbin/apxs
+. if defined(GNU_CONFIGURE)
+CONFIGURE_ARGS+= --with-apxs="${APXS}"
+. endif
+.endif # APACHE_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/x11/gtk/buildlink3.mk b/x11/gtk/buildlink3.mk
new file mode 100644
index 00000000000..ca5fbe0a6ed
--- /dev/null
+++ b/x11/gtk/buildlink3.mk
@@ -0,0 +1,24 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:45 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+GTK_BUILDLINK3_MK:= ${GTK_BUILDLINK3_MK}+
+
+.if !empty(GTK_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.gtk?= gtk+>=1.2.10nb5
+BUILDLINK_PKGSRCDIR.gtk?= ../../x11/gtk
+.endif # GTK_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= gtk
+.endif
+
+.if !empty(GTK_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= gtk
+
+USE_X11= YES
+
+. include "../../devel/gettext-lib/buildlink3.mk"
+. include "../../devel/glib/buildlink3.mk"
+.endif # GTK_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}
diff --git a/x11/tk/buildlink3.mk b/x11/tk/buildlink3.mk
new file mode 100644
index 00000000000..873256e5c51
--- /dev/null
+++ b/x11/tk/buildlink3.mk
@@ -0,0 +1,30 @@
+# $NetBSD: buildlink3.mk,v 1.1 2004/01/03 23:06:45 jlam Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+TK_BUILDLINK3_MK:= ${TK_BUILDLINK3_MK}+
+
+.if !empty(TK_BUILDLINK3_MK:M\+)
+BUILDLINK_DEPENDS.tk?= tk>=8.3.4
+BUILDLINK_PKGSRCDIR.tk?= ../../x11/tk
+.endif # TK_BUILDLINK3_MK
+
+.if !empty(BUILDLINK_DEPTH:M\+)
+BUILDLINK_DEPENDS+= tk
+.endif
+
+.if !empty(TK_BUILDLINK3_MK:M\+)
+BUILDLINK_PACKAGES+= tk
+BUILDLINK_FILES.tk= bin/wish*
+#
+# Make "-ltk" resolve into "-ltk83", so that we don't need to patch so
+# many Makefiles.
+#
+BUILDLINK_TRANSFORM+= l:tk:tk83
+
+USE_X11= YES
+TKCONFIG_SH?= ${BUILDLINK_PREFIX.tk}/lib/tkConfig.sh
+
+. include "../../lang/tcl/buildlink3.mk"
+.endif # TK_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:C/\+$//}