# php, http://www.php.net

name=php
version=4.2.2
gdver=1.8.4
source=($name-$version.tar.bz2 gd-$gdver.tar.gz)

build() {
cd gd-$gdver/
make
mkdir lib
mkdir bin
mkdir include
cp libgd.a lib
cp gd.h gdcache.h gd_io.h gdfontg.h gdfontmb.h gdfonts.h gdfontt.h include
cp pngtogd pngtogd2 gdtopng gd2topng gd2copypal gdparttopng webpng \
   bdftogd bin

# compile php
cd ../$name-$version
#            --with-mm=/usr \

./configure --prefix=/usr \
            --with-apxs2=/usr/sbin/apxs \
            --with-config-file-path=/etc/httpd \
            --with-mod_charset \
            --enable-force-cgi-redirect \
            --enable-discard-path \
            --enable-safe-mode \
            --enable-calendar \
            --enable-ctype \
            --with-gdbm \
            --with-db2 \
            --with-db3 \
            --enable-dbase \
            --enable-ftp \
            --enable-bcmath \
            --with-bz2 \
            --with-gmp \
            --with-xml=shared \
            --enable-trans-sid \
            --enable-shmop \
            --enable-sockets \
            --with-regex=php \
            --enable-sysvsem \
            --enable-sysvshm \
            --enable-yp \
            --enable-memory-limit \
            --with-tsrm-pthreads \
            --enable-shared \
            --disable-debug \
            --with-zlib=/usr \
	    --with-libpng=/usr \
            --with-openssl \
            --enable-gd-imgstrttf \
            --with-gd=$PWD/../gd-$gdver \
            --with-jpeg-dir=$PWD/../gd-$gdver \
            --with-mysql=/usr
make

# install php
#mkdir -p $PKG/usr/libexec
make INSTALL_ROOT=$PKG install
#cp /usr/libexec/libphp4.so $PKG/usr/libexec
#chmod 755 $PKG/usr/libexec/libphp4.so
strip $PKG/usr/libexec/libphp4.so
mkdir -p $PKG/etc/httpd
cp -a php.ini-dist $PKG/etc/httpd/php.ini
chown root.root $PKG/usr/bin/*
chown -R root.root $PKG/usr/include/php/*
#cp ../mod_php.conf $PKG/etc/httpd
mkdir -p $PKG/usr/libexec
cp /usr/libexec/libphp4.so $PKG/usr/libexec
chown root.root $PKG/etc/httpd/*
strip $PKG/usr/bin/*
strip $PKG/usr/libexec/*
}
