Skip site navigation (1)Skip section navigation (2)
Date:      Sat,  3 Dec 2005 22:20:09 +0100 (CET)
From:      Melvyn Sopacua <melvyn@melvyn.homeunix.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        PHP_Include_MAINTAINER <ale@FreeBSD.org>
Subject:   ports/89896: [PATCH] Add support for multiple versions of php
Message-ID:  <20051203212009.879491146C@sarevok.lan.melvyn.homeunix.org>
Resent-Message-ID: <200512032130.jB3LU3dU091991@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         89896
>Category:       ports
>Synopsis:       [PATCH] Add support for multiple versions of php
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Dec 03 21:30:02 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Melvyn Sopacua
>Release:        FreeBSD 5.4-STABLE i386
>Organization:
>Environment:
System: FreeBSD sarevok.lan.melvyn.homeunix.org 5.4-STABLE FreeBSD 5.4-STABLE #3: Sun Nov 20 03:52:04 CET 2005 root@sarevok.lan.ginseng.game-server.cc:/usr/obj/usr/src/sys/GENERIC i386


	
>Description:
	Currently, only one version of php can be installed using ports. This patch
	adds support to install both php4 and php5 using the ports system, for people
	that know what they're doing(tm).
	While it is possible, to install a different version by yourself, this does
	not take advantage of the patches and research done by the ports maintainers as
	well as portaudit's security features.
>How-To-Repeat:
	Install php4 and try to install php5 with extensions.
>Fix:

	Using the following MAKE_ARGS in pkgtools.conf and provided patch it is now
	possible to have a 'stable' apache/php4 installation in ${LOCALBASE} and an
	'expirimental' installation in /usr/local/apache2. Very convenient for
	developers who want to test the code on their laptops by just changing the
	port number of the website :p

	MAKE_ARGS = {
	'*/php5-*'	=> [
				'DISABLE_CONFLICTS=yes',
				'PHP_PREFIX=/usr/local/apache2',
			],
	'lang/php5'	=> [
				'WITH_APACHE2=yes',
				'APXS=/usr/local/apache2/sbin/apxs',
				'PREFIX=/usr/local/apache2',
				'DISABLE_CONFLICTS=yes',
			],
	'www/apache2*'	=> [
				'DISABLE_CONFLICTS=yes',
				'PREFIX=/usr/local/apache2',
			],
	}

	Patch:
Index: bsd.php.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.php.mk,v
retrieving revision 1.20
diff -u -r1.20 bsd.php.mk
--- bsd.php.mk	20 Nov 2005 20:35:40 -0000	1.20
+++ bsd.php.mk	3 Dec 2005 21:10:36 -0000
@@ -29,14 +29,20 @@
 # WANT_PHP_WEB=yes  - Want the Apache Module or the CGI version of PHP.
 # WANT_PHP_PEAR=yes - Want the PEAR framework.
 #
+# User tunable:
+# PHP_PREFIX        - Prefix for the used version of php. Defaults to $LOCALBASE
+# APACHE_PREFIX     - Prefix for apache. Defaults to $PHP_PREFIX
+#
 # You may combine multiple WANT_PHP_* knobs.
 # Don't specify any WANT_PHP_* knob if your port will work with every PHP SAPI.
 #
 
 PHP_Include_MAINTAINER=	ale@FreeBSD.org
+PHP_PREFIX?=${LOCALBASE}
+APACHE_PREFIX?=${PHP_PREFIX}
 
-.if exists(${LOCALBASE}/etc/php.conf)
-.include "${LOCALBASE}/etc/php.conf"
+.if exists(${PHP_PREFIX}/etc/php.conf)
+.include "${PHP_PREFIX}/etc/php.conf"
 .endif
 
 DEFAULT_PHP_VER?=	4
@@ -48,8 +54,8 @@
 .else
 PHP_EXT_DIR=	20041030
 .endif
-.if exists(${LOCALBASE}/include/apache2/httpd.h)
-APXS?=		${LOCALBASE}/sbin/apxs
+.if exists(${APACHE_PREFIX}/include/apache2/httpd.h)
+APXS?=		${APACHE_PREFIX}/sbin/apxs
 APACHE_MPM!=	${APXS} -q MPM_NAME
 .if ${APACHE_MPM} == "worker"
 PHP_EXT_DIR:=	${PHP_EXT_DIR}-zts
@@ -160,18 +166,18 @@
 .endif
 
 .if defined(USE_PHP_BUILD)
-BUILD_DEPENDS+=	${LOCALBASE}/include/php/main/php.h:${PHP_PORT}
+BUILD_DEPENDS+=	${PHP_PREFIX}/include/php/main/php.h:${PHP_PORT}
 .endif
-RUN_DEPENDS+=	${LOCALBASE}/include/php/main/php.h:${PHP_PORT}
+RUN_DEPENDS+=	${PHP_PREFIX}/include/php/main/php.h:${PHP_PORT}
 
 PLIST_SUB+=	PHP_EXT_DIR=${PHP_EXT_DIR}
 SUB_LIST+=	PHP_EXT_DIR=${PHP_EXT_DIR}
 
 .if defined(USE_PHPIZE) || defined(USE_PHPEXT)
-BUILD_DEPENDS+=	phpize:${PHP_PORT}
+BUILD_DEPENDS+=	${PHP_PREFIX}/bin/phpize:${PHP_PORT}
 GNU_CONFIGURE=	YES
 USE_AUTOTOOLS+=	autoconf:259:env
-CONFIGURE_ARGS+=--with-php-config=${LOCALBASE}/bin/php-config
+CONFIGURE_ARGS+=--with-php-config=${PHP_PREFIX}/bin/php-config
 
 configure-message: phpize-message do-phpize
 
@@ -179,12 +185,13 @@
 	@${ECHO_MSG} "===>  PHPizing for ${PKGNAME}"
 
 do-phpize:
-	@(cd ${WRKSRC}; ${SETENV} ${SCRIPTS_ENV} ${LOCALBASE}/bin/phpize)
+	@(cd ${WRKSRC}; ${SETENV} ${SCRIPTS_ENV} ${PHP_PREFIX}/bin/phpize)
 .endif
 
 .if defined(USE_PHPEXT)
 PHP_MODNAME?=	${PORTNAME}
 PHP_HEADER_DIRS?=	""
+PREFIX=${PHP_PREFIX}
 
 do-install:
 	@${MKDIR} ${PREFIX}/lib/php/${PHP_EXT_DIR}
@@ -341,9 +348,9 @@
 .		if ${_USE_PHP_VER${PHP_VER}:M${extension}} != ""
 .			if ${PHP_EXT_INC:M${extension}} == ""
 .				if defined(USE_PHP_BUILD)
-BUILD_DEPENDS+=	${LOCALBASE}/lib/php/${PHP_EXT_DIR}/${extension}.so:${PORTSDIR}/${${extension}_DEPENDS}
+BUILD_DEPENDS+=	${PHP_PREFIX}/lib/php/${PHP_EXT_DIR}/${extension}.so:${PORTSDIR}/${${extension}_DEPENDS}
 .				endif
-RUN_DEPENDS+=	${LOCALBASE}/lib/php/${PHP_EXT_DIR}/${extension}.so:${PORTSDIR}/${${extension}_DEPENDS}
+RUN_DEPENDS+=	${PHP_PREFIX}/lib/php/${PHP_EXT_DIR}/${extension}.so:${PORTSDIR}/${${extension}_DEPENDS}
 .			endif
 .		else
 isyes=		${extension}
>Release-Note:
>Audit-Trail:
>Unformatted:



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