Bug 57698

Summary: Add USE_APACHE knob to bsd.port.mk.
Product: Ports & Packages Reporter: Alex Dupre <sysadmin>
Component: Individual Port(s)Assignee: Port Management Team <portmgr>
Status: Closed FIXED    
Severity: Affects Only Me CC: nork
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
bsd.port.mk.diff none

Description Alex Dupre 2003-10-07 14:20:06 UTC
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.
Comment 1 Peter Pentchev 2003-10-07 14:28:39 UTC
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.
Comment 2 Erwin Lansing freebsd_committer freebsd_triage 2003-10-07 14:32:45 UTC
Responsible Changed
From-To: freebsd-ports-bugs->portmgr

portmgr territory
Comment 3 Alex Dupre 2003-10-07 14:34:57 UTC
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
Comment 4 Oliver Eikemeier 2003-10-07 14:45:08 UTC
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.
Comment 5 Alex Dupre 2003-10-07 15:00:03 UTC
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
Comment 6 dirk.meyer 2003-10-07 17:48:00 UTC
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]
Comment 7 Oliver Eikemeier 2003-10-07 18:22:21 UTC
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
Comment 8 Clement Laforet 2003-10-07 22:26:55 UTC
>
> 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
Comment 9 Joe Marcus Clarke freebsd_committer freebsd_triage 2003-11-15 20:50:02 UTC
State Changed
From-To: open->closed

USE_APACHE has been added to bsd.port.mk via another patch by dinoex@.