#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#pragma ident "@(#)Makefile.sfw 1.27 09/09/30 SMI"
PHP_REL=5.2
#
# This value is generated based on the NAME and VERSION values in the METADATA
# file in this directory. You should not update it directly, instead update
# the METADATA file values that it is derived from.
#
PHP_VER=$(COMPONENT_VERSION:sh)
PHP_DIR=php-$(PHP_VER)
PHP_CGI=$(PHP_DIR)-cgi
PHP_CGI_BIN=$(PWD)/$(PHP_DIR)-cgi/sapi/cgi/php-cgi
TOP_DIR=/usr/php/$(PHP_REL)
CONF_DIR=/etc/php/$(PHP_REL)
PEAR_DIR=/var/php/$(PHP_REL)/pear
SAMPLES_DIR=$(TOP_DIR)/samples
MYSQL_VERSION=5.1
MYSQL_DIR=/usr/mysql/$(MYSQL_VERSION)
MYSQL_LIBDIR=$(MYSQL_DIR)/lib/mysql
SUHOSIN_VERSION=0.9.29
SUHOSIN_DIR=suhosin-$(SUHOSIN_VERSION)
TCPWRAP_VERSION=1.1.3
TCPWRAP_DIR=tcpwrap-$(TCPWRAP_VERSION)
IDN_VERSION=0.2.0
IDN_DIR=idn-$(IDN_VERSION)
DTRACE_VERSION=1.0.3
DTRACE_DIR=dtrace-$(DTRACE_VERSION)
APC_VERSION=3.0.19
APC_DIR=APC-$(APC_VERSION)
XDEBUG_VERSION=2.0.5
XDEBUG_DIR=xdebug-$(XDEBUG_VERSION)
MEMCACHE_VERSION=2.2.5
MEMCACHE_DIR=memcache-$(MEMCACHE_VERSION)
IMAP_CLIENT_VERSION=-2007e
IMAP_CLIENT_DIR=$(PWD)/imap$(IMAP_CLIENT_VERSION)/c-client
IMAP_DIR=$(PWD)/imap$(IMAP_CLIENT_VERSION)
PHP_LFS=-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
PHP_CFLAGS_i386=-xjobs=16
PHP_CFLAGS_sparc=-dalign -xjobs=16
PHP_CFLAGS=-fsimple=2 -xnorunpath -xO4 -xalias_level=basic -xipo=0 \
-xlibmopt -xprefetch_level=1 -xprefetch=auto -xstrconst -zlazyload
all: build_php build_php_extensions
test: test_php
install: install_php install_php_extensions
ksh93 ./install-php5
clean: clean_php clean_php_extensions clean_pear
-rm -f php-config-proto phpize-proto package.xml package2.xml \
phpize php-config php.ini-patched
clean_php:
-rm -rf $(PHP_DIR) $(PHP_CGI) $(IMAP_DIR) \
$(ROOT)/$(TOP_DIR) $(ROOT)/$(CONF_DIR)
clean_php_extensions:
-rm -rf $(SUHOSIN_DIR) $(TCPWRAP_DIR) $(IDN_DIR) $(DTRACE_DIR) \
$(APC_DIR) $(XDEBUG_DIR) $(MEMCACHE_DIR)
clean_pear:
-rm -rf $(ROOT)/$(PEAR_DIR)
include ../Makefile.cmd
include $(SRC)/cmd/apache2/apache.build.env
PRECONF_ENVLINE= \
PATH=/usr/gnu/bin:/usr/bin \
MAKE=$(GMAKE)
CONF_ENVLINE=CC=$(CC) \
CXX=$(CCC) \
LD="$(CCC) -norunpath" \
CPPFLAGS="-I../CPPFLAGSTEST -D_POSIX_PTHREAD_SEMANTICS" \
CFLAGS="$(CFLAGS) $(PHP_LFS) $(PHP_CFLAGS) $(PHP_CFLAGS_$(MACH))" \
LDFLAGS="-L$(ROOT)/usr/postgres/8.3/lib -L$(ROOT)$(MYSQL_LIBDIR)" \
LIBS="-lsocket -lnsl -ldl -lposix4" \
EXTENSION_DIR=/usr/php/$(PHP_REL)/modules \
PHP_PEAR_CACHE_DIR=/var/tmp/pear/cache \
PHP_PEAR_DOWNLOAD_DIR=/var/tmp/pear/cache \
PHP_PEAR_EXTENSION_DIR=/var/php/$(PHP_REL)/modules \
PHP_PEAR_INSTALL_DIR=/var/php/$(PHP_REL)/pear \
PHP_PEAR_SIG_BIN=/usr/gnu/bin/gpg \
PATH=$(SFW_PATH) \
MAKE=$(CCSMAKE) \
DESTDIR=$(ROOT) \
INSTALL_ROOT=$(ROOT) \
INSTALL=/usr/ucb/install
ENVLINE= \
LD_OPTIONS="-M $(SRC)/cmd/mapfile_noexstk" \
$(CONF_ENVLINE)
# ----- Main PHP Targets -----
#
# SAPI Support
# ------------
# The various SAPI configure options are mutually exclusive. This means
# that a separate './configure ; make' build cycle must be done for each SAPI
# which needs to be built.
#
# Currently mod_php (for Apache) and fast/cgi support get built.
#
# The source tree extracted into $(PHP_DIR) is the primary build tree. It
# is used to build not only mod_php but also all other extensions. The main
# install target is invoked only in this tree.
#
# The $(PHP_CGI) source tree is used only to build fast/cgi support and
# only files relevant to that feature are installed off this tree.
#
#
# Configuration Notes
# -------------------
#
# The following flags appear to build fine today but are not yet included:
#
# --with-pspell=shared \ LSARC/2006/231 obsoleted SUNWaspell
#
# The following flags can't be built with components available in sfw today.
# These can be added as the dependencies become available.
# See here for dependency info:
# http://mail.opensolaris.org/pipermail/webstack-discuss/2007-August/000146.html
#
# --with-gdbm W - DEP.2
#
# --with-gmp W - DEP.3
#
# --with-ldap-sasl W - DEP.5
#
# --enable-embedded-mysqli E - DEP.6
#
# --with-mssql W - DEP.7
# --with-pdo-dblib W - DEP.7
#
# --with-ncurses W - DEP.8
#
# --with-pdo-odbc W,unixODBC - DEP.9
#
# --with-snmp W - DEP.11
# --enable-ucd-snmp-hack
#
# --with-unixODBC
build_imap: $(IMAP_CLIENT_DIR)/libc-client.a
build_php: build_imap $(PHP_DIR)/config.status
# Building main PHP source tree
(cd $(PHP_DIR); env - $(ENVLINE) $(CCSMAKE) -e all)
# Building fast/cgi support tree
(cd $(PHP_CGI); env - $(ENVLINE) $(CCSMAKE) -e all)
test_php: build_php
(cd $(PHP_CGI); env - $(ENVLINE) $(CCSMAKE) -e test)
install_php: clean_pear build_php
mkdir -p $(ROOT)/var/tmp/pear/cache
(cd $(PHP_DIR); env - $(ENVLINE) $(CCSMAKE) -e install)
# The following options are shared by the different SAPI compilation targets:
COMMON_CONFIG_OPTIONS= \
--bindir=$(TOP_DIR)/bin \
--datadir=$(TOP_DIR)/share \
--disable-dbase \
--disable-debug \
--disable-dmalloc \
--disable-inline-optimization \
--disable-libgcc \
--disable-libtool-lock \
--disable-rpath \
--disable-static \
--enable-bcmath \
--enable-calendar \
--enable-ctype \
--enable-cli \
--enable-dom \
--enable-dtrace \
--enable-exif \
--enable-flatfile \
--enable-filter \
--enable-gd-jis-conv \
--enable-gd-native-ttf \
--enable-hash \
--enable-inifile \
--enable-ipv6 \
--enable-json \
--enable-magic-quotes \
--enable-mbregex \
--enable-mbstring \
--enable-mod-charset \
--enable-pcntl \
--enable-posix \
--enable-reflection \
--with-libxml-dir=/usr \
--enable-libxml \
--enable-sqlite-utf8 \
--enable-session \
--enable-shared \
--enable-shmop \
--enable-short-tags \
--enable-simplexml \
--enable-soap \
--enable-sockets \
--enable-spl \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-tokenizer \
--enable-xml \
--enable-xmlreader \
--enable-xmlwriter \
--enable-zend-multibyte \
--enable-zip \
--exec-prefix=$(TOP_DIR) \
--includedir=$(TOP_DIR)/include \
--libdir=$(TOP_DIR)/lib \
--libexecdir=$(TOP_DIR)/modules \
--mandir=$(TOP_DIR)/man \
--oldincludedir=$(TOP_DIR)/share \
--prefix=$(TOP_DIR) \
--sbindir=$(TOP_DIR)/sbin \
--sysconfdir=$(CONF_DIR) \
--with-cdb \
--with-config-file-path=$(CONF_DIR) \
--with-config-file-scan-dir=$(CONF_DIR)/conf.d \
--with-exec-dir=$(TOP_DIR)/bin \
--with-freetype-dir=/usr/sfw \
--with-jpeg-dir=/usr \
--with-kerberos \
--with-layout=PHP \
--with-mcrypt=shared,$(ROOT)/usr \
--with-pcre-dir=$(ROOT)/usr \
--with-pcre-regex \
--with-png-dir=/usr \
--with-xmlrpc \
--with-xpm-dir=/usr/openwin \
--with-xsl \
--with-zend-vm=CALL \
--without-dbm \
--without-t1lib
# The following options are used only apache SAPI compilation.
# However, modules compiled as shared can also used by other SAPI's.
$(PHP_DIR)/config.status: $(PHP_DIR)/configure
# Configuring main PHP source tree
(cd $(PHP_DIR); env - $(CONF_ENVLINE) \
LD_LIBRARY_PATH="$(ROOT)/usr/apr/1.3/lib:$(ROOT)/usr/apr-util/1.3/lib" \
./configure \
$(COMMON_CONFIG_OPTIONS) \
--disable-cgi \
--disable-fastcgi \
--enable-discard-path \
--enable-ftp=shared \
--enable-pdo=shared \
--with-apxs2=$(ROOT)$(APACHE_USR_PREFIX)/bin/apxs \
--with-bz2=shared \
--with-curl=shared,$(ROOT)/usr \
--with-curlwrappers \
--with-gd=shared \
--with-gettext=shared \
--with-iconv=shared \
--with-imap=shared,$(IMAP_DIR) \
--with-imap-ssl=shared,$(ROOT)/usr \
--with-ldap=shared \
--with-mysql=shared,$(ROOT)$(MYSQL_DIR) \
--with-mysql-sock=/tmp/mysql.sock \
--with-mysqli=shared,$(ROOT)$(MYSQL_DIR)/bin/mysql_config \
--with-openssl=shared \
--with-pear=$(PEAR_DIR) \
--with-pdo-mysql=shared,$(ROOT)$(MYSQL_DIR) \
--with-pdo-pgsql=shared,$(ROOT)/usr/postgres/8.3 \
--with-pdo-sqlite=shared \
--with-pgsql=shared,$(ROOT)/usr/postgres/8.3 \
--with-sqlite=shared \
--with-tidy=shared,$(ROOT)/usr \
--with-zlib=shared \
--without-tsrm-pthreads )
# Configuring fast/cgi source tree
(cd $(PHP_CGI); env - $(CONF_ENVLINE) \
./configure \
--disable-all \
$(COMMON_CONFIG_OPTIONS) \
--disable-discard-path \
--enable-cgi \
--enable-fastcgi \
--enable-force-cgi-redirect )
$(PHP_DIR)/configure: $(PHP_DIR).tar.bz2
bunzip2 -dc $(PHP_DIR).tar.bz2 | tar xopf -
# avoid running apxs with -a option when installing mod_php
# because we move libphp later
(cd $(PHP_DIR) && \
gpatch -p1 -i ../patches/php_build_config.m4.patch && \
gpatch -p1 -i ../patches/php_dtrace.patch && \
gpatch -p1 -i ../patches/php_Makefile.global.patch && \
gpatch -p1 -i ../patches/php_dl.c.patch && \
gpatch -p1 -i ../patches/php_run-tests.php.patch)
(cd $(PHP_DIR); env - $(PRECONF_ENVLINE) \
./buildconf --force )
(cd $(PHP_DIR); \
cat configure | \
sed -e "s#-i -a -n php5#-i -n php5#" > configure.tmp; \
mv configure configure.orig; \
mv configure.tmp configure; \
chmod 755 configure )
touch $(PHP_DIR)/configure
# duplicate the source tree for fast/cgi compilation
mkdir -p $(PHP_CGI)
(cd $(PHP_DIR); tar cf - .) | (cd $(PHP_CGI); tar xpf -)
# Build IMap C-Client
$(IMAP_CLIENT_DIR)/libc-client.a:
gunzip -dc imap$(IMAP_CLIENT_VERSION).tar.gz | tar xopf -
(cd $(IMAP_DIR) && \
gpatch -p1 -i ../patches/imap_Makefile.patch && \
gpatch -p1 -i ../patches/imap_unix_Makefile.patch && \
gpatch -p1 -i ../patches/imap_os_soln.h.patch && \
gpatch -p1 -i ../patches/imap_flocksim.c.patch )
(cd $(IMAP_DIR); env - \
MAKE=$(CCSMAKE) \
CC=$(CC) \
CFLAGS="$(CFLAGS) $(PHP_LFS) $(PHP_CFLAGS) $(PHP_CFLAGS_$(MACH))" \
$(CCSMAKE) -e soc c-client; \
mv $(IMAP_DIR)/c-client/c-client.a \
$(IMAP_DIR)/c-client/libc-client.a)
# ----- Main extension targets -----
build_php_extensions: extensions_setup \
build_suhosin build_tcpwrap build_idn build_dtrace \
build_apc build_xdebug build_memcache
install_php_extensions: build_php_extensions \
install_suhosin install_tcpwrap install_idn install_dtrace \
install_apc install_xdebug install_memcache
extensions_setup: phpize-proto php-config-proto
phpize-proto: build_php
cat $(PHP_DIR)/scripts/phpize | \
sed -e "s#^prefix=.*#prefix=`pwd`/$(PHP_DIR)#" | \
sed -e "s#^includedir=.*#includedir=`pwd`/$(PHP_DIR)#" | \
sed -e "s#^phpdir=.*#phpdir=`pwd`/$(PHP_DIR)#" | \
sed -e "s#phpdir/phpize.m4#phpdir/scripts/phpize.m4#" | \
sed -e 's#cd "$$phpdir" && cp $$FILES_BUILD "$$builddir"/build#cd "$$phpdir/build" \&\& cp $$FILES_BUILD "$$builddir"/build#' \
> phpize-proto
chmod 755 phpize-proto
php-config-proto: build_php
cat $(PHP_DIR)/scripts/php-config | \
sed -e "s#^prefix=.*#prefix=`pwd`/$(PHP_DIR)#" | \
sed -e "s#^include_dir=.*#include_dir=`pwd`/$(PHP_DIR)#" \
> php-config-proto
chmod 755 php-config-proto
# ----- Extension targets for: suhosin -----
build_suhosin: extensions_setup $(SUHOSIN_DIR)/config.status
(cd $(SUHOSIN_DIR); $(CCSMAKE) -e)
install_suhosin: build_suhosin
/usr/ucb/install $(SUHOSIN_DIR)/modules/suhosin.so \
$(ROOT)/$(TOP_DIR)/modules/
$(SUHOSIN_DIR)/config.status: $(SUHOSIN_DIR)/configure
(cd $(SUHOSIN_DIR); \
env - $(ENVLINE) ../phpize-proto; \
env - $(ENVLINE) sh ./configure \
--enable-suhosin \
--with-php-config=../php-config-proto )
$(SUHOSIN_DIR)/configure: $(SUHOSIN_DIR).tar.gz
gzip -dc $(SUHOSIN_DIR).tar.gz | tar xopf -
touch $(SUHOSIN_DIR)/configure
# ----- Extension targets for: tcpwrap -----
build_tcpwrap: extensions_setup $(TCPWRAP_DIR)/config.status
(cd $(TCPWRAP_DIR); $(CCSMAKE) -e)
install_tcpwrap: build_tcpwrap
/usr/ucb/install $(TCPWRAP_DIR)/modules/tcpwrap.so \
$(ROOT)/$(TOP_DIR)/modules/
$(SRC)/tools/post_process_so $(ROOT)/$(TOP_DIR)/modules/tcpwrap.so
$(TCPWRAP_DIR)/config.status: $(TCPWRAP_DIR)/configure
(cd $(TCPWRAP_DIR); \
env - $(ENVLINE) ../phpize-proto; \
env - $(ENVLINE) sh ./configure \
--with-tcpwrap=$(ROOT)/usr/sfw \
--with-php-config=../php-config-proto )
$(TCPWRAP_DIR)/configure: $(TCPWRAP_DIR).tar.gz
gzip -dc $(TCPWRAP_DIR).tar.gz | tar xopf -
(cd $(TCPWRAP_DIR) && \
gpatch -p1 -i ../patches/tcpwrap_config.patch )
touch $(TCPWRAP_DIR)/configure
# ----- Extension targets for: idn -----
build_idn: extensions_setup $(IDN_DIR)/config.status
(cd $(IDN_DIR); $(CCSMAKE) -e)
install_idn: build_idn
/usr/ucb/install $(IDN_DIR)/modules/idn.so \
$(ROOT)/$(TOP_DIR)/modules/
$(IDN_DIR)/config.status: $(IDN_DIR)/configure
(cd $(IDN_DIR); \
env - $(ENVLINE) ../phpize-proto; \
env - $(ENVLINE) sh ./configure \
--with-idn \
--with-php-config=../php-config-proto )
$(IDN_DIR)/configure: $(IDN_DIR).tar.gz
gzip -dc $(IDN_DIR).tar.gz | tar xopf -
(cd $(IDN_DIR) && \
gpatch -p1 -i ../patches/idn_config.patch)
touch $(IDN_DIR)/configure
# ----- Extension targets for: dtrace -----
build_dtrace: extensions_setup $(DTRACE_DIR)/config.status
(cd $(DTRACE_DIR); $(CCSMAKE) -e)
install_dtrace: build_dtrace
/usr/ucb/install $(DTRACE_DIR)/modules/dtrace.so \
$(ROOT)/$(TOP_DIR)/modules/
$(DTRACE_DIR)/config.status: $(DTRACE_DIR)/configure
(cd $(DTRACE_DIR); \
env - $(ENVLINE) ../phpize-proto; \
env - $(ENVLINE) sh ./configure \
--with-dtrace \
--with-php-config=../php-config-proto )
$(DTRACE_DIR)/configure: $(DTRACE_DIR).tar.gz
gzip -dc $(DTRACE_DIR).tar.gz | tar xopf -
(cd $(DTRACE_DIR); \
gpatch -i ../patches/dtrace.patch)
touch $(DTRACE_DIR)/configure
# ----- Extension targets for: APC -----
build_apc: extensions_setup $(APC_DIR)/config.status
(cd $(APC_DIR); \
$(CCSMAKE) -e)
install_apc: build_apc
/usr/ucb/install $(APC_DIR)/modules/apc.so \
$(ROOT)/$(TOP_DIR)/modules/
mkdir -p $(ROOT)/$(SAMPLES_DIR)/apc/
/usr/ucb/install -m 0555 $(APC_DIR)/apc.php $(ROOT)/$(SAMPLES_DIR)/apc/
$(APC_DIR)/config.status: $(APC_DIR)/configure
(cd $(APC_DIR); \
env - $(ENVLINE) ../phpize-proto; \
env - $(ENVLINE) sh ./configure \
--enable-apc \
--enable-apc-mmap \
--with-php-config=../php-config-proto )
$(APC_DIR)/configure: $(APC_DIR).tar.gz
gzip -dc $(APC_DIR).tar.gz | tar xopf -
(cd $(APC_DIR) && \
gpatch -p1 -i ../patches/apc_pool.c.patch && \
gpatch -p1 -i ../patches/apc_cache.c.patch && \
gpatch -p1 -i ../patches/apc_main.c.patch && \
gpatch -p1 -i ../patches/apc_sem.c.patch )
touch $(APC_DIR)/configure
# ----- Extension targets for: Xdebug -----
build_xdebug: extensions_setup $(XDEBUG_DIR)/config.status
(cd $(XDEBUG_DIR); $(CCSMAKE) -e)
install_xdebug: build_xdebug
/usr/ucb/install $(XDEBUG_DIR)/modules/xdebug.so \
$(ROOT)/$(TOP_DIR)/modules/
$(XDEBUG_DIR)/config.status: $(XDEBUG_DIR)/configure
(cd $(XDEBUG_DIR); \
env - $(ENVLINE) ../phpize-proto; \
env - $(ENVLINE) sh ./configure \
--enable-xdebug \
--with-php-config=../php-config-proto )
$(XDEBUG_DIR)/configure: $(XDEBUG_DIR).tar.gz
gzip -dc $(XDEBUG_DIR).tar.gz | tar xopf -
touch $(XDEBUG_DIR)/configure
# ----- Extension targets for: Memcache -----
build_memcache: extensions_setup $(MEMCACHE_DIR)/config.status
(cd $(MEMCACHE_DIR); $(CCSMAKE) -e)
install_memcache: build_memcache
/usr/ucb/install $(MEMCACHE_DIR)/modules/memcache.so \
$(ROOT)/$(TOP_DIR)/modules/
mkdir -p $(ROOT)/$(SAMPLES_DIR)/memcache/
/usr/ucb/install -m 0555 $(MEMCACHE_DIR)/memcache.php $(ROOT)/$(SAMPLES_DIR)/memcache/
$(MEMCACHE_DIR)/config.status: $(MEMCACHE_DIR)/configure
(cd $(MEMCACHE_DIR); \
env - $(ENVLINE) ../phpize-proto; \
env - $(ENVLINE) sh ./configure \
--disable-debug \
--enable-memcache \
--with-php-config=../php-config-proto \
--with-zlib-dir=$(ROOT)/usr )
$(MEMCACHE_DIR)/configure: $(MEMCACHE_DIR).tar.gz
gzip -dc $(MEMCACHE_DIR).tar.gz | tar xopf -
touch $(MEMCACHE_DIR)/configure
# ----- End of Extension targets -----
include ../Makefile.targ