summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Smith <mcs@darkregion.net>2011-01-07 13:33:47 -0600
committerNatanael Copa <ncopa@alpinelinux.org>2011-01-09 11:55:42 +0000
commit264c8486ac878ba6a7647d2abf72112845e14f3a (patch)
tree2956a2d99211accc4644bc17df91801d56eeb88e
parent31c5404b8d1cdaaf64978d7ef52b7ca39822ddd0 (diff)
downloadaports-264c8486ac878ba6a7647d2abf72112845e14f3a.tar.bz2
aports-264c8486ac878ba6a7647d2abf72112845e14f3a.tar.xz
main/php: improved APKBUILD, see changes [resent, updated]
I based my updates off of Arch Linux's work for this package. Here's the changelog: - Each 'main subpackage' gets its own build dir, in order to eliminate build-time complications. - Added php-cgi subpackage (in combination with the above change, fixes #505) - Added php-embed subpackage. - Removed php-cli subpackage; it's now in the main 'php' package. - Added the configure options --with-readline and --enable-pcntl to the 'php' package (previously known as the php-cli package). - Enabled the 'error_log' default option for php-fpm.conf - Enabled cgi.discard_path in php.ini, as --enable-discard-path was dropped from being a configure option. - Dropped --enable-force-cgi-redirect from configure options, as it was deprecated and enabled by default in php.ini. - Did away with $phpextensionsapache2 in the APKBUILD; seems it was there for a workaround. Perhaps it was part of the #183 fix? (Apache still segfaults, with or without the $phpextensionsapache2 workaround.) For more info regarding PHP configure options: http://www.php.net/manual/en/configure.about.php Also, can someone look over the updates I made to the #183 fix, regarding the above $phpextensionsapache2 workaround changes and the changes to where it says "# see #183" throughout the APKBUILD? I want to make sure that I didn't break that fix. Thanks, Matt P.S.: I resent the patch to fix quoting the $srcdir variables and the like. e.g. From "$srcdir/$pkgname-$pkgver" to "$srcdir"/$pkgname-$pkgver
-rw-r--r--main/php/APKBUILD318
1 files changed, 172 insertions, 146 deletions
diff --git a/main/php/APKBUILD b/main/php/APKBUILD
index 2cbaf0c8f..44d8dcb6d 100644
--- a/main/php/APKBUILD
+++ b/main/php/APKBUILD
@@ -3,7 +3,7 @@
pkgname=php
pkgver=5.3.4
_suhosinver=5.3.4-0.9.10
-pkgrel=1
+pkgrel=2
pkgdesc="The PHP language runtime engine"
url="http://www.php.net/"
arch="x86 x86_64"
@@ -15,8 +15,10 @@ makedepends="pcre-dev libxml2-dev libiconv-dev openssl-dev zlib-dev bzip2-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"
-subpackages="$pkgname-dev $pkgname-doc $pkgname-cli $pkgname-fpm $pkgname-pear
+ libgcrypt-dev apache2-dev apr-dev apr-util-dev libevent-dev
+ readline-dev"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-cgi $pkgname-fpm $pkgname-embed
+ $pkgname-pear
$pkgname-apache2
$pkgname-bcmath
$pkgname-bz2
@@ -67,14 +69,16 @@ subpackages="$pkgname-dev $pkgname-doc $pkgname-cli $pkgname-fpm $pkgname-pear
source="http://www.php.net/distributions/${pkgname}-${pkgver}.tar.bz2
php-install-pear-xml.patch
php-uclibc.patch
- php-fpm.init
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"
+ 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
@@ -84,9 +88,25 @@ prepare() {
}
build() {
- cd "$srcdir/$pkgname-$pkgver"
+ cd "$srcdir"/$pkgname-$pkgver
- phpextensions="--enable-bcmath=shared \
+ _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 \
@@ -151,177 +171,181 @@ build() {
# --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
- phpextensionsapache2="--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 \
- --disable-sqlite \
- --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 \
- --without-pdo-sqlite \
- --with-pgsql=shared \
- --with-png-dir=shared,/usr \
- --with-pspell=shared \
- --with-regex=php \
- --with-snmp=shared \
- --without-sqlite3 \
- --without-sqlite \
- --with-unixODBC=shared,/usr \
- --with-xmlrpc=shared \
- --with-xsl=shared \
- --with-zlib=shared \
- --without-db1 \
- --without-db2 \
- --without-db3 \
- --without-qdbm \
- "
-
- ./configure --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 \
- --enable-fastcgi \
+ # 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 \
- --enable-cli \
+ ${_phpextensions}
+ sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile # see #183
+ make || return 1
+
+ # apache
+ 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
+
+ # fpm
+ cp -a "$srcdir"/$pkgname-$pkgver "$srcdir"/$pkgname-fpm
+ cd "$srcdir"/$pkgname-fpm
+ ./configure ${_phpconfig} \
+ --disable-cli \
--enable-fpm \
- --enable-discard-path \
- --enable-force-cgi-redirect \
- --with-pic \
- $phpextensions
+ ${_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
+
+ # php-cgi, php-cli, php-pear
+ # (both cgi and cli are enabled by default)
+ #./configure --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 \
+ # --with-pear \
+ # ${_phpextensions}
# see #183
- sed -i -e '/^BUILD_CGI/s/$(LDFLAGS)/-lpthread $(LDFLAGS)/' Makefile
+ #sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile
- make || return 1
+ #make || return 1
- # Need seperate configure string for apache subpkg
- mkdir -p "$srcdir"/php-apache2
- cp -R "$srcdir"/$pkgname-$pkgver/* "$srcdir"/php-apache2
- cd "$srcdir"/php-apache2
- make clean
- ./configure --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 \
- --enable-fastcgi \
- --enable-cgi \
- --disable-cli \
- --enable-discard-path \
- --enable-force-cgi-redirect \
- --with-pic \
- --with-apxs2 \
- ${phpextensionsapache2}
+ # php-apache2
+ # (it's best to compile php-apache2 in it's own directory)
+ #mkdir -p "$srcdir"/php-apache2
+ #cp -R "$srcdir"/$pkgname-$pkgver/* "$srcdir"/php-apache2
+ #cd "$srcdir"/php-apache2
+ #make clean
+ #./configure --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 \
+ # --disable-cgi \
+ # --disable-cli \
+ # --with-apxs2 \
+ # ${_phpextensionsapache2}
+ # see #183
+ #sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile
- make || return 1
+ #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
+ 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
}
apache2() {
- cd "$srcdir"/php-apache2
- mkdir -p "$subpkgdir"/usr/lib/apache2/
- mkdir -p "$subpkgdir"/etc/apache2/conf.d/
- install -D -m755 libs/libphp5.so "$subpkgdir"/usr/lib/apache2/libphp5.so
- install -D -m644 ../../php5-module.conf "$subpkgdir"/etc/apache2/conf.d/php5-module.conf
+ 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
}
-cli() {
- pkgdesc="PHP command line interface"
- mkdir -p "$subpkgdir"/usr/bin
- mv "$pkgdir"/usr/bin/php "$subpkgdir"/usr/bin/
+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 Fast Process Manager (FPM) interface"
- mkdir -p "$subpkgdir"/usr/bin
- mkdir -p "$subpkgdir"/etc/php
- mv "$pkgdir"/usr/sbin/php-fpm "$subpkgdir"/usr/bin/php-fpm
- mv "$pkgdir"/etc/php/php-fpm.conf.default "$subpkgdir"/etc/php/php-fpm.conf
+ pkgdesc="PHP Fast Process Manager (FPM) Interface"
+ 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 defaults
+ # 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
+}
- install -D -m755 "$srcdir"/php-fpm.init "$subpkgdir"/etc/init.d/php-fpm
+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() {
- depends="php php-cli"
- mkdir -p "$subpkgdir"/usr/bin
- mkdir -p "$subpkgdir"/usr/share
- mkdir -p "$subpkgdir"/etc/php
- mv "$pkgdir"/usr/share/pear "$subpkgdir"/usr/share/
- mv "$pkgdir"/usr/bin/pear* "$subpkgdir"/usr/bin/
- mv "$pkgdir"/usr/bin/pecl "$subpkgdir"/usr/bin/
- mv "$pkgdir"/etc/php/pear.conf "$subpkgdir"/etc/php/
+ 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
+}
+
+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
}
_mv_mod() {
pkgdesc="$1 php extension"
- mkdir -p "$subpkgdir/$_extdir"
- mv "$pkgdir/$_extdir/${1}.so" "$subpkgdir/$_extdir/" || return 1
+ 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
@@ -384,5 +408,7 @@ dev() {
md5sums="2c069d8f690933e3bf6a8741ed818150 php-5.3.4.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
-289ca647771170f096985951047174e7 suhosin-patch-5.3.4-0.9.10.patch"
+67719f428f44ec004da18705cbabe2ee php5-module.conf
+6b7ebe6e1eedaada03d830bcf2fdc575 php.post-upgrade"