[Midnightbsd-cvs] mports: Mk/extensions: add first group of extension files.

ctriv at midnightbsd.org ctriv at midnightbsd.org
Thu Oct 23 18:55:45 EDT 2008


Log Message:
-----------
add first group of extension files.  
bsd.mport.mk does not use these yet.

Added Files:
-----------
    mports/Mk/extensions:
        apache.mk (r1.1)
        autotools.mk (r1.1)
        bdb.mk (r1.1)
        cmake.mk (r1.1)
        mysql.mk (r1.1)
        perl.mk (r1.1)
        pgsql.mk (r1.1)
        sqlite.mk (r1.1)

-------------- next part --------------
--- /dev/null
+++ Mk/extensions/perl.mk
@@ -0,0 +1,252 @@
+#-*- mode: makefile; tab-width: 4; -*-
+# ex:ts=4
+#
+# $MidnightBSD: mports/Mk/extensions/perl.mk,v 1.1 2008/10/23 22:55:44 ctriv Exp $
+#
+# bsd.perl.mk - perl specific make directives
+
+
+.if !defined(_POSTMKINCLUDED) || !defined(Perl_Pre_Include)
+
+Perl_Pre_Include=			perl.mk
+Perl_Include_MAINTAINER=	ctriv at MidnightBSD.org
+
+# This file contains the glue that is supposed to make your life easier when
+# dealing with ports of perl related software, specifially CPAN modules. It
+# is automatically included when USE_PERL5, PERL_CONFIGURE, or PERL_MODBUILD
+# is defined in the port's makefile.
+#
+##
+# USE_PERL5		- If set, this port uses perl5 in one or more of the extract,
+#				  patch, build, install or run phases.
+# USE_PERL5_BUILD
+#				- If set, this port uses perl5 in one or more of the extract,
+#				  patch, build or install phases.
+# USE_PERL5_RUN	- If set, this port uses perl5 for running.
+# PERL5			- Set to full path of perl5, either in the system or
+#				  installed from a port.
+# PERL			- Set to full path of perl5, either in the system or
+#				  installed from a port, but without the version number.
+#				  Use this if you need to replace "#!" lines in scripts.
+# PERL_VERSION	- Full version of perl5 (see below for current value).
+# PERL_VER		- Short version of perl5 (see below for current value).
+# PERL_LEVEL	- Perl version as an integer of the form MNNNPP, where
+#				  M is major version, N is minor version, and P is
+#				  the patch level. E.g., PERL_VERSION=5.6.1 would give
+#				  a PERL_LEVEL of 500601. This can be used in comparisons
+#				  to determine if the version of perl is high enough,
+#				  whether a particular dependency is needed, etc.
+# PERL_ARCH		- Directory name of architecture dependent libraries
+#				  (value: ${ARCH}-freebsd).
+# PERL_PORT		- Name of the perl port that is installed
+#				  (value: perl5)
+# SITE_PERL		- Directory name where site specific perl packages go.
+#				  This value is added to PLIST_SUB.
+# PERL_MODBUILD	- Use Module::Build to configure, build and install port.
+##
+
+#
+# Common Vars.
+#
+PERL_ARCH?=			mach
+PERL_BRANCH?=		${PERL_VERSION:C/\.[0-9]+$//}
+PERL_PORT?=			perl${PERL_BRANCH}
+# use true_prefix so that PERL will be right in faked targets.
+# this is historical.
+PERL_PREFIX?=		${TRUE_PREFIX}
+SITE_PERL_REL?=		lib/perl5/site_perl/${PERL_VER}
+SITE_PERL?=			${PERL_PREFIX}/${SITE_PERL_REL}
+PERL=				${PERL_PREFIX}/bin/perl
+PERL5=				${PERL}${PERL_VERSION}
+PERL_TEST_TARGET?=	test
+CPAN_CMD?=			${PERL_PREFIX}/bin/cpan
+
+# PERL_CONFIGURE implies USE_PERL5
+.if defined(PERL_CONFIGURE) || defined(PERL_MODBUILD)
+USE_PERL5=	yes
+.endif
+
+
+# USE_PERL5_(RUN|BUILD) implies USE_PERL5, USE_PERL5 => USE_PERL5_*
+.if defined(USE_PERL5_BUILD)
+USE_PERL5= ${USE_PERL5_BUILD}
+.elif defined(USE_PERL5_RUN)
+USE_PERL5= ${USE_PERL5_RUN}
+.elif defined(USE_PERL5)
+USE_PERL5_RUN=yes
+USE_PERL5_BUILD=yes
+.endif
+
+
+.if ${USE_PERL5:L} == "yes"
+USE_PERL5= ${PERL_BRANCH}
+.endif
+
+
+#
+# Perl version stuff.
+#
+_DEFAULT_PERL_VERSION= 5.10.0
+_DEFAULT_PERL_BRANCH= 5.10
+
+.if !defined(PERL_VERSION)
+.	if exists(${PERL}) && !defined(PACKAGE_BUILDING)
+PERL_VERSION!= ${PERL} -MConfig -le 'print $$Config{version}'
+.	else
+PERL_VERSION=	${_DEFAULT_PERL_VERSION}
+.	endif
+.endif
+
+
+PERL_VER?=		${PERL_VERSION}
+
+.if !defined(PERL_LEVEL) && defined(PERL_VERSION)
+perl_major=		${PERL_VERSION:C|^([1-9]+).*|\1|}
+_perl_minor=	00${PERL_VERSION:C|^([1-9]+)\.([0-9]+).*|\2|}
+perl_minor=		${_perl_minor:C|^.*(...)|\1|}
+.if ${perl_minor} >= 100
+perl_minor=		${PERL_VERSION:C|^([1-9]+)\.([0-9][0-9][0-9]).*|\2|}
+perl_patch=		${PERL_VERSION:C|^.*(..)|\1|}
+.else # ${perl_minor} < 100
+_perl_patch=	0${PERL_VERSION:C|^([1-9]+)\.([0-9]+)\.*|0|}
+perl_patch=		${_perl_patch:C|^.*(..)|\1|}
+.endif # ${perl_minor} < 100
+PERL_LEVEL=	${perl_major}${perl_minor}${perl_patch}
+.else
+PERL_LEVEL=0
+.endif # !defined(PERL_LEVEL) && defined(PERL_VERSION)
+
+
+
+# XXX parse USE_PERL=5.8 5.10+
+
+#
+# dependancies
+#
+PERL_NO_DEPENDS?= NO
+
+.if ${PERL_NO_DEPENDS:U} == "NO"
+.if defined(USE_PERL5_BUILD)
+EXTRACT_DEPENDS+=${PERL5}:${PORTSDIR}/lang/${PERL_PORT}
+PATCH_DEPENDS+=	${PERL5}:${PORTSDIR}/lang/${PERL_PORT}
+BUILD_DEPENDS+=	${PERL5}:${PORTSDIR}/lang/${PERL_PORT}
+.endif
+.if defined(USE_PERL5) || defined(USE_PERL5_RUN)
+RUN_DEPENDS+=	${PERL5}:${PORTSDIR}/lang/${PERL_PORT}
+.endif
+.endif
+
+#
+# Configure
+# 
+.if defined(PERL_CONFIGURE) || defined(PERL_MODBUILD)
+CONFIGURE_ARGS+=	CC="${CC}" CCFLAGS="${CFLAGS}" 
+MAN3PREFIX?=		${TARGETDIR}/lib/perl5/${PERL_VERSION}
+.undef HAS_CONFIGURE
+
+.if (defined(BATCH) && !defined(IS_INTERACTIVE))
+CONFIGURE_ENV+=	PERL_MM_USE_DEFAULT="YES"
+.endif
+
+.if defined(PERL_MODBUILD)
+ALL_TARGET?=
+PL_BUILD?=		Build
+CONFIGURE_SCRIPT?=	Build.PL
+.if ${PORTNAME} != Module-Build
+.if ${PERL_LEVEL} < 501000
+BUILD_DEPENDS+=		${SITE_PERL}/Module/Build.pm:${PORTSDIR}/devel/p5-Module-Build
+.endif
+.endif
+CONFIGURE_ARGS+= \
+	create_packlist=0 \
+	install_path=lib="${TARGETDIR}/${SITE_PERL_REL}" \
+	install_path=arch="${TARGETDIR}/${SITE_PERL_REL}/${PERL_ARCH}" \
+	install_path=script="${TARGETDIR}/bin" \
+	install_path=bin="${TARGETDIR}/bin" \
+	install_path=libdoc="${MAN3PREFIX}/man/man3" \
+	install_path=bindoc="${MAN1PREFIX}/man/man1" 
+.else
+CONFIGURE_SCRIPT?=	Makefile.PL
+CONFIGURE_ARGS+=	INSTALLDIRS="site"
+SKIP_FAKE_CHECK= 	.*\.packlist
+.endif 
+.endif # defined(PERL_CONFIGURE) || defined(PERL_MODBUILD)
+
+
+
+
+.endif      # !defined(_POSTMKINCLUDED) && !defined(Perl_Pre_Include)
+.if defined(_POSTMKINCLUDED) && !defined(Perl_Post_Include)
+
+Perl_Post_Include=	perl.mk
+
+PLIST_SUB+=		PERL_VERSION=${PERL_VERSION} \
+				PERL_VER=${PERL_VER} \
+				PERL_ARCH=${PERL_ARCH} \
+				SITE_PERL=${SITE_PERL_REL}
+
+SUB_LIST+=		PERL_VERSION=${PERL_VERSION} \
+				PERL_VER=${PERL_VER} \
+				PERL_ARCH=${PERL_ARCH} \
+				SITE_PERL=${SITE_PERL_REL} \
+				PERL=${PERL}
+
+
+.if defined(PERL_CONFIGURE) || defined(PERL_MODBUILD)
+.if !target(do-configure)
+do-configure:	
+	@cd ${CONFIGURE_WRKSRC} && \
+		${SETENV} ${CONFIGURE_ENV} \
+		${PERL5} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}
+.if !defined(PERL_MODBUILD)
+	@cd ${CONFIGURE_WRKSRC} && \
+		${PERL5} -pi -e 's/ doc_(perl|site|\$$\(INSTALLDIRS\))_install$$//' Makefile
+.endif
+.endif
+.endif # defined(PERL_CONFIGURE) || defined(PERL_MODBUILD)
+
+#
+# Build
+#
+.if defined(PERL_MODBUILD) && !target(do-build)
+do-build:
+	@(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PERL5} ${PL_BUILD} ${MAKE_ARGS} ${ALL_TARGET})
+.endif
+
+
+#
+# Install
+#	
+.if defined(PERL_MODBUILD) && !target(do-install)
+do-install:
+	@cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${PERL5}\
+		${PL_BUILD} ${MAKE_ARGS} --destdir ${FAKE_DESTDIR} ${FAKE_TARGET}
+.endif
+
+#
+# Convenience target for testing.
+#
+.if !target(test)
+.if (PERL_MODBUILD)
+test: build
+	@cd ${BUILD_WRKSRC} && ${SETENV} ${MAKE_ENV} ${PERL5} ${PL_BUILD} ${PERL_TEST_TARGET}
+.else
+test: build
+	@cd ${BUILD_WRKSRC} && ${SETENV} ${MAKE_ENV} make ${PERL_TEST_TARGET}
+.endif
+.endif
+
+
+.if !target(check-latest)
+check-latest:
+	@if [ -x ${CPAN_CMD} ]; then \
+		_cpan_version=`${CPAN_CMD} -D ${PORTNAME:S/-/::/g} | ${GREP} "	CPAN:" | ${AWK} '{ print $$2 }'`; \
+		${ECHO_MSG} "CPAN version: $$_cpan_version"; \
+		${ECHO_MSG} "Port version: ${PORTVERSION}"; \
+	else \
+		${ECHO_MSG} "Cannot check for latest CPAN version: ${CPAN_CMD} not installed"; \
+	fi
+.endif	
+
+.endif      # defined(_POSTMKINCLUDED) && !defined(Perl_Post_Include)
+
--- /dev/null
+++ Mk/extensions/mysql.mk
@@ -0,0 +1,85 @@
+# -*- mode: Makefile; tab-width: 4; -*-
+# ex: ts=4
+#
+# $MidnightBSD: mports/Mk/extensions/mysql.mk,v 1.1 2008/10/23 22:55:44 ctriv Exp $ 
+# $FreeBSD: ports/Mk/bsd.database.mk,v 1.14 2006/07/05 02:18:08 linimon Exp $
+#
+
+.if defined(_POSTMKINCLUDED) && !defined(Mysql_Post_Include)
+
+Mysql_Post_Include=			mysql.mk
+Mysql_Include_MAINTAINER=	ports at MidnightBSD.org
+
+
+##
+# USE_MYSQL		- Add MySQL client dependency.
+#				  If no version is given (by the maintainer via the port or
+#				  by the user via defined variable), try to find the
+#				  currently installed version.  Fall back to default if
+#				  necessary (MySQL5.0 = 50).
+# DEFAULT_MYSQL_VER
+#				- MySQL default version. Can be overriden within a port.
+#				  Default: 50.
+# WANT_MYSQL_VER
+#				- Maintainer can set an arbitrary version of MySQL by using it.
+# IGNORE_WITH_MYSQL
+#				- This variable can be defined if the ports doesn't support
+#				  one or more version of MySQL.
+# WITH_MYSQL_VER
+#				- User defined variable to set MySQL version.
+# MYSQL_VER
+#				- Detected MySQL version.
+##
+
+DEFAULT_MYSQL_VER?=	50
+# MySQL client version currently supported.
+MYSQL41_LIBVER=		14
+MYSQL50_LIBVER=		15
+MYSQL51_LIBVER=		16
+MYSQL60_LIBVER=		16
+
+# Setting/finding MySQL version we want.
+.if exists(${LOCALBASE}/bin/mysql) && !defined(PACKAGE_BUILDING)
+_MYSQL_VER!=	${LOCALBASE}/bin/mysql --version | ${SED} -e 's/.*Distrib \([0-9]\)\.\([0-9]*\).*/\1\2/'
+.endif
+
+.if defined(WANT_MYSQL_VER)
+.if defined(WITH_MYSQL_VER) && ${WITH_MYSQL_VER} != ${WANT_MYSQL_VER}
+IGNORE=		cannot install: the port wants mysql${WANT_MYSQL_VER}-client and you try to install mysql${WITH_MYSQL_VER}-client.
+.endif
+MYSQL_VER=	${WANT_MYSQL_VER}
+.elif defined(WITH_MYSQL_VER)
+MYSQL_VER=	${WITH_MYSQL_VER}
+.else
+.if defined(_MYSQL_VER)
+MYSQL_VER=	${_MYSQL_VER}
+.else
+MYSQL_VER=	${DEFAULT_MYSQL_VER}
+.endif
+.endif # WANT_MYSQL_VER
+
+.if defined(_MYSQL_VER)
+.if ${_MYSQL_VER} != ${MYSQL_VER}
+IGNORE=	cannot install: MySQL versions mismatch: mysql${_MYSQL_VER}-client is installed and wanted version is mysql${MYSQL_VER}-client
+.endif
+.endif
+
+# And now we are checking if we can use it
+.if defined(MYSQL${MYSQL_VER}_LIBVER)
+# compatability shim
+.if defined(BROKEN_WITH_MYSQL)
+IGNORE_WITH_MYSQL=${BROKEN_WITH_MYSQL}
+.endif
+.if defined(IGNORE_WITH_MYSQL)
+.	for VER in ${IGNORE_WITH_MYSQL}
+.		if (${MYSQL_VER} == "${VER}")
+IGNORE=		cannot install: doesn't work with MySQL version : ${MYSQL_VER} (Doesn't support MySQL ${IGNORE_WITH_MYSQL})
+.		endif
+.	endfor
+.endif # IGNORE_WITH_MYSQL
+LIB_DEPENDS+=	mysqlclient.${MYSQL${MYSQL_VER}_LIBVER}:${PORTSDIR}/databases/mysql${MYSQL_VER}-client
+.else
+IGNORE=		cannot install: unknown MySQL version: ${MYSQL_VER}
+.endif # Check for correct libs
+
+.endif # defined(_POSTMKINCLUDED) && !defined(Mysql_Post_Include)
--- /dev/null
+++ Mk/extensions/sqlite.mk
@@ -0,0 +1,36 @@
+#-*- mode: makefile; tab-width: 4; -*-
+# ex: ts=4
+#
+# $MidnightBSD: mports/Mk/extensions/sqlite.mk,v 1.1 2008/10/23 22:55:44 ctriv Exp $ 
+# $FreeBSD: ports/Mk/bsd.database.mk,v 1.14 2006/07/05 02:18:08 linimon Exp $
+#
+
+.if defined(_POSTMKINCLUDED) && !defined(Sqlite_Post_Include)
+
+Sqlite_Post_Include=		sqlite.mk
+Sqlite_Include_MAINTAINER=	ports at MidnightBSD.org
+
+#
+# USE_SQLITE	- Add dependency on sqlite library. Valid values are:
+#				  3 and 2. If version is not specified directly then
+#				  sqlite3 is used (if USE_SQLITE= yes).
+# SQLITE_VER		- Detected sqlite version.
+
+.if ${USE_SQLITE:L} == "yes"
+_SQLITE_VER=	3
+.else
+_SQLITE_VER=	 ${USE_SQLITE}
+.endif
+
+# USE_SQLITE is specified incorrectly, so mark this as IGNORE
+.if ${_SQLITE_VER} == "3"
+LIB_DEPENDS+=	sqlite${_SQLITE_VER}:${PORTSDIR}/databases/sqlite${_SQLITE_VER}
+SQLITE_VER=	${_SQLITE_VER}
+.elif ${_SQLITE_VER} == "2"
+LIB_DEPENDS+=	sqlite.${_SQLITE_VER}:${PORTSDIR}/databases/sqlite${_SQLITE_VER}
+SQLITE_VER=	${_SQLITE_VER}
+.else
+IGNORE=	cannot install: unknown sqlite version: ${_SQLITE_VER}
+.endif
+
+.endif # defined(_POSTMKINCLUDED) && !defined(Sqlite_Post_Include)
--- /dev/null
+++ Mk/extensions/bdb.mk
@@ -0,0 +1,235 @@
+# -*- mode: Makefile; tab-width: 4; -*-
+# ex: ts=4
+#
+# $MidnightBSD: mports/Mk/extensions/bdb.mk,v 1.1 2008/10/23 22:55:44 ctriv Exp $ 
+# $FreeBSD: ports/Mk/bsd.database.mk,v 1.14 2006/07/05 02:18:08 linimon Exp $
+#
+
+.if defined(_POSTMKINCLUDED) && !defined(Bdb_Post_Include)
+
+Bdb_Post_Include=		bdb.mk
+Bdb_Include_MAINTAINER=	ports at MidnightBSD.org
+
+##
+# USE_BDB		- Add Berkeley DB library dependency.
+#				  If no version is given (by the maintainer via the port or
+#				  by the user via defined variable), try to find the
+#				  currently installed version.  Fall back to default if
+#				  necessary (db41+).
+# INVALID_BDB_VER
+#				- This variable can be defined when the port doesn't
+#				  support one or more versions of Berkeley DB.
+# WANT_BDB_VER	- Maintainer can set a version of Berkeley DB to always
+#				  build this port with (overrides WITH_BDB_VER).
+# WITH_BDB_VER	- User defined global variable to set Berkeley DB version
+# <UNIQUENAME>_WITH_BDB_VER
+#				- User defined port specific variable to set
+#				  Berkeley DB version
+# WITH_BDB_HIGHEST
+#				- Use the highest installed version of Berkeley DB
+# BDB_LIB_NAME	- This variable is automatically set to the name of the
+#				  Berkeley DB library (default: db41)
+# BDB_LIB_CXX_NAME
+#				- This variable is automatically set to the name of the
+#				  Berkeley DB c++ library (default: db41_cxx)
+# BDB_INCLUDE_DIR
+#				- This variable is automatically set to the location of
+#				  the Berkeley DB include directory.
+#				  (default: ${LOCALBASE}/include/db41)
+# BDB_LIB_DIR	- This variable is automatically set to the location of
+#				  the Berkeley DB library directory.
+# BDB_VER		- Detected Berkeley DB version.
+
+
+_DB_PORTS=	2 3 40 41 42 43 44 45 46 47 3+ 40+ 41+ 42+ 43+ 44+ 45+ 46+ 47+
+# Dependence lines for different db versions
+db2_DEPENDS=	db2.0:${PORTSDIR}/databases/db2
+db3_DEPENDS=	db3.3:${PORTSDIR}/databases/db3
+db40_DEPENDS=	db4.0:${PORTSDIR}/databases/db4
+db41_DEPENDS=	db41.1:${PORTSDIR}/databases/db41
+db42_DEPENDS=	db-4.2.2:${PORTSDIR}/databases/db42
+db43_DEPENDS=	db-4.3.0:${PORTSDIR}/databases/db43
+db44_DEPENDS=	db-4.4.0:${PORTSDIR}/databases/db44
+db45_DEPENDS=	db-4.5.0:${PORTSDIR}/databases/db45
+db46_DEPENDS=	db-4.6.0:${PORTSDIR}/databases/db46
+db47_DEPENDS=	db-4.7.0:${PORTSDIR}/databases/db47
+# Detect db versions by finding some files
+db3_FIND=	${LOCALBASE}/include/db3/db.h
+db40_FIND=	${LOCALBASE}/include/db4/db.h
+db41_FIND=	${LOCALBASE}/include/db41/db.h
+db42_FIND=	${LOCALBASE}/include/db42/db.h
+db43_FIND=	${LOCALBASE}/include/db43/db.h
+db44_FIND=	${LOCALBASE}/include/db44/db.h
+db45_FIND=	${LOCALBASE}/include/db45/db.h
+db46_FIND=	${LOCALBASE}/include/db46/db.h
+db47_FIND=	${LOCALBASE}/include/db47/db.h
+
+# For specifying [3, 40, 41, ..]+
+_DB_3P=		3 ${_DB_40P}
+_DB_40P=	40 ${_DB_41P}
+_DB_41P=	41 ${_DB_42P}
+_DB_42P=	42 ${_DB_43P}
+_DB_43P=	43 ${_DB_44P}
+_DB_44P=	44 ${_DB_45P}
+_DB_45P=	45 ${_DB_46P}
+_DB_46P=	46 ${_DB_47P}
+_DB_47P=	47
+
+# Override the global WITH_BDB_VER with the
+# port specific <UNIQUENAME>_WITH_BDB_VER
+.if defined(${UNIQUENAME:U:S,-,_,}_WITH_BDB_VER)
+WITH_BDB_VER=	${${UNIQUENAME:U:S,-,_,}_WITH_BDB_VER}
+.endif
+
+.if defined(WITH_BDB_VER)
+. if ${WITH_BDB_VER} == 4
+USE_BDB=	40
+. elif ${WITH_BDB_VER} != 1
+USE_BDB=	${WITH_BDB_VER}
+. endif
+.endif
+_WANT_BDB_VER=	${USE_BDB}
+
+# Assume the default bdb version as 41
+.if ${USE_BDB:L} == "yes"
+_WANT_BDB_VER=	41+
+.endif
+
+# Detect bdb version
+_BDB_VER=	no
+_BDB_IGNORE=	no
+
+# Override the user defined WITH_BDB_VER with the WANT_BDB_VER
+.if defined(WANT_BDB_VER)
+.for bdb in ${_DB_PORTS}
+.if ${WANT_BDB_VER} == "${bdb}" && ${_BDB_VER} == "no"
+_BDB_VER=	${WANT_BDB_VER}
+.endif
+.endfor
+USE_BDB=	${WANT_BDB_VER}
+.else
+.for bdb in ${_DB_PORTS}
+.if ${_WANT_BDB_VER} == "${bdb}" && ${_BDB_VER} == "no"
+_MATCHED_DB_VER:=	${bdb:S/+//}
+. if ${_MATCHED_DB_VER} == "${bdb}"
+# USE_BDB is exactly specified
+_BDB_VER=	${bdb}
+.else
+# USE_BDB is specified as VER+
+.  for dbx in ${_DB_${_MATCHED_DB_VER}P}
+.   if exists(${db${dbx}_FIND}) && !defined(PACKAGE_BUILDING)
+_BRKDB=	no
+# Skip versions we are incompatible with
+.    if defined(INVALID_BDB_VER)
+_CHK_BDB:=	${dbx}
+.     for BRKDB in ${INVALID_BDB_VER}
+.      if ${_CHK_BDB} == "${BRKDB}"
+_BRKDB= yes
+.      endif
+.     endfor
+.    endif
+.    if ${_BRKDB} == no
+.     if defined(WITH_BDB_HIGHEST)
+# Use the highest version of Berkeley DB found
+_BDB_VER=	${dbx}
+.     elif ${_BDB_VER} == no
+# Use the first Berkeley DB found
+_BDB_VER=	${dbx}
+.     endif
+.    endif
+.   endif
+.  endfor
+.  if ${_BDB_VER} == "no"
+# No existing db4 version is detected in system
+_BDB_VER=	${_MATCHED_DB_VER}
+.  endif
+. endif
+.endif
+.endfor
+.endif
+
+# USE_BDB is specified incorrectly, so mark this as IGNORE
+.if ${_BDB_VER} == "no"
+IGNORE=	cannot install: unknown bdb version: ${USE_BDB}
+.else
+# Now check if we can use it
+. if defined(INVALID_BDB_VER)
+.  for VER in ${INVALID_BDB_VER}
+_CHK_PLUS:=	${VER:S/+//}
+# INVALID_BDB_VER is specified as VER+
+.   if ${_CHK_PLUS}  != "${VER}"
+.    if ${_BDB_VER} == "${_CHK_PLUS}"
+_BDB_IGNORE=	yes
+.    else
+.     for VER_P in ${_DB_${_CHK_PLUS}P}
+.      if ${_BDB_VER} == "${VER_P}"
+_BDB_IGNORE=	yes
+.      endif
+.     endfor
+.    endif
+.   elif ${_BDB_VER} == "${VER}"
+_BDB_IGNORE=	yes
+.   endif
+.  endfor
+. endif
+. if ${_BDB_IGNORE} == "yes"
+IGNORE= cannot install: does not work with bdb version: ${_BDB_VER} (${INVALID_BDB_VER} not supported)
+. else
+# Now add the dependancy on Berkeley DB ${_BDB_VER) version
+.if defined(BDB_BUILD_DEPENDS)
+BUILD_DEPENDS+=	${db${_BDB_VER}_FIND}:${db${_BDB_VER}_DEPENDS:C/^db.*://}
+.else
+LIB_DEPENDS+=	${db${_BDB_VER}_DEPENDS}
+.endif
+.  if ${_BDB_VER} == 40
+BDB_LIB_NAME=		db4
+BDB_LIB_CXX_NAME=	db4_cxx
+BDB_INCLUDE_DIR=	${LOCALBASE}/include/db4
+.  elif ${_BDB_VER} == 42
+BDB_LIB_NAME=		db-4.2
+BDB_LIB_CXX_NAME=	db_cxx-4.2
+BDB_LIB_DIR=		${LOCALBASE}/lib/db42
+.  elif ${_BDB_VER} == 43
+BDB_LIB_NAME=		db-4.3
+BDB_LIB_CXX_NAME=	db_cxx-4.3
+BDB_LIB_DIR=		${LOCALBASE}/lib/db43
+.  elif ${_BDB_VER} == 44
+BDB_LIB_NAME=		db-4.4
+BDB_LIB_CXX_NAME=	db_cxx-4.4
+BDB_LIB_DIR=		${LOCALBASE}/lib/db44
+.  elif ${_BDB_VER} == 45
+BDB_LIB_NAME=		db-4.5
+BDB_LIB_CXX_NAME=	db_cxx-4.5
+BDB_LIB_DIR=		${LOCALBASE}/lib/db45
+.  elif ${_BDB_VER} == 46
+BDB_LIB_NAME=		db-4.6
+BDB_LIB_CXX_NAME=	db_cxx-4.6
+BDB_LIB_DIR=		${LOCALBASE}/lib/db46
+.  endif
+BDB_LIB_NAME?=		db${_BDB_VER}
+BDB_LIB_CXX_NAME?=	db${_BDB_VER}_cxx
+BDB_INCLUDE_DIR?=	${LOCALBASE}/include/db${_BDB_VER}
+BDB_LIB_DIR?=		${LOCALBASE}/lib
+. endif
+BDB_VER=	${_BDB_VER}
+.endif
+
+# Obsolete variables
+.if defined(OBSOLETE_BDB_VAR)
+. for var in ${OBSOLETE_BDB_VAR}
+.  if defined(${var})
+BAD_VAR+=	${var},
+.  endif
+. endfor
+. if defined(BAD_VAR)
+_IGNORE_MSG=	Obsolete variable(s) ${BAD_VAR} use WITH_BDB_VER or ${UNIQUENAME:U:S,-,_,}_WITH_BDB_VER to select Berkeley DB version
+.  if defined(IGNORE)
+IGNORE+= ${_IGNORE_MSG}
+.  else
+IGNORE=	${_IGNORE_MSG}
+.  endif
+. endif
+.endif
+
+
+.endif #defined(_POSTMKINCLUDED) && !defined(Bdb_Post_Include)
--- /dev/null
+++ Mk/extensions/autotools.mk
@@ -0,0 +1,347 @@
+#-*- mode: makefile; tab-width: 4; -*-
+# ex:ts=4
+#
+# $MidnightBSD: mports/Mk/extensions/autotools.mk,v 1.1 2008/10/23 22:55:44 ctriv Exp $
+# $FreeBSD: ports/Mk/bsd.autotools.mk,v 1.28 2007/03/27 01:23:56 linimon Exp $
+#
+# Please view me with 4 column tabs!
+#
+# Please make sure all changes to this file are passed either through
+# the maintainer, or portmgr at MidnightBSD.org
+
+.if defined(_POSTMKINCLUDED) && !defined(Autotools_Post_Include)
+
+Autotools_Post_Include=		    autotools.mk
+
+
+Autotools_Include_MAINTAINER=	luke at MidnightBSD.org
+
+#---------------------------------------------------------------------------
+# IMPORTANT!  READ ME!  YES, THAT MEANS YOU!
+#
+# The "versioned" autotools referenced here are for BUILDING other ports
+# only.  THIS CANNOT BE STRESSED HIGHLY ENOUGH.  Things WILL BREAK if you
+# try to use them for anything other than ports/ work.  This particularly
+# includes use as a run-time dependency.
+#
+# If you need unmodified versions of autotools, such as for use in an
+# IDE, then you MUST use the devel/gnu-* equivalents, and NOT these.
+# See devel/anjuta and devel/kdevelop for examples.
+#
+# You have been WARNED!
+#---------------------------------------------------------------------------
+
+#---------------------------------------------------------------------------
+# Entry point into the autotools system
+#---------------------------------------------------------------------------
+#
+# USE_AUTOTOOLS= tool:version[:env]  ...
+#
+# 'tool' can currently be one of:
+#	libtool, libltdl, autoconf, autoheader, automake, aclocal
+#
+# 'version' is tool dependent
+#
+# ':env' is used to pecify that the environment variables are needed,
+#	but the relevant tool should NOT be run as part of the
+#	run-autotools target
+#
+# XXX: there is currently no sanity checking of the supplied variables
+#	other than to detect actually available versions.  This should
+#	probably be fixed at some point.
+#
+# In addition, the following variables can be set in the port Makefile
+# to be passed to the relevant tools:
+#
+# AUTOMAKE_ARGS=...
+#	- Extra arguments passed to automake during configure step
+#
+# ACLOCAL_ARGS=...
+#	- Arguments passed to aclocal during configure step
+#
+# AUTOCONF_ARGS=...
+#	- Extra arguments passed to autoconf during configure step
+#
+# AUTOHEADER_ARGS=...
+#	- Extra arguments passed to autoheader during configure step
+#
+# LIBTOOLFLAGS=<value>
+#	- Arguments passed to libtool during configure step
+#
+# LIBTOOLFILES=<list-of-files>
+#	- A list of files to patch during libtool pre-configuration
+#	  Defaults to "aclocal.m4" if autoconf is in use, otherwise
+#	  ${CONFIGURE_SCRIPT} (usually "configure")
+#
+#---------------------------------------------------------------------------
+
+# XXX: here be dragons :)
+#
+.for item in ${USE_AUTOTOOLS}
+AUTOTOOL_${item:C/^([^:]+).*/\1/}${item:M*\:*\:*:C/^[^:]+:[^:]+:([^:]+)/_\1/}= ${item:C/^[^:]+:([^:]+).*/\1/}
+.endfor
+
+#---------------------------------------------------------------------------
+# AUTOTOOLS handling (for build, runtime, and both)
+#---------------------------------------------------------------------------
+.if defined(AUTOTOOL_autotools)
+AUTOTOOLS_DEPENDS=	${LOCALBASE}/share/autotools:${PORTSDIR}/devel/autotools
+
+. if ${AUTOTOOL_autotools} == "build"
+BUILD_DEPENDS+=	${AUTOTOOLS_DEPENDS}
+. elif ${AUTOTOOL_autotools} == "run"
+RUN_DEPENDS+=	${AUTOTOOLS_DEPENDS}
+. elif ${AUTOTOOL_autotools} == "both"
+BUILD_DEPENDS+=	${AUTOTOOLS_DEPENDS}
+RUN_DEPENDS+=	${AUTOTOOLS_DEPENDS}
+. else
+IGNORE+=  Unknown autotools stanza: ${AUTOTOOL_autotools}
+. endif
+
+.endif
+
+#---------------------------------------------------------------------------
+# AUTOMAKE/ACLOCAL
+#---------------------------------------------------------------------------
+
+.if defined(AUTOTOOL_automake)
+AUTOTOOL_automake_env=	${AUTOTOOL_automake}
+GNU_CONFIGURE?=			yes
+.endif
+
+.if defined(AUTOTOOL_aclocal)
+AUTOTOOL_automake_env=	${AUTOTOOL_aclocal}
+GNU_CONFIGURE?=			yes
+.endif
+
+.if defined(AUTOTOOL_automake_env)
+AUTOMAKE_VERSION=	${AUTOTOOL_automake_env}
+AUTOMAKE_SUFFIX=      ${AUTOMAKE_VERSION:C/([0-9])(.*)/\1.\2/}
+
+# Make sure we specified a legal version of automake
+#
+. if !exists(${PORTSDIR}/devel/automake${AUTOMAKE_VERSION}/Makefile)
+IGNORE+=	cannot install: unknown AUTOMAKE version: ${AUTOMAKE_VERSION}
+. endif
+
+# Set up the automake environment
+#
+AUTOMAKE=		${LOCALBASE}/bin/automake-${AUTOMAKE_SUFFIX}
+AUTOMAKE_DIR=	${LOCALBASE}/share/automake-${AUTOMAKE_SUFFIX}
+ACLOCAL=		${LOCALBASE}/bin/aclocal-${AUTOMAKE_SUFFIX}
+ACLOCAL_DIR=	${LOCALBASE}/share/aclocal-${AUTOMAKE_SUFFIX}
+AUTOMAKE_VARS=	ACLOCAL=${ACLOCAL} AUTOMAKE=${AUTOMAKE} AUTOMAKE_VERSION=${AUTOMAKE_VERSION}
+
+AUTOMAKE_DEPENDS=	${AUTOMAKE}:${PORTSDIR}/devel/automake${AUTOMAKE_VERSION}
+BUILD_DEPENDS+=		${AUTOMAKE_DEPENDS}
+
+# XXX: backwards compatibility shim
+#
+. if ${AUTOMAKE_VERSION} == 14
+AUTOMAKE_ARGS+=		-i
+. endif
+
+. if defined(AUTOTOOL_aclocal)
+ACLOCAL_ARGS?=		--acdir=${ACLOCAL_DIR}
+. endif
+
+.endif
+
+#---------------------------------------------------------------------------
+# AUTOCONF/AUTOHEADER
+#---------------------------------------------------------------------------
+
+.if defined(AUTOTOOL_autoheader)
+AUTOTOOL_autoconf=	${AUTOTOOL_autoheader}
+.endif
+
+.if defined(AUTOTOOL_autoconf)
+AUTOTOOL_autoconf_env=	${AUTOTOOL_autoconf}
+GNU_CONFIGURE?=			yes
+.endif
+
+.if defined(AUTOTOOL_autoconf_env)
+AUTOCONF_SUFFIX=	 ${AUTOCONF_VERSION:C/([0-9])(.*)/\1.\2/}
+AUTOCONF_VERSION=	${AUTOTOOL_autoconf_env}
+
+# Make sure we specified a legal version of autoconf
+#
+. if !exists(${PORTSDIR}/devel/autoconf${AUTOCONF_VERSION}/Makefile)
+IGNORE+=	cannot install: unknown AUTOCONF version: ${AUTOCONF_VERSION}
+. endif
+
+# Set up the autoconf/autoheader environment
+#
+AUTOCONF=		${LOCALBASE}/bin/autoconf-${AUTOCONF_SUFFIX}
+AUTOCONF_DIR= 	${LOCALBASE}/share/autoconf-${AUTOCONF_SUFFIX}
+AUTOHEADER=	${LOCALBASE}/bin/autoheader-${AUTOCONF_SUFFIX}
+AUTOIFNAMES=	${LOCALBASE}/bin/ifnames-${AUTOCONF_SUFFIX}
+AUTOM4TE=		${LOCALBASE}/bin/autom4te-${AUTOCONF_SUFFIX}
+AUTORECONF=	${LOCALBASE}/bin/autoreconf-${AUTOCONF_SUFFIX}
+AUTOSCAN=		${LOCALBASE}/bin/autoscan-${AUTOCONF_SUFFIX}
+AUTOUPDATE=	${LOCALBASE}/bin/autoupdate-${AUTOCONF_SUFFIX}
+AUTOCONF_VARS=	AUTOCONF=${AUTOCONF} AUTOHEADER=${AUTOHEADER} AUTOIFNAMES=${AUTOIFNAMES} AUTOM4TE=${AUTOM4TE} AUTORECONF=${AUTORECONF} AUTOSCAN=${AUTOSCAN} AUTOUPDATE=${AUTOUPDATE} AUTOCONF_VERSION=${AUTOCONF_VERSION}
+
+AUTOCONF_DEPENDS=	${AUTOCONF}:${PORTSDIR}/devel/autoconf${AUTOCONF_VERSION}
+BUILD_DEPENDS+=		${AUTOCONF_DEPENDS}
+
+.endif
+
+#---------------------------------------------------------------------------
+# LIBTOOL/LIBLTDL
+#---------------------------------------------------------------------------
+
+# Convenience function to save people having to depend directly on
+# devel/libltdl15
+#
+.if defined(AUTOTOOL_libltdl)
+LIB_DEPENDS+=	ltdl.4:${PORTSDIR}/devel/libltdl15
+.endif
+
+.if defined(AUTOTOOL_libtool)
+GNU_CONFIGURE?=			YES
+AUTOTOOL_libtool_env=	${AUTOTOOL_libtool}
+.endif
+
+.if defined(AUTOTOOL_libtool_env)
+LIBTOOL_VERSION=		${AUTOTOOL_libtool_env}
+
+# Make sure we specified a legal version of libtool
+#
+. if !exists(${PORTSDIR}/devel/libtool${LIBTOOL_VERSION}/Makefile)
+IGNORE+=	cannot install: unknown LIBTOOL version: ${LIBTOOL_VERSION}
+. endif
+
+# Set up the libtool environment
+#
+LIBTOOL=			${LOCALBASE}/bin/libtool
+LIBTOOLIZE=			${LOCALBASE}/bin/libtoolize
+LIBTOOL_LIBEXECDIR=	${LOCALBASE}/libexec/libtool
+LIBTOOL_SHAREDIR=	${LOCALBASE}/share/libtool
+LIBTOOL_M4=			${LOCALBASE}/share/aclocal/libtool.m4
+LTMAIN=				${LIBTOOL_SHAREDIR}/ltmain.sh
+LIBTOOL_VARS=		LIBTOOL=${LIBTOOL} LIBTOOLIZE=${LIBTOOLIZE} LIBTOOL_M4=${LIBTOOL_M4}
+
+LIBTOOL_DEPENDS=	${LIBTOOL}:${PORTSDIR}/devel/libtool${LIBTOOL_VERSION}
+BUILD_DEPENDS+=		${LIBTOOL_DEPENDS}
+
+LIBTOOLFLAGS?=		# default to empty
+
+. if defined(AUTOTOOL_autoconf)
+LIBTOOLFILES?=		aclocal.m4
+. else
+LIBTOOLFILES?=		${CONFIGURE_SCRIPT}
+. endif
+
+.endif
+
+#---------------------------------------------------------------------------
+# Environmental handling
+# Now that we've got our environments defined for autotools, add them
+# in so that the rest of the world can handle them
+#
+AUTOTOOLS_PATH=	${AUTOMAKE_PATH}${AUTOCONF_PATH}
+AUTOTOOLS_VARS=	${AUTOMAKE_VARS} ${AUTOCONF_VARS} ${LIBTOOL_VARS}
+
+.if defined(AUTOTOOLS_PATH) && (${AUTOTOOLS_PATH} != "")
+AUTOTOOLS_ENV+=	PATH=${AUTOTOOLS_PATH}${PATH}
+CONFIGURE_ENV+=	PATH=${AUTOTOOLS_PATH}${PATH}
+MAKE_ENV+=		PATH=${AUTOTOOLS_PATH}${PATH}
+SCRIPTS_ENV+=	PATH=${AUTOTOOLS_PATH}${PATH}
+. for item in automake aclocal autoconf autoheader libtool
+.  if defined(AUTOTOOL_${item}_env)
+${item:U}_ENV+=	PATH=${AUTOTOOLS_PATH}${PATH}
+.  endif
+. endfor
+.endif
+
+.if defined(AUTOTOOLS_VARS) && (${AUTOTOOLS_VARS} != "")
+AUTOTOOLS_ENV+=	${AUTOTOOLS_VARS}
+CONFIGURE_ENV+=	${AUTOTOOLS_VARS}
+MAKE_ENV+=		${AUTOTOOLS_VARS}
+SCRIPTS_ENV+=	${AUTOTOOLS_VARS}
+. for item in automake aclocal autoconf autoheader libtool
+.  if defined(AUTOTOOL_${item}_env)
+${item:U}_ENV+=	${AUTOTOOLS_VARS}
+.  endif
+. endfor
+.endif
+
+#---------------------------------------------------------------------------
+# Make targets
+#---------------------------------------------------------------------------
+
+# run-autotools
+#
+# Part of the configure set - run appropriate programs prior to
+# the actual configure target if autotools are in use.
+# If needed, this target can be overridden, for example to change
+# the order of autotools running.
+
+.if !target(run-autotools)
+.ORDER: run-autotools run-autotools-aclocal patch-autotools run-autotools-autoheader run-autotools-autoconf run-autotools-automake
+
+run-autotools:: run-autotools-aclocal patch-autotools run-autotools-autoheader \
+		run-autotools-autoconf run-autotools-automake
+.endif
+
+.if !target(run-autotools-aclocal)
+run-autotools-aclocal:
+. if defined(AUTOTOOL_aclocal)
+	@(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${ACLOCAL} \
+		${ACLOCAL_ARGS})
+. else
+	@${DO_NADA}
+. endif
+.endif
+
+.if !target(run-autotools-automake)
+run-autotools-automake:
+. if defined(AUTOTOOL_automake)
+	@(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOMAKE} \
+		${AUTOMAKE_ARGS})
+. else
+	@${DO_NADA}
+. endif
+.endif
+
+.if !target(run-autotools-autoconf)
+run-autotools-autoconf:
+. if defined(AUTOTOOL_autoconf)
+	@(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOCONF} \
+		${AUTOCONF_ARGS})
+. else
+	@${DO_NADA}
+. endif
+.endif
+
+.if !target(run-autotools-autoheader)
+run-autotools-autoheader:
+. if defined(AUTOTOOL_autoheader)
+	@(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOHEADER} \
+		${AUTOHEADER_ARGS})
+. else
+	@${DO_NADA}
+. endif
+.endif
+
+# patch-autotools
+#
+# Special target to automatically make libtool using ports use the
+# libtool port.  See above for default values of LIBTOOLFILES.
+
+.if !target(patch-autotools)
+patch-autotools::
+. if defined(AUTOTOOL_libtool)
+	@(cd ${PATCH_WRKSRC}; \
+	for file in ${LIBTOOLFILES}; do \
+		${CP} $$file $$file.tmp; \
+		${SED} -e "/^ltmain=/!s^\$$ac_aux_dir/ltmain.sh^${LIBTOOLFLAGS} ${LTMAIN}^g" \
+			     -e '/^LIBTOOL=/s^\$$(top_builddir)/libtool^${LIBTOOL}^g' \
+			$$file.tmp > $$file; \
+		${RM} $$file.tmp; \
+	done);
+. else
+	@${DO_NADA}
+. endif
+.endif
--- /dev/null
+++ Mk/extensions/pgsql.mk
@@ -0,0 +1,83 @@
+# -*- mode: Makefile; tab-width: 4; -*-
+# ex: ts=4
+#
+# $MidnightBSD: mports/Mk/extensions/pgsql.mk,v 1.1 2008/10/23 22:55:44 ctriv Exp $ 
+# $FreeBSD: ports/Mk/bsd.database.mk,v 1.14 2006/07/05 02:18:08 linimon Exp $
+#
+
+.if defined(_POSTMKINCLUDED) && !defined(Pgsql_Post_Include)
+
+Pgsql_Post_Include=			pgsql.mk
+Pgsql_Include_MAINTAINER=	ports at MidnightBSD.org
+
+# USE_PGSQL		- Add PostgreSQL client dependency.
+#				  If no version is given (by the maintainer via the port or
+#				  by the user via defined variable), try to find the
+#				  currently installed version.  Fall back to default if
+#				  necessary (PostgreSQL-8.2 = 82).
+# DEFAULT_PGSQL_VER
+#				- PostgreSQL default version. Can be overridden within a port.
+#				  Default: 82.
+# WANT_PGSQL_VER
+#				- Maintainer can set an arbitrary version of PostgreSQL by
+#				  using it.
+# IGNORE_WITH_PGSQL
+#				- This variable can be defined if the ports doesn't support
+#				  one or more versions of PostgreSQL.
+# WITH_PGSQL_VER
+#				- User defined variable to set PostgreSQL version.
+# PGSQL_VER
+#				- Detected PostgreSQL version.
+
+
+DEFAULT_PGSQL_VER?=	82
+PGSQL82_LIBVER=         5
+PGSQL83_LIBVER=		5
+
+# Setting/finding PostgreSQL version we want.
+.if exists(${LOCALBASE}/bin/pg_config) && !defined(PACKAGE_BUILDING)
+_PGSQL_VER!=	${LOCALBASE}/bin/pg_config --version | ${SED} -n 's/PostgreSQL[^0-9]*\([0-9][0-9]*\)\.\([0-9][0-9]*\)[^0-9].*/\1\2/p'
+.endif
+
+.if defined(WANT_PGSQL_VER)
+.if defined(WITH_PGSQL_VER) && ${WITH_PGSQL_VER} != ${WANT_PGSQL_VER}
+IGNORE=		cannot install: the port wants postgresql${WANT_PGSQL_VER}-client and you try to install postgresql${WITH_PGSQL_VER}-client.
+.endif
+PGSQL_VER=	${WANT_PGSQL_VER}
+.elif defined(WITH_PGSQL_VER)
+PGSQL_VER=	${WITH_PGSQL_VER}
+.else
+.if defined(_PGSQL_VER)
+PGSQL_VER=	${_PGSQL_VER}
+.else
+PGSQL_VER=	${DEFAULT_PGSQL_VER}
+.endif
+.endif # WANT_PGSQL_VER
+
+.if defined(_PGSQL_VER) && ${PGSQL_VER} != ${_PGSQL_VER}
+IGNORE=		cannot install: the port wants postgresql${PGSQL_VER}-client but you have postgresql${_PGSQL_VER}-client installed
+.endif
+
+# And now we are checking if we can use it
+.if defined(PGSQL${PGSQL_VER}_LIBVER)
+# compatability shim
+.if defined(BROKEN_WITH_PGSQL)
+IGNORE_WITH_PGSQL=${BROKEN_WITH_PGSQL}
+.endif
+.if defined(IGNORE_WITH_PGSQL)
+.	for VER in ${IGNORE_WITH_PGSQL}
+.		if (${PGSQL_VER} == "${VER}")
+IGNORE=		cannot install: does not work with postgresql${PGSQL_VER}-client PostgresSQL (${IGNORE_WITH_PGSQL} not supported)
+.		endif
+.	endfor
+.endif # IGNORE_WITH_PGSQL
+LIB_DEPENDS+=	pq.${PGSQL${PGSQL_VER}_LIBVER}:${PORTSDIR}/databases/postgresql${PGSQL_VER}-client
+.else
+IGNORE=		cannot install: unknown PostgreSQL version: ${PGSQL_VER}
+.endif # Check for correct version
+CPPFLAGS+=		-I${LOCALBASE}/include
+LDFLAGS+=		-L${LOCALBASE}/lib
+CONFIGURE_ENV+=	CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
+
+
+.endif #defined(_POSTMKINCLUDED) && !defined(Pgsql_Post_Include)
\ No newline at end of file
--- /dev/null
+++ Mk/extensions/apache.mk
@@ -0,0 +1,379 @@
+#-*- mode: makefile; tab-width: 4; -*-
+# ex:ts=4
+#
+# $MidnightBSD: mports/Mk/extensions/apache.mk,v 1.1 2008/10/23 22:55:44 ctriv Exp $
+# $FreeBSD: ports/Mk/bsd.apache.mk,v 1.12 2006/06/20 04:58:12 linimon Exp $
+#
+# apache.mk - Apache related macros.
+# Author: Clement Laforet <clement at FreeBSD.org>
+#
+# Please view me with 4 column tabs!
+
+##########################################################################
+#
+# Variables definition
+# USE_APACHE:	Call this script. Values can be:
+#		<version>:2.0/20/2.2/1.3+/2.0+/2.1+/2.2+
+#		common*: common13, common20, common21 and common22
+#
+#
+#
+
+#
+# the bsd.apache.mk we inherited from FreeBSD was included twice, but never guarded.  
+# we'll do the same, but this is an odd state of affairs.
+#
+
+.if defined(APACHE_COMPAT)
+USE_APACHE=yes
+.endif
+
+# Print warnings
+_ERROR_MSG=	: Error from apache.mk.
+APACHE_SUPPORTED_VERSION=	20 22
+.if ${USE_APACHE:Mcommon*} != ""
+AP_PORT_IS_SERVER=	YES
+.elif ${USE_APACHE:L} == apr
+APR_DEPS=			YES
+.elif ${USE_APACHE:C/\.//:C/\+//:M[12][3210]} != ""
+AP_PORT_IS_MODULE=	YES
+
+#### for backward compatibility
+.elif ${USE_APACHE:L} == yes
+APACHE_PORT?=	www/apache20
+APXS?=			${LOCALBASE}/sbin/apxs
+.if !defined(APACHE_COMPAT)
+BUILD_DEPENDS+=	${APXS}:${PORTSDIR}/${APACHE_PORT}
+RUN_DEPENDS+=	${APXS}:${PORTSDIR}/${APACHE_PORT}
+.endif
+#### End of backward compatibility
+
+.else
+IGNORE=		${_ERROR_MSG} Illegal use of USE_APACHE
+.endif
+
+.if defined(AP_PORT_IS_SERVER)
+# For slave ports:
+.if defined(SLAVE_DESIGNED_FOR) && ${PORTVERSION} != ${SLAVE_DESIGNED_FOR}
+IGNORE=	Sorry, ${SLAVENAME} and ${PORTNAME} versions are out of sync
+.endif
+
+.if defined(SLAVE_PORT_MODULES)
+DEFAULT_MODULES_CATEGORIES+=	SLAVE_PORT
+ALL_MODULES_CATEGORIES+=		SLAVE_PORT
+.endif
+
+# Module selection
+.for category in ${DEFAULT_MODULES_CATEGORIES}
+DEFAULT_MODULES+=			${${category}_MODULES}
+WITH_${category}_MODULES= 	YES
+.endfor
+
+.for category in ${ALL_MODULES_CATEGORIES}
+AVAILABLE_MODULES+=			${${category}_MODULES}
+.endfor
+
+# Setting "@comment " as default.
+.for module in ${AVAILABLE_MODULES}
+${module}_PLIST_SUB=		"@comment "
+.endfor
+
+# Configure
+# dirty hacks to make sure all modules are disabled before we select them
+.if ${USE_APACHE} == common20
+CONFIGURE_ARGS+=	--disable-access --disable-auth \
+			--disable-charset-lite --disable-include \
+			--disable-log-config --disable-env --disable-setenvif \
+			--disable-mime --disable-status --disable-autoindex \
+			--disable-asis --disable-cgid --disable-cgi \
+			--disable-negotiation --disable-dir --disable-imap \
+			--disable-actions --disable-userdir --disable-alias
+.elif ${USE_APACHE} == common22
+CONFIGURE_ARGS+=	--disable-authn-file --disable-authn-default \
+			--disable-authz-host --disable-authz-groupfile \
+			--disable-authz-user --disable-authz-default \
+			--disable-auth-basic --disable-charset-lite \
+			--disable-include --disable-log-config --disable-env \
+			--disable-setenvif --disable-mime --disable-status \
+			--disable-autoindex --disable-asis --disable-cgid \
+			--disable-cgi --disable-negotiation --disable-dir \
+			--disable-imagemap --disable-actions --disable-userdir \
+			--disable-alias --disable-filter \
+			--disable-proxy --disable-proxy-connect \
+			--disable-proxy-ftp --disable-proxy-http \
+			--disable-proxy-ajp --disable-proxy-balancer
+.endif
+
+.if defined(WITH_MODULES)
+_APACHE_MODULES+=	${WITH_MODULES}
+.else
+.for category in ${ALL_MODULES_CATEGORIES}
+.if defined (WITHOUT_${category}_MODULES) || defined (WITH_CUSTOM_${category})
+.        if defined(WITH_${category}_MODULES})
+.        undef WITH_${category}_MODULES
+.        endif
+.    if defined (WITH_CUSTOM_${category})
+_APACHE_MODULES+=	${WITH_CUSTOM_${category}}
+.    endif
+.elif defined(WITH_${category}_MODULES)
+_APACHE_MODULES+=	${${category}_MODULES}
+.endif
+.endfor
+.    if defined(WITH_EXTRA_MODULES)
+_APACHE_MODULES+=	${WITH_EXTRA_MODULES}
+.    endif
+.endif
+
+.if !defined(WITH_STATIC_APACHE)
+.    if ${USE_APACHE:Mcommon2*} != ""
+# FYI
+#DYNAMIC_MODULES=	so
+CONFIGURE_ARGS+=	--enable-so
+.    endif
+.else
+.    if ${USE_APACHE:Mcommon2*} != ""
+CONFIGURE_ARGS+=	--disable-so
+.    endif
+WITH_ALL_STATIC_MODULES=	YES
+.endif
+
+.if defined(WITH_SUEXEC) || defined(WITH_SUEXEC_MODULES)
+.if ${USE_APACHE:Mcommon2*} != ""
+_APACHE_MODULES+=		${SUEXEC_MODULES}
+SUEXEC_CONFARGS=	with-suexec
+.endif
+
+# From now we're defaulting to apache 2.*
+SUEXEC_DOCROOT?=		${PREFIX}/www/data
+SUEXEC_USERDIR?=		public_html
+SUEXEC_SAFEPATH?=		${PREFIX}/bin:${LOCALBASE}/bin:/usr/bin:/bin
+SUEXEC_LOGFILE?=		/var/log/httpd-suexec.log
+SUEXEC_UIDMIN?=			1000
+SUEXEC_GIDMIN?=			1000
+SUEXEC_CALLER?=			${WWWOWN}
+CONFIGURE_ARGS+=		--${SUEXEC_CONFARGS}-caller=${SUEXEC_CALLER} \
+				--${SUEXEC_CONFARGS}-uidmin=${SUEXEC_UIDMIN} \
+				--${SUEXEC_CONFARGS}-gidmin=${SUEXEC_GIDMIN} \
+				--${SUEXEC_CONFARGS}-userdir="${SUEXEC_USERDIR}" \
+				--${SUEXEC_CONFARGS}-docroot="${SUEXEC_DOCROOT}" \
+				--${SUEXEC_CONFARGS}-safepath="${SUEXEC_SAFEPATH}" \
+				--${SUEXEC_CONFARGS}-logfile="${SUEXEC_LOGFILE}"
+.if ${USE_APACHE:Mcommon2*} != ""
+CONFIGURE_ARGS+=	--${SUEXEC_CONFARGS}-bin="${PREFIX}/sbin/suexec"
+.endif
+
+.   if defined(WITH_SUEXEC_UMASK)
+CONFIGURE_ARGS+=		--${SUEXEC_CONFARGS}-umask=${WITH_SUEXEC_UMASK}
+.   endif
+.endif
+
+.if !defined(WITHOUT_MODULES)
+APACHE_MODULES=		${_APACHE_MODULES}
+.else
+APACHE_MODULES!=	\
+			for module in ${_APACHE_MODULES}; do \
+				${ECHO_CMD} ${WITHOUT_MODULES} | ${GREP} -wq $${module} 2> /dev/null || \
+				${ECHO_CMD} $${module}; \
+			done
+.endif
+
+.if defined(WITH_STATIC_MODULES)
+STATIC_MODULE_CONFARG=	--enable-$${module}
+DSO_MODULE_CONFARG=		--enable-$${module}=shared
+_CONFIGURE_ARGS!=	\
+			for module in ${APACHE_MODULES} ; do \
+				${ECHO_CMD} ${WITH_STATIC_MODULES} | \
+					${GREP} -wq $${module} 2> /dev/null ; \
+				if [ "$${?}" = "0" ] ; then \
+						${ECHO_CMD} "${STATIC_MODULE_CONFARG}"; \
+					else \
+						${ECHO_CMD} "${DSO_MODULE_CONFARG}"; \
+					fi; done
+CONFIGURE_ARGS+=	${_CONFIGURE_ARGS}
+.elif defined(WITH_STATIC_APACHE) || defined(WITH_ALL_STATIC_MODULES)
+WITH_STATIC_MODULES=	${APACHE_MODULES}
+CONFIGURE_ARGS+=	--enable-modules="${APACHE_MODULES}"
+.else
+CONFIGURE_ARGS+=	--enable-mods-shared="${APACHE_MODULES}"
+.endif
+
+.if defined(WITH_STATIC_MODULES)
+_SHARED_MODULES!=	\
+			for module in ${APACHE_MODULES} ; do \
+				${ECHO_CMD} ${WITH_STATIC_MODULES} | ${GREP} -wq $${module} 2> /dev/null || \
+				${ECHO_CMD} $${module}; \
+			done
+SHARED_MODULES=		${_SHARED_MODULES}
+.elif !defined(WITH_ALL_STATIC_MODULES)
+SHARED_MODULES=		${APACHE_MODULES}
+.endif
+
+.  for module in ${SHARED_MODULES}
+${module}_PLIST_SUB=	""
+.  endfor
+
+.for module in ${AVAILABLE_MODULES}
+PLIST_SUB+=	MOD_${module:U}=${${module}_PLIST_SUB}
+.endfor
+####End of PORT_IS_SERVER ####
+
+.elif defined(APR_DEPS)
+IGNORE=		${_ERROR_MSG} apr support is not yet implemented
+
+.elif defined(AP_PORT_IS_MODULE)
+AP_VERSION=	${USE_APACHE:C/\.//}
+
+APXS?=		${LOCALBASE}/sbin/apxs
+HTTPD?=		${LOCALBASE}/sbin/httpd
+
+MODULENAME?=	${PORTNAME}
+SHORTMODNAME?=	${MODULENAME:S/mod_//}
+SRC_FILE?=	${MODULENAME}.c
+OVERRIDABLE_VARS=	SRC_FILE MODULENAME SHORTMODNAME WRKSRC \
+					PKGNAMESUFFIX
+
+.if exists(${HTTPD}) && !defined(PACKAGE_BUILDING)
+AP_CUR_VERSION!=	${HTTPD} -V | ${SED} -ne 's/^Server version: Apache\/\([0-9]\)\.\([0-9]*\).*/\1\2/p'
+.   if ${AP_CUR_VERSION} > 13
+APACHE_MPM!=		${APXS} -q MPM_NAME
+.   endif 	
+.elif defined(APACHE_PORT)
+AP_CUR_VERSION!=	${ECHO_CMD} ${APACHE_PORT} | ${SED} -ne 's,.*/apache\([0-9]*\).*,\1,p'
+.endif
+
+.if defined(AP_CUR_VERSION)
+VERSION_CHECK!=		eval `${ECHO_CMD} "[ ${AP_VERSION} -eq ${AP_CUR_VERSION} ]" | ${SED} -e 's/- -eq/ -ge/ ; s/+ -eq/ -le/' ` ; ${ECHO_CMD} $${?}
+.   if ${VERSION_CHECK} == 1
+IGNORE=		${_ERROR_MSG} apache${AP_CUR_VERSION} is installed (or APACHE_PORT is defined) and port requires ${USE_APACHE}
+.   endif
+APACHE_VERSION=	${AP_CUR_VERSION}
+.else
+AP_CUR_VERSION=	none
+.   if !defined(APACHE_PORT)
+#Fallback to smallest version...
+APACHE_VERSION=	${AP_VERSION:C/\+//}
+.   endif
+.endif
+
+.if exists(${APXS}) && !defined(PACKAGE_BUILDING)
+APXS_PREFIX!=	${APXS} -q prefix 2> /dev/null || echo NULL
+.   if ${APXS_PREFIX} == NULL
+IGNORE=	: Your apache does not support DSO modules
+.   endif
+.   if defined(AP_GENPLIST) && ${APXS_PREFIX} != ${PREFIX}
+IGNORE?=	PREFIX must be equal to APXS_PREFIX.
+.   endif
+.endif
+
+.if ${APACHE_VERSION} == 20
+AP_BUILDEXT=	la
+APACHEMODDIR=	libexec/apache2
+APACHEINCLUDEDIR=include/apache2
+APACHEETCDIR=	etc/apache2
+APACHE_PORT?=	www/apache${APACHE_VERSION}
+.else
+AP_BUILDEXT=	la
+APACHEMODDIR=	libexec/apache${APACHE_VERSION}
+APACHEINCLUDEDIR=include/apache${APACHE_VERSION}
+APACHEETCDIR=	etc/apache${APACHE_VERSION}
+APACHE_PORT?=	www/apache${APACHE_VERSION}
+.endif
+
+PLIST_SUB+=	APACHEMODDIR="${APACHEMODDIR}" \
+		APACHEINCLUDEDIR="${APACHEINCLUDEDIR}" \
+		APACHEETCDIR="${APACHEETCDIR}"
+
+.for VAR in ${OVERRIDABLE_VARS}
+.  if defined(AP${APACHE_VERSION}_${VAR})
+${VAR} =${AP${APACHE_VERSION}_${VAR}}
+.  endif
+.endfor
+
+BUILD_DEPENDS+=	${APXS}:${PORTSDIR}/${APACHE_PORT}
+RUN_DEPENDS+=	${APXS}:${PORTSDIR}/${APACHE_PORT}
+PLIST_SUB+=	AP_NAME="${SHORTMODNAME}"
+PLIST_SUB+=	AP_MODULE="${MODULENAME}.so"
+
+.if defined(AP_GENPLIST)
+PLIST?=		${WRKDIR}/ap-plist
+.endif
+
+.if defined(AP_INC)
+AP_EXTRAS+=	-I ${AP_INC}
+.endif
+.if defined(AP_LIB)
+AP_EXTRAS+=	-L ${AP_LIB}
+.endif
+
+.endif
+
+.if defined(AP_PORT_IS_SERVER)
+.if !target(print-closest-mirrors)
+print-closest-mirrors:
+	@${ECHO_MSG} -n "Fetching list of nearest mirror: " >&2
+	@MIRRORS=`${FETCH_CMD} -T 30 -qo - http://www.apache.org/dyn/closer.cgi/httpd/ 2> /dev/null\
+	| ${GREP} /httpd/ | ${SED} 's/.*href="\(.*\)"><str.*/\1/g' | \
+	${HEAD} -7 | ${TAIL} -6` ; \
+	${ECHO_MSG} done >&2; if [ "x$$MIRRORS" != "x" ]; then \
+	${ECHO_MSG} -n "MASTER_SITE_APACHE_HTTPD?= ";\
+	${ECHO_MSG} $$MIRRORS; else \
+	${ECHO_MSG} "No mirrors found!">&2 ; fi
+.endif
+
+.if !target(show-categories)
+show-categories:
+.for category in ${ALL_MODULES_CATEGORIES}
+	@${ECHO_MSG} "${category} contains these modules:"
+	@${ECHO_MSG} "  ${${category}_MODULES}"
+.endfor
+.endif
+
+.if !target(show-modules)
+show-modules:
+	@for module in ${AVAILABLE_MODULES} ; do \
+	${ECHO_MSG} -n "$${module}: "; \
+	if ${ECHO_CMD} ${APACHE_MODULES} | ${GREP} -wq $${module} 2> /dev/null ; \
+	then \
+		${ECHO_CMD} -n "enabled "; \
+			if ${ECHO_CMD} ${WITH_STATIC_MODULES} | ${GREP} -wq $${module} 2> /dev/null ; then \
+				${ECHO_CMD} "(static)" ; \
+			else \
+				${ECHO_CMD} "(shared)" ;\
+			fi;\
+	else \
+		${ECHO_CMD} disabled ;\
+	fi;\
+	done
+.endif
+
+.elif defined(AP_PORT_IS_MODULE)
+
+.if defined(AP_FAST_BUILD)
+.if !target(ap-gen-plist)
+ap-gen-plist:
+.if defined(AP_GENPLIST)
+.   if !exists(${PLIST})
+	@${ECHO} "===>  Generating apache plist"
+	@${ECHO} "@unexec %D/sbin/apxs -e -A -n %%AP_NAME%% %D/%%APACHEMODDIR%%/%%AP_MODULE%%" > ${PLIST}
+	@${ECHO} "%%APACHEMODDIR%%/%%AP_MODULE%%" >> ${PLIST}
+	@${ECHO} "@exec %D/sbin/apxs -e -A -n %%AP_NAME%% %D/%F" >> ${PLIST}
+	@${ECHO} "@unexec echo \"Don't forget to remove all ${MODULENAME}-related directives in your httpd.conf\"">> ${PLIST}
+.   endif
+.else
+	@${DO_NADA}
+.endif
+.endif
+
+.if !target(do-build)
+do-build: ap-gen-plist
+	@cd ${WRKSRC} && ${APXS} -c ${AP_EXTRAS} -o ${MODULENAME}.${AP_BUILDEXT} ${SRC_FILE}
+.endif
+
+.if !target(do-install)
+do-install:
+	@${APXS} -i -A -n ${SHORTMODNAME} ${WRKSRC}/${MODULENAME}.${AP_BUILDEXT}
+.endif
+
+.endif
+
+.endif
--- /dev/null
+++ Mk/extensions/cmake.mk
@@ -0,0 +1,95 @@
+# $MidnightBSD: mports/Mk/extensions/cmake.mk,v 1.1 2008/10/23 22:55:44 ctriv Exp $
+#
+
+.if !defined(_POSTMKINCLUDED) || !defined(Cmake_Pre_Include)
+
+Cmake_Pre_Include = cmake.mk
+
+# USE_CMAKE			- If set, this port uses cmake.
+#
+# CMAKE_ENV			- Environment passed to cmake.
+#					Default: ${CONFIGURE_ENV}
+# CMAKE_ARGS		- Arguments passed to cmake
+#					Default: see below
+# CMAKE_USE_PTHREAD	- Instruct cmake to use pthreads when 
+#					compiling/linking
+#					Default: not set
+# CMAKE_BUILD_TYPE	- Type of build (release, debug)
+#					Default: Release
+# CMAKE_VERBOSE		- Verbose build
+#					Default: not set
+# CMAKE_SOURCE_PATH	- Path to sourcedir for cmake
+#					Default: .
+# CMAKE_INSTALL_PREFIX	- prefix for cmake to use for installation.
+#					Default: ${PREFIX}
+
+CMAKE_MAINTAINER=  ports at MidnightBSD.org
+
+#
+# CMAKE_BIN is the location where the cmake port installs the cmake
+# executable
+#
+# CMAKE_PORT is where the cmake port is located in the ports tree
+#
+CMAKE_BIN=		${LOCALBASE}/bin/cmake
+CMAKE_PORT=		${PORTSDIR}/devel/cmake
+
+#
+# Make sure we depend on cmake
+#
+BUILD_DEPENDS+=	${CMAKE_BIN}:${CMAKE_PORT}
+
+#
+# Default environment and arguments to cmake
+#
+CMAKE_ENV?=		${CONFIGURE_ENV}
+CMAKE_ARGS+=	-DCMAKE_C_COMPILER:STRING="${CC}" \
+				-DCMAKE_CXX_COMPILER:STRING="${CXX}" \
+				-DCMAKE_C_FLAGS:STRING="${CFLAGS}" \
+				-DCMAKE_CXX_FLAGS:STRING="${CXXFLAGS}" \
+				-DCMAKE_INSTALL_PREFIX:PATH="${CMAKE_INSTALL_PREFIX}" \
+				-DCMAKE_BUILD_TYPE:STRING="${CMAKE_BUILD_TYPE}"
+
+#
+# Default build type and sourcedir
+#
+CMAKE_BUILD_TYPE?=	Release
+CMAKE_SOURCE_PATH?=	.
+CMAKE_INSTALL_PREFIX?=	${PREFIX}
+
+#
+# Instruct cmake to compile/link with pthreads
+#
+.if defined(CMAKE_USE_PTHREAD)
+CFLAGS+=		${PTHREAD_CFLAGS}
+CXXFLAGS+=		${PTHREAD_CFLAGS}
+
+CMAKE_ARGS+=	-DCMAKE_THREAD_LIBS:STRING="${PTHREAD_LIBS}" \
+				-DCMAKE_USE_PTHREADS:BOOL=ON \
+				-DCMAKE_EXE_LINKER_FLAGS:STRING="${PTHREAD_LIBS}"
+.endif
+
+#
+# Force DEBUG buildtype if needed
+#
+.if defined(CMAKE_DEBUG) || defined(WITH_DEBUG)
+CMAKE_BUILD_TYPE=DEBUG
+.endif
+
+#
+# Force makefile verbosity if needed
+#
+.if defined(CMAKE_VERBOSE) || defined(BATCH)
+CMAKE_ARGS+=	-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
+.endif
+
+#
+# Redefine do-configure target
+#
+.if !target(do-configure)
+do-configure:
+	@cd ${WRKSRC}; ${SETENV} ${CMAKE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} ${CMAKE_SOURCE_PATH}
+.endif
+
+
+.endif
\ No newline at end of file


More information about the Midnightbsd-cvs mailing list