Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Oct 2000 21:59:01 -0500 (CDT)
From:      "Scot W. Hetzel" <hetzels@westbend.net>
To:        FreeBSD-Ports <ports@freebsd.org>
Subject:   New bsd.apache.mk
Message-ID:  <200010200259.VAA00433@wbiw01.westbend.net>

next in thread | raw e-mail | index | archive | help
The purpose of bsd.apache.mk is to make it easier to create an
Apache Module port, as well as to remove redundant code from
the existing Apache Module ports.

NOTE: This can also be used by other ports that depend on apache.

Does any changes need to be made before I send-pr it?

I would also like to nominate that a new virtual category be
created called "apache", since there currently are 32 Apache
related port.

$ grep apache INDEX | wc -l
      32

Scot W. Hetzel

diff -ruN Mk.orig/bsd.apache.mk Mk/bsd.apache.mk
--- Mk.orig/bsd.apache.mk	Wed Dec 31 18:00:00 1969
+++ Mk/bsd.apache.mk	Thu Oct 19 21:08:24 2000
@@ -0,0 +1,136 @@
+#-*- mode: Fundamental; tab-width: 4; -*-
+# ex:ts=4
+#
+# $FreeBSD:$
+#
+# Please view me with 4 column tabs!
+
+.if !defined(Apache_Include)
+
+Apache_Include=			bsd.apache.mk
+Apache_Include_MAINTAINER=      hetzels@westbend.net
+
+# This file contains some variable definitions that are supposed to
+# make your life easier when dealing with ports related to the Apache
+# language. It's automatically included when USE_APACHE is used in a
+# port.
+#
+# The variables:
+#
+# USE_APACHE	- Says that the port uses Apache for building and running.
+#
+# USE_APACHE_SERVER - Used only by Apache Server ports.
+#
+# AP_PORT	- Set to the name of the apache port
+#			default: apache13
+#
+# AP_TARGET	- Set to the name of the apache server
+#			default: httpd
+#
+# AP_SBINDIR	- Set to the location of the apache sbin directory
+#			default: ${PREFIX}/sbin
+#
+# AP_INCLUDE	- Set to the location of the apache include directory
+#			default: ${PREFIX}/include/apache
+#
+# AP_LIBEXEC	- Set to the location of the apache libexec directory
+#			default: ${PREFIX}/libexec/apache
+#
+# AP_SYSCONF	- Set to the location of the apache config directory
+#			default: ${PREFIX}/etc/apache
+#
+# AP_PREFIX	- Set to the apache prefix (default: ${PREFIX})
+#
+#
+
+APXS=		${PREFIX}/sbin/apxs
+
+# check if an existing Apache port is installed in ${PREFIX}
+.if exists(${APXS})
+APXS_WORKS!=    ${APXS} -q TARGET 2>/dev/null || echo no
+.endif
+.if exists(${APXS}) && ${APXS_WORKS} != no
+.if !defined(_AP_PATHS)
+_AP_PATHS!=	${APXS} -q TARGET PREFIX SBINDIR INCLUDEDIR LIBEXECDIR SYSCONFDIR | \
+		/usr/bin/awk '{print "TARGET" $$1 " PREFIX" $$2 " SBINDIR" $$3 " INCLUDEDIR" $$4 " LIBEXECDIR" $$5 " SYSCONFDIR" $$6 }'
+.endif
+
+AP_TARGET=	${_AP_PATHS:MTARGET*:S/^TARGET//}
+AP_PREFIX=	${_AP_PATHS:MPREFIX*:S/^PREFIX//}
+AP_SBINDIR=	${_AP_PATHS:MSBINDIR*:S/^SBINDIR//}
+AP_INCLUDE=	${_AP_PATHS:MINCLUDEDIR*:S/^INCLUDEDIR//}
+AP_LIBEXEC=	${_AP_PATHS:MLIBEXECDIR*:S/^LIBEXECDIR//}
+AP_SYSCONF=	${_AP_PATHS:MSYSCONFDIR*:S/^SYSCONFDIR//}
+
+# Try to determine the name of the installed Apache port in ${PREFIX}
+
+.if !defined(_AP_PORT)
+_AP_PORT!=	if ${APXS} -q AP_PORT > /dev/null 2>&1 ; then \
+			${APXS} -q AP_PORT ; \
+		else \
+			if [ "${AP_TARGET}" = "httpsd" ] ; then \
+				echo "apache13-ssl" ; \
+			else \
+				echo "apache13" ; \
+			fi ; \
+		fi
+.endif
+
+.if defined(AP_PORT) && ${AP_PORT} != ${_AP_PORT}
+.BEGIN
+	${ECHO} "Error: Trying to install ${AP_PORT}, while ${_AP_PORT} previously"
+	${ECHO} "Error: installed in ${AP_PREFIX}. Uninstall ${_AP_PORT} in order"
+	${ECHO} "Error: to install ${AP_PORT}.
+	false
+.END
+.elif !defined(AP_PORT)
+AP_PORT=	${_AP_PORT}
+.endif
+.else
+
+# No Apache port installed, default to apache13.
+AP_PORT?=	apache13
+
+.if ${AP_PORT} == "apache13-ssl"
+AP_TARGET?=	httpsd
+.else
+AP_TARGET?=	httpd
+.endif
+
+AP_PREFIX?=	${PREFIX}
+AP_SBINDIR?=	${AP_PREFIX}/sbin
+AP_INCLUDE?=	${AP_PREFIX}/include/apache
+AP_LIBEXEC?=	${AP_PREFIX}/libexec/apache
+AP_SYSCONF?=	${AP_PREFIX}/etc/apache
+
+.endif
+
+# Default pkg suffixes and dependancies for ports that depend
+# on the Apache Server.
+
+.if !defined(${USE_APACHE_SERVER})
+.if ${AP_PORT} == "apache13-ssl"
+PKGNAMESUFFIX=	-ap_ssl
+.elif ${AP_PORT} == "apache13+ipv6"
+PKGNAMESUFFIX=	-ap+ipv6
+.endif
+
+BUILD_DEPENDS+=	${APXS}:${PORTSDIR}/www/${AP_PORT}
+RUN_DEPENDS+=	${PREFIX}/sbin/${AP_TARGET}:${PORTSDIR}/www/${AP_PORT}
+.endif
+
+PLIST_SUB+=	AP_SBINDIR=${AP_SBINDIR:S/^${PREFIX}\///} \
+		AP_INCLUDE=${AP_INCLUDE:S/^${PREFIX}\///} \
+		AP_LIBEXEC=${AP_LIBEXEC:S/^${PREFIX}\///} \
+		AP_SYSCONF=${AP_SYSCONF:S/^${PREFIX}\///}
+
+.if !defined(NOPRECIOUSMAKEVARS)
+.for softvar in _AP_PATHS _AP_PORT
+.if defined(${softvar})
+__softMAKEFLAGS+=      '${softvar}+=${${softvar}:S/'/'\''/g}'
+.endif
+.endfor
+.endif
+
+.endif
+# End of bsd.apache.mk.
diff -ruN Mk.orig/bsd.port.mk Mk/bsd.port.mk
--- Mk.orig/bsd.port.mk	Tue Oct 17 05:11:16 2000
+++ Mk/bsd.port.mk	Thu Oct 19 21:02:40 2000
@@ -682,6 +682,10 @@
 .include "${PORTSDIR}/Mk/bsd.ruby.mk"
 .endif
 
+.if defined(USE_APACHE) || defined(USE_APACHE_SERVER)
+.include "${PORTSDIR}/Mk/bsd.apache.mk"
+.endif
+
 .include "${PORTSDIR}/Mk/bsd.gnome.mk"
 
 # defaults to 3.3.6; will be changed to 4.0 when it is ready


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200010200259.VAA00433>