From alex@vaio.alexdupre.com  Tue Oct  7 06:19:31 2003
Return-Path: <alex@vaio.alexdupre.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP
	id 62B1416A4B3; Tue,  7 Oct 2003 06:19:31 -0700 (PDT)
Received: from relay.gufi.org (civetta.gufi.org [212.110.23.10])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id DD47944051; Tue,  7 Oct 2003 06:19:17 -0700 (PDT)
	(envelope-from alex@vaio.alexdupre.com)
Received: from vaio.alexdupre.com (host245-49.pool8288.interbusiness.it [82.88.49.245])
	by relay.gufi.org (Postfix) with ESMTP
	id DF19720FA1; Tue,  7 Oct 2003 15:19:15 +0200 (CEST)
Received: from vaio.alexdupre.com (localhost [127.0.0.1])
	by vaio.alexdupre.com (8.12.9/8.12.9) with ESMTP id h97DJFbB076013;
	Tue, 7 Oct 2003 15:19:15 +0200 (CEST)
	(envelope-from alex@vaio.alexdupre.com)
Received: (from alex@localhost)
	by vaio.alexdupre.com (8.12.9/8.12.9/Submit) id h97DJEwt076012;
	Tue, 7 Oct 2003 15:19:14 +0200 (CEST)
Message-Id: <200310071319.h97DJEwt076012@vaio.alexdupre.com>
Date: Tue, 7 Oct 2003 15:19:14 +0200 (CEST)
From: Alex Dupre <sysadmin@alexdupre.com>
Reply-To: Alex Dupre <sysadmin@alexdupre.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc: nork@freebsd.org, roam@freebsd.org
Subject: Add USE_APACHE knob to bsd.port.mk.
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         57698
>Category:       ports
>Synopsis:       Add USE_APACHE knob to bsd.port.mk.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    portmgr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 07 06:20:06 PDT 2003
>Closed-Date:    Sat Nov 15 12:50:27 PST 2003
>Last-Modified:  Sat Nov 15 12:50:27 PST 2003
>Originator:     Alex Dupre
>Release:        FreeBSD 4.9-ALEXDUPRE i386
>Organization:
>Environment:
System: FreeBSD 4.9-ALEXDUPRE i386
>Description:
Add support in bsd.port.mk for Apache dependency.
Define USE_APACHE in ports to enable the dependency.
Define WANT_APACHE_VER if the port run only with a specific version.
User can set WITH_APACHE_VER to choose the version (and portdir) or
fallback to autodetect or DEFAULT_APACHE_VER.

This patch is required for the next mega-patch to php ports.
>How-To-Repeat:
>Fix:

--- bsd.port.mk.diff begins here ---
--- bsd.port.mk.orig	Tue Oct  7 11:45:46 2003
+++ bsd.port.mk	Tue Oct  7 12:46:34 2003
@@ -357,6 +357,13 @@
 #					  If set to an unkown value, the port is marked BROKEN.
 #
 ##
+# USE_APACHE		- Add Apache web server dependency.
+#
+# DEFAULT_APACHE_VER	- Default Apache version. Can be overriden within a
+#			  port. Default: 2.
+# WANT_APACHE_VER	- Says that the port requires this version. Legal
+#			  values: 13, 2.
+##
 # USE_JAVA		- Says that the port relies on the Java language.
 #				  Implies inclusion of bsd.java.mk.  (Also see
 #				  that file for more information on USE_JAVA_*).
@@ -1045,6 +1052,34 @@
 BROKEN=		"unknown OpenLDAP version: ${WANT_OPENLDAP_VER}"
 .endif
 .endif
+
+.if defined(USE_APACHE)
+DEFAULT_APACHE_VER?=	2
+
+# Setting/finding Apache version we want.
+.if defined(WANT_APACHE_VER)
+APACHE_VER=	${WANT_APACHE_VER}
+.elif defined(WITH_APACHE_VER)
+APACHE_VER=	${WITH_APACHE_VER}
+.elif exists(${LOCALBASE}/include/apache2/apr.h)
+APACHE_VER=	2
+.elif exists(${LOCALBASE}/include/apache/ap.h)
+APACHE_VER=	13
+.else
+APACHE_VER=	${DEFAULT_APACHE_VER}
+.endif # WANT_APACHE
+
+APXS?=		${LOCALBASE}/sbin/apxs
+APACHE_PORT?=	${PORTSDIR}/www/apache${APACHE_VER}
+
+# And now we are checking if we can use it
+.if exists(${APACHE_PORT})
+BUILD_DEPENDS+=	${APXS}:${APACHE_PORT}
+RUN_DEPENDS+=	${APXS}:${APACHE_PORT}
+.else
+BROKEN=		"unknown Apache version: ${APACHE_VER}"
+.endif # Check for correct deps
+.endif # USE_APACHE
 
 .if defined(EMACS_PORT_NAME)
 .include "${PORTSDIR}/Mk/bsd.emacs.mk"
--- bsd.port.mk.diff ends here ---


>Release-Note:
>Audit-Trail:

From: Peter Pentchev <roam@ringlet.net>
To: Alex Dupre <sysadmin@alexdupre.com>
Cc: bug-followup@FreeBSD.org, nork@FreeBSD.org
Subject: Re: ports/57698: Add USE_APACHE knob to bsd.port.mk.
Date: Tue, 7 Oct 2003 16:28:39 +0300

 On Tue, Oct 07, 2003 at 03:19:14PM +0200, Alex Dupre wrote:
 > 
 > >Number:         57698
 > >Category:       ports
 > >Synopsis:       Add USE_APACHE knob to bsd.port.mk.
 > >Originator:     Alex Dupre
 [snip]
 
 Good work!  Just...
 
 > +# WANT_APACHE_VER	- Says that the port requires this version. Legal
 > +#			  values: 13, 2.
 
 ...how about the rest of the Apache ports, like apache13+ipv6,
 apache13-fp, apache13-modssl, russian/apache13*, etc? :)
 
 G'luck,
 Peter
 
 -- 
 Peter Pentchev	roam@ringlet.net    roam@sbnd.net    roam@FreeBSD.org
 PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
 Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
 This sentence no verb.
Responsible-Changed-From-To: freebsd-ports-bugs->portmgr 
Responsible-Changed-By: erwin 
Responsible-Changed-When: Tue Oct 7 06:32:45 PDT 2003 
Responsible-Changed-Why:  
portmgr territory 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57698 

From: Alex Dupre <sysadmin@alexdupre.com>
To: Peter Pentchev <roam@ringlet.net>
Cc: bug-followup@FreeBSD.org, nork@FreeBSD.org
Subject: Re: ports/57698: Add USE_APACHE knob to bsd.port.mk.
Date: Tue, 7 Oct 2003 15:34:57 +0200

 Tuesday, October 7, 2003, 3:28:39 PM, you wrote:
 
 >> +# WANT_APACHE_VER    - Says that the port requires this version. Legal
 >> +#                      values: 13, 2.
 
 PP> ...how about the rest of the Apache ports, like apache13+ipv6,
 PP> apache13-fp, apache13-modssl, russian/apache13*, etc? :)
 
 One can easily set WITH_APACHE_VER=13-modssl (I didn't list all the
 possibilities, only the base ones). In case of russian you may still
 override the APACHE_PORT variable at a later stage, like
 APACHE_PORT=${PORTSDIR}/russian/apache13
 
 -- 
 Alex Dupre                             sysadmin@alexdupre.com
 http://www.alexdupre.com/              alex@sm.FreeBSD.org
 
 Today's excuse: We're upgrading /dev/null
 
 

From: Oliver Eikemeier <eikemeier@fillmore-labs.com>
To: Alex Dupre <sysadmin@alexdupre.com>
Cc: FreeBSD-gnats-submit@FreeBSD.org, roam@FreeBSD.org,
	nork@FreeBSD.org
Subject: Re: ports/57698: Add USE_APACHE knob to bsd.port.mk.
Date: Tue, 07 Oct 2003 15:45:08 +0200

 Hi Alex,
 
 great work, thanks. Please allow me to make a few remarks:
 
 > +# USE_APACHE		- Add Apache web server dependency.
 > +#
 > +# DEFAULT_APACHE_VER	- Default Apache version. Can be overriden within a
 > +#			  port. Default: 2.
 Is WANT_APACHE_VER with an default value when empty not enough?
 
 > +# WANT_APACHE_VER	- Says that the port requires this version. Legal
 > +#			  values: 13, 2.
 It would be great if I could chose apache13-modssl, apache13-ssl, apache13+ipv6,
 apache13-fp, russian/apache13 and russian/apache13-modssl here. Perhaps
 something like WANT_APACHE_PORT?
 
 > [...]
 >  
 >  .if defined(EMACS_PORT_NAME)
 >  .include "${PORTSDIR}/Mk/bsd.emacs.mk"
 
 Please try to put as much as you can in the bsd.port.post.mk section. I had to
 learn the hard way that stuff in the pre- section causes lots of accidental errors.
 
 

From: Alex Dupre <sysadmin@alexdupre.com>
To: Oliver Eikemeier <eikemeier@fillmore-labs.com>
Cc: FreeBSD-gnats-submit@FreeBSD.org, roam@FreeBSD.org,
	nork@FreeBSD.org
Subject: Re: ports/57698: Add USE_APACHE knob to bsd.port.mk.
Date: Tue, 7 Oct 2003 16:00:03 +0200

 Tuesday, October 7, 2003, 3:45:08 PM, you wrote:
 
 >> +# USE_APACHE         - Add Apache web server dependency.
 >> +#
 >> +# DEFAULT_APACHE_VER - Default Apache version. Can be overriden within a
 >> +#                      port. Default: 2.
 OE> Is WANT_APACHE_VER with an default value when empty not enough?
 
 WANT means "require". Default is a suggested version if apache is not
 already installed.
 
 >> +# WANT_APACHE_VER    - Says that the port requires this version. Legal
 >> +#                      values: 13, 2.
 OE> It would be great if I could chose apache13-modssl, apache13-ssl, apache13+ipv6,
 OE> apache13-fp, russian/apache13 and russian/apache13-modssl here. Perhaps
 OE> something like WANT_APACHE_PORT?
 
 Look at my reply to roam/gnats for this.
 
 OE> Please try to put as much as you can in the bsd.port.post.mk section. I had to
 OE> learn the hard way that stuff in the pre- section causes lots of accidental errors.
 
 Nothing can be inserted in the post, it's all needed before.
 
 -- 
 Alex Dupre                             sysadmin@alexdupre.com
 http://www.alexdupre.com/              alex@sm.FreeBSD.org
 
 Today's excuse: Incorrect time synchronization
 
 

From: dirk.meyer@dinoex.sub.org (Dirk Meyer)
To: freebsd-gnats-submit@FreeBSD.org, sysadmin@alexdupre.com
Cc:  
Subject: Re: ports/57698: Add USE_APACHE knob to bsd.port.mk.
Date: Tue, 07 Oct 2003 18:48:00 +0200

 This patch does neither work with www/apache13-modssl,
 nor with russian/apache13 russian/apache13-modssl
 
 its duplicate of ports/32604
 
 Please see mega patch:
 http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/32604
 
 I have a newer patch ready, post it after 4.9 RELEASE is out.
 
 kind regards Dirk
 
 - Dirk Meyer, Im Grund 4, 34317 Habichtswald, Germany
 - [dirk.meyer@dinoex.sub.org],[dirk.meyer@guug.de],[dinoex@FreeBSD.org]

From: Oliver Eikemeier <eikemeier@fillmore-labs.com>
To: Alex Dupre <sysadmin@alexdupre.com>
Cc: FreeBSD-gnats-submit@FreeBSD.org, roam@FreeBSD.org,
	nork@FreeBSD.org, Dirk Meyer <dirk.meyer@dinoex.sub.org>
Subject: Re: ports/57698: Add USE_APACHE knob to bsd.port.mk.
Date: Tue, 07 Oct 2003 19:22:21 +0200

 I was thinking of something like:
 
 --- bsd.port.mk.patch begins here ---
 --- bsd.port.mk.orig	3 Sep 2003 19:50:24 -0000
 +++ bsd.port.mk	7 Oct 2003 17:00:47 -0000
 @@ -1082,6 +1082,15 @@
  # Location of mounted CDROM(s) to search for files
  CD_MOUNTPTS?=	/cdrom ${CD_MOUNTPT}
  
 +.if exists(${LOCALBASE}/include/apache2/apr.h)
 +WANT_APACHE_PORT?=	www/apache2
 +.elif exists(${LOCALBASE}/include/apache/ap.h)
 +WANT_APACHE_PORT?=	www/apache13
 +.else
 +WANT_APACHE_PORT?=	www/apache2
 +.endif
 +APACHE_APXS?=		${LOCALBASE}/sbin/apxs
 +
  .endif
  # End of pre-makefile section.
  
 @@ -1519,6 +1528,41 @@
  .if defined(USE_PERL5) || defined(USE_PERL5_RUN)
  RUN_DEPENDS+=	${PERL5}:${PORTSDIR}/lang/${PERL_PORT}
  .endif
 +.endif
 +
 +.if defined(USE_APACHE)
 +.if exists(${PORTSDIR}/${WANT_APACHE_PORT}/Makefile)
 +BUILD_DEPENDS+=		${APACHE_APXS}:${PORTSDIR}/${WANT_APACHE_PORT}
 +RUN_DEPENDS+=		${APACHE_APXS}:${PORTSDIR}/${WANT_APACHE_PORT}
 +APACHE_CGI_BIN?=	${PREFIX}/www/cgi-bin
 +.if ${WANT_APACHE_PORT} == "russian/apache13" || ${WANT_APACHE_PORT} == "russian/apache13-modssl"
 +APACHE_DOCROOT?=	${PREFIX}/share/doc/apache
 +.elif ${WANT_APACHE_PORT} == "www/apache13-ssl"
 +APACHE_DOCROOT?=	${PREFIX}/www/htdocs
 +.else
 +APACHE_DOCROOT?=	${PREFIX}/www/data
 +.endif
 +.if ${WANT_APACHE_PORT:C/[a-z0-9]+\/apache([0-9]+).*/\1/} == "2"
 +APACHE_ETC?=		${PREFIX}/etc/apache2
 +APACHE_LIBEXEC?=	${PREFIX}/libexec/apache2
 +.elif ${WANT_APACHE_PORT:C/[a-z0-9]+\/apache([0-9]+).*/\1/} == "13"
 +APACHE_ETC?=		${PREFIX}/etc/apache
 +APACHE_LIBEXEC?=	${PREFIX}/libexec/apache
 +.elif !defined(APACHE_ETC) || !defined(APACHE_LIBEXEC)
 +BROKEN=			"you must define APACHE_ETC and APACHE_LIBEXEC"
 +.endif
 +PLIST_SUB+=		APACHE_DOCROOT="${APACHE_DOCROOT:S,^${PREFIX}/,,}" \
 +			APACHE_CGI_BIN="${APACHE_CGI_BIN:S,^${PREFIX}/,,}" \
 +			APACHE_ETC="${APACHE_ETC:S,^${PREFIX}/,,}" \
 +			APACHE_LIBEXEC="${APACHE_LIBEXEC:S,^${PREFIX}/,,}"
 +.else
 +BROKEN=			"unknown Apache port: ${WANT_APACHE_PORT}"
 +.endif
 +.else
 +PLIST_SUB+=		APACHE_DOCROOT="@comment " \
 +			APACHE_CGI_BIN="@comment " \
 +			APACHE_ETC="@comment " \
 +			APACHE_LIBEXEC="@comment "
  .endif
  
  .if defined(USE_MYSQL)
 --- bsd.port.mk.patch ends here ---
 
 Where the main part is in bsd.port.post.mk. Btw, I'm pretty sure that I've got
 APACHE_DOCROOT wrong, but you get the idea.
 
 For example you can do:
 
 .include <bsd.port.pre.mk>
 .if defined(WITH_APACHE) || (exists(${APACHE_APXS}) && !defined(WITHOUT_APACHE))
 USE_APACHE=	yes
 .endif
 
 Regards
     Oliver
 

From: Clement Laforet <sheepkiller@cultdeadsheep.org>
To: Oliver Eikemeier <eikemeier@fillmore-labs.com>
Cc: Alex Dupre <sysadmin@alexdupre.com>, roam@FreeBSD.org,
	nork@FreeBSD.org, Dirk Meyer <dirk.meyer@dinoex.sub.org>,
	FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: ports/57698: Add USE_APACHE knob to bsd.port.mk.
Date: Tue, 7 Oct 2003 23:26:55 +0200

 >
 > I was thinking of something like:
 > +.if exists(${LOCALBASE}/include/apache2/apr.h)
 > +WANT_APACHE_PORT?=	www/apache2
 > +.elif exists(${LOCALBASE}/include/apache/ap.h)
 > +WANT_APACHE_PORT?=	www/apache13
 > +.else
 > +WANT_APACHE_PORT?=	www/apache2
 > +.endif
 > +APACHE_APXS?=		${LOCALBASE}/sbin/apxs
 
 Hummmm, setting apache2 as default apache is a bad idea I think, most of
 useful module aren't support by apache2 yet.
 apache21 ports is pending, And for the moment it has the same hier as
 apache2. It can be changed.
 
 >  .endif
 >  # End of pre-makefile section.
 >  
 > @@ -1519,6 +1528,41 @@
 >  .if defined(USE_PERL5) || defined(USE_PERL5_RUN)
 >  RUN_DEPENDS+=	${PERL5}:${PORTSDIR}/lang/${PERL_PORT}
 >  .endif
 > +.endif
 > +
 > +.if defined(USE_APACHE)
 > +.if exists(${PORTSDIR}/${WANT_APACHE_PORT}/Makefile)
 > +BUILD_DEPENDS+=		${APACHE_APXS}:${PORTSDIR}/${WANT_APACHE_PORT}
 > +RUN_DEPENDS+=		${APACHE_APXS}:${PORTSDIR}/${WANT_APACHE_PORT}
 > +APACHE_CGI_BIN?=	${PREFIX}/www/cgi-bin
 > +.if ${WANT_APACHE_PORT} == "russian/apache13" || ${WANT_APACHE_PORT}
 > == "russian/apache13-modssl"+APACHE_DOCROOT?=	${PREFIX}/share/doc/apache
 > +.elif ${WANT_APACHE_PORT} == "www/apache13-ssl"
 > +APACHE_DOCROOT?=	${PREFIX}/www/htdocs
 > +.else
 > +APACHE_DOCROOT?=	${PREFIX}/www/data
 
 Before adding USE_APACHE, it would be great is apache* ports have the
 same layout.
 In apache13-ssl case, it's planned for the end of the month, since I
 noticed users that apache13-ssl will be sync'ed with classic layout.
 
 regards,
 clem
State-Changed-From-To: open->closed 
State-Changed-By: marcus 
State-Changed-When: Sat Nov 15 12:50:02 PST 2003 
State-Changed-Why:  
USE_APACHE has been added to bsd.port.mk via another patch by dinoex@. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57698 
>Unformatted:
