Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Jun 2000 21:20:04 -0700 (PDT)
From:      "Scot W. Hetzel" <hetzels@westbend.net>
To:        freebsd-ports@FreeBSD.org
Subject:   Re: ports/18960 - Add USE_APACHE to bsd.port.mk for Apache module ports
Message-ID:  <200006030420.VAA50100@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/18960; it has been noted by GNATS.

From: "Scot W. Hetzel" <hetzels@westbend.net>
To: FreeBSD-GNATS <FreeBSD-gnats-submit@FreeBSD.ORG>
Cc: Tim Vanderhoek <vanderh@ecf.utoronto.ca>
Subject: Re: ports/18960 - Add USE_APACHE to bsd.port.mk for Apache module ports
Date: Fri, 2 Jun 2000 23:15:59 -0500 (CDT)

 From: "Tim Vanderhoek" <vanderh@ecf.utoronto.ca>
 > On Thu, Jun 01, 2000 at 08:48:11PM -0500, hetzels@westbend.net wrote:
 > > 
 > > +AP_TARGET!= ${APXS} -q TARGET
 > > +AP_SBINDIR!= ${APXS} -q SBINDIR
 > > +AP_INCLUDE!= ${APXS} -q INCLUDEDIR
 > > +AP_LIBEXEC!= ${APXS} -q LIBEXECDIR
 > > +AP_SYSCONF!= ${APXS} -q SYSCONFDIR
 > > +AP_PREFIX!= ${APXS} -q PREFIX
 > 
 > All of these should probably also be added to the list of precious
 > make vars preserved through the environment at the end of bsd.port.mk.
 > 
 > It would be faster to do something like:
 > 
 > _AP_PATHS!= ${APXS} -q TARGET SBINDIR INCLUDEDIR ... | \
 >     ${AWK} '{print "TARGET:" $1 " " "SBINDIR:" $2 ...}'
 > AP_TARGET=${_AP_PATHS:MTARGET*:S/^TARGET//}
 > AP_SBINDIR=${_AP_PATHS:MSBINDIR*:S/^SBINDIR//}
 > ...
 > 
 > Then only _AP_PATHS would be worthwhile for listing as a previous make
 > variable.
 > 
 So your suggesting that using _AP_PATHS would make it so that ${APXS} -q ...
 gets executed only once, instead of multiple times for each AP_* variable
 and each make target?
 
 I recreated USE_APACHE as you suggested, but had only a couple of problems:
 
 1. ${_AP_PATHS:MTARGET*:S/^TARGET//} would return with ":httpd". I removed
    the ":" from the awk script, and that made it return with the correct
    value "httpd".
 
 2. ${AWK} is not defined early enough in the bsd.port.mk file, so I used
    /usr/bin/awk instead.
 
 > For more trickery, you could get away with something like
 > 
 > AP_TARGET= `${APXS} -q TARGET`
 > 
 > for most cases, I imagine.  That's fastest of all.
 > 
 
 Only one problem with this approach, AP_* gets defined as:
 
 `/usr/local/sbin/apxs -q <apxs_variable>`
 
 While this works with RUN_DEPENDS, it doesn't work when you use the var
 in PLIST_SUB.
 
 ===>   Generating temporary packing list
 /usr/local/sbin/apxs!g: not found
 
 and the work/.PLIST.mktmp contains:
 
 /libphp3.so
 
 instead of
 
 libexec/apache/libphp3.so
 
 > There's also no particular reason why ports that need these vars can't
 > simply set the vars themselves.
 > 
 There will be eight Apache module ports:
 
  mod_auth_mysql		New port
  mod_dav
  mod_dtcl
  mod_frontpage		apache13-fp
  mod_jserv		apache-jserv
  mod_php3		apache13-php3
  mod_php4		apache13-php4
  mod_ssl		apache13-modssl
 
 that will need some form of the "if exists(${APXS}) .. else .. if" code, along
 with the ability to build/run depend on any of the 3 main apache ports:
 
  apache13
  apache13+ipv6
  apache13-ssl
 
 Having USE_APACHE defined in the bsd.port.mk, along with the AP_* vars, will
 make these ports consistant, as well as making it easier to add new Apache
 module ports.
 
 > It also looks like there's an .endif missing, but I'm probably just
 > not reading the patch right.  :)
 > 
 The .endif is there (see +.endif at top of 2nd section). :)
 
 Scot
 
 NOTE for Satoshi Asami:  Use this patch instead of the originally submitted patch
 if it meets with your approval.
 
 --- bsd.port.mk.orig	Sat May  6 20:09:14 2000
 +++ bsd.port.mk	Fri Jun  2 21:45:37 2000
 @@ -118,6 +118,15 @@
  #
  # Use these if your port uses some of the common software packages.
  #
 +# USE_APACHE	- Says that the port uses Apache for building and running.
 +# 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
 +# AP_INCLUDE	- Set to the location of the apache include directory
 +# AP_LIBEXEC	- Set to the location of the apache libexec directory
 +# AP_SYSCONF	- Set to the location of the apache config directory
 +# AP_PREFIX	- Set to the apache prefix (default: ${PREFIX})
 +#
  # USE_BZIP2		- Says that the port tarballs use bzip2, not gzip, for
  #				  compression.
  # USE_ZIP		- Says that the port distfile uses zip, not tar w/[bg]zip
 @@ -700,6 +709,59 @@
  USE_NEWGCC=	yes
  .endif
  
 +.if defined(USE_APACHE)
 +APXS=		${PREFIX}/sbin/apxs
 +
 +.if exists(${APXS})
 +.if !defined(_AP_PATHS)
 +_AP_PATHS!=	${APXS} -q TARGET SBINDIR INCLUDEDIR LIBEXECDIR SYSCONFDIR PREFIX | \
 +		/usr/bin/awk '{print "TARGET" $$1 " SBINDIR" $$2 " INCLUDEDIR" $$3 " LIBEXECDIR" $$4 " SYSCONFDIR" $$5 " PREFIX" $$6 }'
 +.endif
 +AP_TARGET=	${_AP_PATHS:MTARGET*:S/^TARGET//}
 +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//}
 +AP_PREFIX=	${_AP_PATHS:MPREFIX*:S/^PREFIX//}
 +
 +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
 +.else
 +AP_PORT?=	apache13
 +.if ${AP_PORT} == "apache13-ssl"
 +AP_TARGET?=	httpsd
 +.else
 +AP_TARGET?=	httpd
 +.endif
 +AP_SBINDIR?=	${PREFIX}/sbin
 +AP_INCLUDE?=	${PREFIX}/include/apache
 +AP_LIBEXEC?=	${PREFIX}/libexec/apache
 +AP_SYSCONF?=	${PREFIX}/etc/apache
 +AP_PREFIX?=	${PREFIX}
 +.endif
 +
 +.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}
 +
 +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}\///}
 +.endif
 +
  .if defined(USE_BZIP2)
  BUILD_DEPENDS+=		bzip2:${PORTSDIR}/archivers/bzip2
  .endif
 @@ -2831,7 +2893,7 @@
  .endif
  
  .if !defined(NOPRECIOUSMAKEVARS)
 -.for softvar in CKSUMFILES _MLINKS PKGBASE
 +.for softvar in CKSUMFILES _MLINKS PKGBASE _AP_PATHS
  .if defined(${softvar})
  __softMAKEFLAGS+=      '${softvar}+=${${softvar}:S/'/'\''/g}'
  .endif
 


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?200006030420.VAA50100>