aboutsummaryrefslogblamecommitdiffstats
path: root/main/php/APKBUILD
blob: 43eafcc50a480023ce6d1bf6959bb8e3ec52a24e (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                    
                                                   
           
            
                        
        

                                         
                 
               
        
                               
                                                                             
                                                                         
                                                                             
                                                      
                                                                      

                                                                   

                                                                




                         






                        
                     












                           
                     






                        
                        


                        
                    





                       
                                                                    
                                                                     
                                  
                        
                                        


                        
         
 

                               
           
                                     

                                                                     
                                                           


                                                                               
 
 
         
                                     
 
















                                                                
                                          
                                     

                                      
                                        



                                      
                                     


                                       

                                       

                                         


                                         
                                     
                                     


                                    



                                                 
                                     





                                             
                                                               

                                              

                                        
                                                 










                                                      
                                      






                                    
                                            
                                    
 







                                                                               
 





                                                                 
                              



                                                                               


                                                               

                                   
                              



                                                                               


                                                                   

                                   
                              
























                                                                               


           


                                                                     
                                                                                                       

                                                                                                                                                                                                                                                                  

 











                                                                                                                          

 


                                                                                             

 
       
                                                   


                                                                                                       
 

                                                                                                  


                                                                                  
 
 





                                                                                                           



                                                                                                                              

 
        








                                                                 
           
                                  

                                                                        

                                                                       

                
 



                                     
                                
                                    


                                 

                                    
                                  
                                 
                                 
                                 
                                 
                                   

                                   
                                 


                                      

                                      
                                       
                                 
                                  
                                  

                                    
                                  
                                 


                                    
                                    


                                    
                                
                                   
                                

                                 
 
                                                            
                                                            
                                                  
                                                                  
                                              

                                                   
# Contributor: Carlo Landmeter <clandmeter at gmail>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=php
pkgver=5.3.5
_suhosinver=5.3.4-0.9.10
pkgrel=1
pkgdesc="The PHP language runtime engine"
url="http://www.php.net/"
arch="x86 x86_64"
license="PHP-3"
depends=
install="$pkgname.post-upgrade"
makedepends="pcre-dev libxml2-dev libiconv-dev openssl-dev zlib-dev bzip2-dev
	curl-dev libpng-dev jpeg-dev freetype-dev libmcrypt-dev mysql-dev
	sqlite-dev libtool libltdl postgresql-dev db-dev unixodbc-dev icu-dev
	gd-dev gmp-dev gettext-dev imap-dev aspell-dev
	net-snmp-dev libxslt-dev cyrus-sasl-dev openldap-dev pkgconfig
	libgcrypt-dev apache2-dev apr-dev apr-util-dev libevent-dev
	readline-dev"
subpackages="$pkgname-dev $pkgname-doc $pkgname-cgi $pkgname-fpm
	$pkgname-apache2 $pkgname-embed $pkgname-pear
	$pkgname-bcmath
	$pkgname-bz2
	$pkgname-calendar
	$pkgname-curl
	$pkgname-dba
	$pkgname-exif
	$pkgname-ftp
	$pkgname-gd
	$pkgname-gettext
	$pkgname-gmp
	$pkgname-iconv
	$pkgname-imap
	$pkgname-intl
	$pkgname-json
	$pkgname-ldap
	$pkgname-mcrypt
	$pkgname-mysql
	$pkgname-mysqli
	$pkgname-odbc
	$pkgname-openssl
	$pkgname-pdo
	$pkgname-pdo_mysql
	$pkgname-pdo_odbc
	$pkgname-pdo_pgsql
	$pkgname-pdo_sqlite
	$pkgname-pgsql
	$pkgname-phar
	$pkgname-posix
	$pkgname-pspell
	$pkgname-shmop
	$pkgname-snmp
	$pkgname-soap
	$pkgname-sockets
	$pkgname-sqlite
	$pkgname-sqlite3
	$pkgname-sysvmsg
	$pkgname-sysvsem
	$pkgname-sysvshm
	$pkgname-xml
	$pkgname-xmlrpc
	$pkgname-xsl
	$pkgname-zip
	$pkgname-zlib
	"

#  http://download.suhosin.org/suhosin-patch-${_suhosinver}.patch.gz
source="http://www.php.net/distributions/${pkgname}-${pkgver}.tar.bz2
	php-install-pear-xml.patch
	php-uclibc.patch
	suhosin-patch-5.3.4-0.9.10.patch
	php-fpm.init
	php5-module.conf
	$install
	"

_extdir="/usr/lib/php/20090626"

prepare() {
	cd "$srcdir"/$pkgname-$pkgver
	# beat the pear installer into using xml.so
	patch -p1 -i "$srcdir"/php-install-pear-xml.patch || return 1
	patch -p1 -i "$srcdir"/php-uclibc.patch || return 1

	# apply suhosin patch
	patch -p1 -i "${srcdir}"/suhosin-patch-${_suhosinver}.patch || return 1
}

build() {
	cd "$srcdir"/$pkgname-$pkgver

	_phpconfig="--build=${CHOST:-i486-alpine-linux-uclibc} \
		--prefix=/usr \
		--sysconfdir=/etc/php \
		--with-layout=GNU \
		--with-config-file-path=/etc/php \
		--with-config-file-scan-dir=/etc/php/conf.d \
		--enable-inline-optimization \
		--disable-debug \
		--disable-rpath \
		--disable-static \
		--enable-shared \
		--mandir=/usr/share/man \
		--with-pic \
		--without-pear \
		"

	_phpextensions="--enable-bcmath=shared \
		--enable-calendar=shared \
		--enable-dba=shared \
		--enable-exif=shared \
		--enable-ftp=shared \
		--enable-gd-native-ttf \
		--enable-intl=shared \
		--enable-json=shared \
		--enable-mbregex \
		--enable-mbstring \
		--enable-pdo=shared \
		--enable-phar=shared \
		--enable-posix=shared \
		--enable-session \
		--enable-shmop=shared \
		--enable-soap=shared \
		--enable-sockets=shared \
		--enable-sqlite-utf8 \
		--enable-sysvmsg=shared \
		--enable-sysvsem=shared \
		--enable-sysvshm=shared \
		--enable-xml=shared \
		--enable-zip=shared \
		--with-bz2=shared \
		--with-curl=shared \
		--with-db4=shared \
		--with-freetype-dir=shared,/usr \
		--with-gd=shared,/usr \
		--with-gettext=shared \
		--with-gmp=shared \
		--with-iconv=shared \
		--with-icu-dir=/usr \
		--with-imap-ssl=shared \
		--with-imap=shared \
		--with-jpeg-dir=shared,/usr \
		--with-ldap=shared \
		--with-mcrypt=shared \
		--with-mysql-sock=/var/run/mysqld/mysqld.sock \
		--with-mysql=shared,mysqlnd \
		--with-mysqli=shared,mysqlnd \
		--with-openssl=shared \
		--with-pcre-regex=/usr \
		--with-pdo-mysql=shared,mysqlnd \
		--with-pdo-odbc=shared,unixODBC,/usr \
		--with-pdo-pgsql=shared \
		--with-pdo-sqlite=shared,/usr \
		--with-pgsql=shared \
		--with-png-dir=shared,/usr \
		--with-pspell=shared \
		--with-regex=php \
		--with-snmp=shared \
		--with-sqlite3=shared,/usr \
		--with-sqlite=shared \
		--with-unixODBC=shared,/usr \
		--with-xmlrpc=shared \
		--with-xsl=shared \
		--with-zlib=shared \
		--without-db1 \
		--without-db2 \
		--without-db3 \
		--without-qdbm \
		"
#		--with-enchant=shared,/usr \
#		--with-tidy=shared \

	# php
	./configure ${_phpconfig} \
		--disable-cgi \
		--with-readline \
		--enable-pcntl \
		${_phpextensions}
	sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile  # see #183
	make || return 1

	# cgi and fcgi
	# reuse the previous run; this will save us a lot of time
	cp -a "$srcdir"/$pkgname-$pkgver "$srcdir"/$pkgname-cgi
	cd "$srcdir"/$pkgname-cgi
	./configure ${_phpconfig} \
		--disable-cli \
		--enable-cgi \
		${_phpextensions}
	sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile  # see #183
	make || return 1

	# fpm
	cp -a "$srcdir"/$pkgname-$pkgver "$srcdir"/$pkgname-fpm
	cd "$srcdir"/$pkgname-fpm
	./configure ${_phpconfig} \
		--disable-cli \
		--enable-fpm \
		${_phpextensions}
	sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile  # see #183
	make || return 1

	# apache2
	cp -a "$srcdir"/$pkgname-$pkgver "$srcdir"/$pkgname-apache2
	cd "$srcdir"/$pkgname-apache2
	./configure ${_phpconfig} \
		--disable-cli \
		--with-apxs2 \
		${_phpextensions}
	sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile  # see #183
	make || return 1

	# embed
	cp -a "$srcdir"/$pkgname-$pkgver "$srcdir"/$pkgname-embed
	cd "$srcdir"/$pkgname-embed
	./configure ${_phpconfig} \
		--disable-cli \
		--enable-embed=shared \
		${_phpextensions}
	sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile  # see #183
	make || return 1

	# pear
	cp -a "$srcdir"/$pkgname-$pkgver "$srcdir"/$pkgname-pear
	cd "$srcdir"/$pkgname-pear
	./configure ${_phpconfig} \
		--disable-cgi \
		--with-readline \
		--enable-pcntl \
		--with-pear \
		${_phpextensions}
	sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile  # see #183
	make || return 1
}

package() {
	cd "$srcdir"/$pkgname-$pkgver
	make -j1 INSTALL_ROOT="$pkgdir" install || return 1
	install -D -m644 php.ini-production "$pkgdir"/etc/php/php.ini
	sed -i -e "s:^; extension_dir = \"./\":extension_dir = \"$_extdir\":" "$pkgdir"/etc/php/php.ini
	sed -ri "s~^([;]*cgi\.rfc2616_headers.*)$~\1\n\n\; If this is enabled, the PHP CGI binary can safely be placed outside of the\n; web tree and people will not be able to circumvent .htaccess security.\ncgi\.discard_path = 1~" "$pkgdir"/etc/php/php.ini
	rm -rf "$pkgdir"/usr/share/man
}

dev() {
	default_dev
	mkdir -p "$subpkgdir"/usr/lib/php/ "$subpkgdir"/usr/bin/
	mv "$pkgdir"/usr/lib/php/build "$subpkgdir"/usr/lib/php/
	mv "$pkgdir"/usr/bin/phpize "$subpkgdir"/usr/bin/
}

doc() {
	install -D -m644 "$srcdir"/$pkgname-$pkgver/sapi/cli/php.1 "$subpkgdir"/usr/share/man/man1/php.1
	install -D -m644 "$srcdir"/$pkgname-$pkgver/scripts/man1/phpize.1 "$subpkgdir"/usr/share/man/man1/phpize.1
	install -D -m644 "$srcdir"/$pkgname-$pkgver/scripts/man1/php-config.1 "$subpkgdir"/usr/share/man/man1/php-config.1
	install -D -m644 "$srcdir"/$pkgname-fpm/sapi/fpm/php-fpm.8 "$subpkgdir"/usr/share/man/man8/php-fpm.8
}

cgi() {
	pkgdesc="PHP Common Gateway Interface (CGI)"
	install -D -m755 "$srcdir"/$pkgname-cgi/sapi/cgi/php-cgi "$subpkgdir"/usr/bin/php-cgi
}

fpm() {
	pkgdesc="PHP FastCGI Process Manager (FPM)"
	install -D -m755 "$srcdir"/$pkgname-fpm/sapi/fpm/php-fpm "$subpkgdir"/usr/bin/php-fpm
	install -D -m644 "$srcdir"/$pkgname-fpm/sapi/fpm/php-fpm.conf "$subpkgdir"/etc/php/php-fpm.conf
	install -D -m755 "$srcdir"/php-fpm.init "$subpkgdir"/etc/init.d/php-fpm

	# enable some default options
	sed -ri "s~^;(error_log)(.*)~\1 = /var/log/php-fpm.log~" "$subpkgdir"/etc/php/php-fpm.conf
	sed -ri "s/^;(pm.start_servers)/\1/" "$subpkgdir"/etc/php/php-fpm.conf
	sed -ri "s/^;(pm.min_spare_servers)/\1/" "$subpkgdir"/etc/php/php-fpm.conf
	sed -ri "s/^;(pm.max_spare_servers)/\1/" "$subpkgdir"/etc/php/php-fpm.conf
}

apache2() {
	pkgdesc="PHP Module for Apache2"
	install -D -m755 "$srcdir"/$pkgname-apache2/libs/libphp5.so "$subpkgdir"/usr/lib/apache2/libphp5.so
	install -D -m644 "$srcdir"/php5-module.conf "$subpkgdir"/etc/apache2/conf.d/php5-module.conf
}

embed() {
	pkgdesc="PHP Embed Library"
	install -D -m755 "$srcdir"/$pkgname-embed/libs/libphp5.so "$subpkgdir"/usr/lib/libphp5.so
	install -D -m644 "$srcdir"/$pkgname-$pkgver/sapi/embed/php_embed.h "$subpkgdir"/usr/include/php/sapi/embed/php_embed.h
}

pear() {
	pkgdesc="PHP Extension and Application Repository (PEAR)"
	depends="php"
	cd "$srcdir"/$pkgname-pear
	make install-pear INSTALL_ROOT=""$subpkgdir""
	for _rmpear in `find "$subpkgdir" -name '.*'`; do
		rm -rf ${_rmpear}
	done
}

_mv_mod() {
	pkgdesc="$1 php extension"
	mkdir -p "$subpkgdir"/$_extdir
	mv "$pkgdir"/$_extdir/${1}.so "$subpkgdir"/$_extdir/ || return 1
	install -d "$subpkgdir"/etc/php/conf.d
	echo "extension=${1}.so" > "$subpkgdir"/etc/php/conf.d/${1}.ini
	return 0
}

bcmath()	{ _mv_mod bcmath; }
bz2()		{ _mv_mod bz2; }
calendar()	{ _mv_mod calendar; }
curl()		{ _mv_mod curl; }
dba()		{ _mv_mod dba; }
#enchant()	{ _mv_mod enchant; }
exif()		{ _mv_mod exif; }
ftp()		{ _mv_mod ftp; }
gd()		{ _mv_mod gd; }
gettext()	{ _mv_mod gettext; }
gmp()		{ _mv_mod gmp; }
iconv()		{ _mv_mod iconv; }
imap()		{ _mv_mod imap; }
intl()		{ _mv_mod intl; }
json()		{ _mv_mod json; }
ldap()		{ _mv_mod ldap; }
mcrypt()	{ _mv_mod mcrypt; }
mysql()		{ _mv_mod mysql; }
mysqli()	{ _mv_mod mysqli; }
odbc()		{ _mv_mod odbc; }
openssl()	{ _mv_mod openssl; }
pdo()		{ _mv_mod pdo; }
pdo_mysql()	{ _mv_mod pdo_mysql; }
pdo_odbc()	{ _mv_mod pdo_odbc; }
pdo_pgsql()	{ _mv_mod pdo_pgsql; }
pdo_sqlite()	{ _mv_mod pdo_sqlite; }
phar()		{ _mv_mod phar; }
posix()		{ _mv_mod posix; }
pgsql()		{ _mv_mod pgsql; }
pspell()	{ _mv_mod pspell; }
#session()	{ _mv_mod session; }
shmop()		{ _mv_mod shmop; }
snmp()		{ _mv_mod snmp; }
soap()		{ _mv_mod soap; }
sockets()	{ _mv_mod sockets; }
sqlite()	{ _mv_mod sqlite; }
sqlite3()	{ _mv_mod sqlite3; }
sysvmsg()	{ _mv_mod sysvmsg; }
sysvsem()	{ _mv_mod sysvsem; }
sysvshm()	{ _mv_mod sysvshm; }
xml()		{ _mv_mod xml; }
xmlrpc()	{ _mv_mod xmlrpc; }
xsl()		{ _mv_mod xsl; }
zip()		{ _mv_mod zip; }
zlib()		{ _mv_mod zlib; }

md5sums="8aaf20c95e91f25c5b6a591e5d6d61b9  php-5.3.5.tar.bz2
5111e3be06d391f8772587c675240fab  php-install-pear-xml.patch
26adfe0e744ec05fa9e368bbdee83176  php-uclibc.patch
289ca647771170f096985951047174e7  suhosin-patch-5.3.4-0.9.10.patch
8f2bb2b744a2de50025842cb51fb6a3a  php-fpm.init
67719f428f44ec004da18705cbabe2ee  php5-module.conf
6b7ebe6e1eedaada03d830bcf2fdc575  php.post-upgrade"