%bcond_without apache2

%global majorver 5
%global _name php%{majorver}

%global srcname php-%{version}

%global php_confdir %{_sysconfdir}/%{_name}

%{!?_without_pear:%global _with_pear 1}
%global with_pear %{?_with_pear:1}%{!?_with_pear:0}
%if %{with_pear}
%global pear_rootdir %{_datadir}/%{_name}-pear
%global pear_cachedir %{_localstatedir}/cache/%{_name}-pear
%endif

%global apache1_confdir %{_sysconfdir}/httpd/conf.d
%global apache1_moduledir %{_libdir}/apache
%global apache1_contentdir /home/httpd
%global apache1_cgidir %{apache1_contentdir}/cgi-bin
%global apache1_fcgidir %{apache1_contentdir}/fcgi-bin

%global apache2_confdir %{_sysconfdir}/apache2/conf.d
%global apache2_moduledir %{_libdir}/apache2/modules
%global apache2_contentdir /var/www
%global apache2_cgidir %{apache2_contentdir}/cgi-bin
%global apache2_fcgidir %{apache2_contentdir}/fcgi-bin

Name: php5
Summary: The PHP HTML-embedded scripting language. (PHP: Hypertext Preprocessor)
Summary(ja): HTML 埋め込み型スクリプト言語 PHP
Version: 5.3.9
Release: 1%{_dist_release}

Vendor: Project Vine
Distribution: Vine Linux
Packager: tomop

License: The PHP License
Group: Development/Languages
URL: http://www.php.net/

Source0: http://www.php.net/distributions/%{srcname}.tar.bz2

Source20: README.vine
Source21: php.ini-vine
Source23: php5.conf-apache1
Source24: php5.conf-apache2
Source25: php-fpm.init
Source26: php-fpm.conf
Source27: default-pool.conf
Source28: php-fpm.logrotate

Patch33: php-5.2.4-phpincludedir.patch
# Additional feature
Patch51: php-5.3.0-session_strict_mode.patch

# security fix
#Patch1000: php-5.3.7-bug55439.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bison
BuildRequires: bzip2
BuildRequires: bzip2-devel
BuildRequires: curl-devel
BuildRequires: db4-devel
BuildRequires: coreutils
BuildRequires: flex
BuildRequires: freetype2-devel
BuildRequires: gcc-c++
BuildRequires: gd-devel
BuildRequires: gdbm-devel
BuildRequires: gmp-devel
BuildRequires: libjpeg-devel
BuildRequires: libpng-devel
%if %{?_dist_release} == "vl5"
BuildRequires: libstdc++34-devel
%else
BuildRequires: libstdc++-devel
%endif
BuildRequires: libtool-ltdl-devel
BuildRequires: libxml2-devel
BuildRequires: libxslt-devel >= 1.0.18
BuildRequires: ncurses-devel
BuildRequires: openssl-devel
BuildRequires: pam-devel
BuildRequires: pcre-devel
BuildRequires: perl
BuildRequires: pkgconfig
BuildRequires: postfix
BuildRequires: readline-devel
BuildRequires: sqlite3-devel
BuildRequires: zlib-devel
BuildRequires: libicu-devel >= 3.6
%if %{?_dist_release} != "vl4"
BuildRequires: krb5-devel
%endif
Requires(post,preun): alternatives
%{?_with_pear:Requires: %{name}-pear = %{version}-%{release}}
Conflicts: php <= 4.4.2-0vl1.2
Provides: php = %{version}-%{release}

%description 
PHP is an HTML-embedded scripting language. PHP attempts to make it
easy for developers to write dynamically generated webpages. PHP also
offers built-in database integration for several commercial and
non-commercial database management systems, so writing a
database-enabled webpage with PHP is fairly simple. The most common
use of PHP coding is probably as a replacement for CGI scripts. The
mod_php module enables the Apache Web server to understand and process
the embedded PHP language in Web pages.

%description -l ja
PHP は HTML 埋め込み型のスクリプト言語です．開発者にとって，動的に生成
される Web ページを簡単に書けるように考えて作られています．さらに，商用，
非商用を問わず，数々のデータベース管理システムについての統合データベース
環境が組み込まれています．そのため，データベースを使った Web ページを簡
単に書くことができます．PHP の用途のほとんどは、既存の CGI スクリプトの
置き換えに使われているのではないでしょうか．また，mod_php を使うことで，
Apache Web サーバが Web ページに埋めこまれた PHP 言語を理解して処理でき
るようになります．

#----------------------------------------------------------------------
%package devel
Summary: Files needed for building PHP extensions.
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: autoconf
Requires: automake
Conflicts: php-devel

%description devel
The php-devel package contains the files needed for building PHP
extensions. If you need to compile your own PHP extensions, you will
need to install this package.

#----------------------------------------------------------------------
%if %{with_pear}
%package pear
Group: Development/Languages
Summary: PHP Extension and Application Repository Components
Requires(post): alternatives
Requires: %{name} = %{version}-%{release}
Conflicts: php-pear <= 4.4.2-0vl2
Provides: php-pear = %{version}-%{release}

%description pear
PEAR is a framework and distribution system for reusable PHP
components.  This package contains the basic PEAR components.
%endif

#----------------------------------------------------------------------
%if %{?_dist_release} == "vl5"
%package apache
Summary: php5 module for Apache version 1
Summary(ja): Apache バージョン 1 用の php5 モジュール
Group: System Environment/Daemons
BuildRequires: apache-devel
Requires: %{name} = %{version}-%{release}
Requires: apache
Provides: php-apache = %{version}-%{release}

%description apache
This package contains the php5 module for Apache version 1.
%endif

#----------------------------------------------------------------------
%if %{with apache2}
%package apache2
Group: System Environment/Daemons
Summary: php5 module for Apache version 2
Summary(ja): Apache バージョン 2 用の php5 モジュール
BuildRequires: apache2-devel >= 2.0.50-0vl2
Requires: %{name} = %{version}-%{release}
Requires: apache2 >= 2.0.50-0vl2
Requires(post): sed, file
Provides: php-apache2 = %{version}-%{release}

%description apache2
 This package contains the php5 module for Apache version 2.

 Apache2 must be configured to use prefork MPM because
this module is not threadsafe.
%endif

#----------------------------------------------------------------------
%package fpm
Group: System Environment/Daemons
Summary: PHP with FastCGI Process Manager (FPM)
Summary(ja): FastCGI Process Manager (FPM) が組み込まれたPHP
Requires: %{name} = %{version}-%{release}

%description fpm
 PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI
implementation with some additional features useful for sites of
any size, especially busier sites.

#======================================================================
# modules
#----------------------------------------------------------------------
%package dba
Summary: A database abstraction layer module for PHP applications
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Provides: php-dba = %{version}-%{release}

%description dba
The php-dba package contains a dynamic shared object that will add
support for using the DBA database abstraction layer to PHP.

#----------------------------------------------------------------------
%package imap
Summary: A module for PHP applications that use IMAP.
Group: Development/Languages
BuildRequires: uw-imap-devel >= 2000c-1.6.0
BuildRequires: openssl-devel
Requires: %{name} = %{version}-%{release}
Provides: php-imap = %{version}-%{release}

%description imap
The php-imap package contains a dynamic shared object (DSO) for the
Apache Web server. When compiled into Apache, the php-imap module will
add IMAP (Internet Message Access Protocol) support to PHP. IMAP is a
protocol for retrieving and uploading e-mail messages on mail
servers. PHP is an HTML-embedded scripting language. If you need IMAP
support for PHP applications, you will need to install this package
and the php package.

#----------------------------------------------------------------------
%package ldap
Summary: A module for PHP applications that use LDAP.
Group: Development/Languages
BuildRequires: cyrus-sasl-devel
BuildRequires: openldap-devel
BuildRequires: openssl-devel
Requires: %{name} = %{version}-%{release}
Provides: php-ldap = %{version}-%{release}

%description ldap
The php-ldap package is a dynamic shared object (DSO) for the Apache
Web server that adds Lightweight Directory Access Protocol (LDAP)
support to PHP. LDAP is a set of protocols for accessing directory
services over the Internet. PHP is an HTML-embedded scripting
language. If you need LDAP support for PHP applications, you will
need to install this package in addition to the php package.

#----------------------------------------------------------------------
%package mcrypt
Summary: A module for PHP applications that use mcrypt
Group: Development/Languages
BuildRequires: libmcrypt-devel >= 2.5.6
Requires: %{name} = %{version}-%{release}
Provides: php-mcrypt = %{version}-%{release}

%description mcrypt
The php-mcrypt package contains a dynamic shared object that will add
support for encrypt/decrypt functions to PHP.

#----------------------------------------------------------------------
%package mysql
Summary: A module for PHP applications that use MySQL databases.
Group: Development/Languages
BuildRequires: MySQL-devel >= 5.1.40
# for MySQL-devel Requires bug..
Requires: %{name} = %{version}-%{release}
Requires: %{name}-pdo
Provides: %{name}_database
Provides: php-mysql = %{version}-%{release}

%description mysql
The php-mysql package contains a dynamic shared object that will add
MySQL database support to PHP. MySQL is an object-relational database
management system. PHP is an HTML-embeddable scripting language. If
you need MySQL support for PHP applications, you will need to install
this package and the php or mod_php package.

#----------------------------------------------------------------------
%package odbc
Group: Development/Languages
Summary: A module for PHP applications that use ODBC databases.
BuildRequires: unixODBC-devel
Requires: %{name} = %{version}-%{release}
Requires: %{name}-pdo
Provides: %{name}_database
Provides: php-odbc = %{version}-%{release}

%description odbc
The php-odbc package contains a dynamic shared object that will add
database support through ODBC to PHP. ODBC is an open specification
which provides a consistent API for developers to use for accessing
data sources (which are often, but not always, databases). PHP is an
HTML-embeddable scripting language. If you need ODBC support for PHP
applications, you will need to install this package and the php
package.

#----------------------------------------------------------------------
%package pdo
Summary: A database access abstraction module for PHP applications
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Provides: php-pdo = %{version}-%{release}

%description pdo
The php-pdo package contains a dynamic shared object that will add
a database access abstraction layer to PHP.  This module provides
a common interface for accessing MySQL, PostgreSQL or other
databases.

#----------------------------------------------------------------------
%package pgsql
Summary: A PostgreSQL database module for PHP.
Group: Development/Languages
BuildRequires: openssl-devel
BuildRequires: postgresql-devel
Requires: %{name} = %{version}-%{release}
Requires: %{name}-pdo
Provides: %{name}_database
Provides: php-pgsql = %{version}-%{release}

%description pgsql
The php-pgsql package includes a dynamic shared object (DSO) that can
be compiled in to the Apache Web server to add PostgreSQL database
support to PHP. PostgreSQL is an object-relational database management
system that supports almost all SQL constructs. PHP is an
HTML-embedded scripting language. If you need back-end support for
PostgreSQL, you should install this package in addition to the main
php package.

#----------------------------------------------------------------------
%package snmp
Summary: A module for PHP applications that query SNMP-managed devices.
Group: Development/Languages
BuildRequires: bzip2-devel
BuildRequires: glibc-devel
BuildRequires: libelf-devel
BuildRequires: net-snmp-devel >= 5.1.1
BuildRequires: popt-devel
BuildRequires: rpm-devel
BuildRequires: zlib-devel
Requires: %{name} = %{version}-%{release}
Provides: php-snmp = %{version}-%{release}

%description snmp
The php-snmp package contains a dynamic shared object that will add
support for querying SNMP devices to PHP.  PHP is an HTML-embeddable
scripting language. If you need SNMP support for PHP applications, you
will need to install this package and the php package.

#----------------------------------------------------------------------
%package sqlite
Summary: A module for PHP applications that use SQLite databases.
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Requires: %{name}-pdo
Provides: %{name}_database
Provides: php-sqlite = %{version}-%{release}

%description sqlite
The php-sqlite package includes a dynamic shared object (DSO) that can
be compiled in to the Apache Web server to add SQLite database support
to PHP. SQLite is a C library that implements an embeddable SQL database
engine. Programs that link with the SQLite library can have SQL database
access without running a separate RDBMS process.

#----------------------------------------------------------------------
%package xmlrpc
Summary: A module for PHP applications which use the XML-RPC protocol
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Provides: php-xmlrpc = %{version}-%{release}

%description xmlrpc
The php-xmlrpc package contains a dynamic shared object that will add
support for the XML-RPC protocol to PHP.

#----------------------------------------------------------------------
%package intl
Summary: A module for PHP applications to use the ICU APIs
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Provides: php-intl = %{version}-%{release}

%description intl
 The php-intl package is a wrapper for ICU library, enabling PHP programmers
to perform UCA-conformant collation and date/time/number/currency formatting
in their scripts.

#======================================================================
%prep
%setup -q -n %{srcname}

%patch33 -p1 -b .phpincludedir
%patch51 -p1 -b .strict_session

# Prevent %%doc confusion over LICENSE files
cp Zend/LICENSE Zend/ZEND_LICENSE
cp Zend/ChangeLog Zend/ZEND_ChangeLog
cp TSRM/LICENSE TSRM_LICENSE

mkdir -p %{_name}-apache2
cp %{SOURCE20} %{_name}-apache2/README.vine

# Source is built three times:
# once for /usr/bin/php, once for the Apache1 module, once for the Apache2 module.
mkdir build-cgi build-fpm build-apache build-apache2

#======================================================================
%build
# Regenerate configure scripts (patches change config.m4's)
# ./buildconf --force

# Install extension modules in %{_libdir}/%{_name}
export EXTENSION_DIR=%{_libdir}/%{_name}

# Shell function to configure and build a PHP tree.
build() {
ln -sf ../configure
CFLAGS="-fPIC" \
%configure \
  --cache-file=../config.cache \
  --prefix=%{_prefix} \
  --libdir=%{_libdir}/%{_name} \
  --with-libdir=%{_lib} \
  --sysconfdir=%{php_confdir} \
  --with-layout=GNU \
  --with-config-file-path=%{php_confdir} \
  --with-config-file-scan-dir=%{php_confdir}/php.d \
  --with-exec-dir=%{_libdir}/%{_name}/bin \
  --program-suffix=%{majorver} \
  --enable-safe-mode \
  --disable-rpath \
  --enable-bcmath \
  --enable-calendar \
  --enable-dba=shared --with-gdbm --with-db4 --with-inifile \
  --enable-exif \
  --enable-ftp \
  --enable-inline-optimization \
  --enable-intl=shared \
  --enable-mbstring \
  --enable-pdo=shared \
  --enable-shmop \
  --enable-soap \
  --enable-sockets \
  --enable-sysvmsg --enable-sysvsem --enable-sysvshm \
  --enable-wddx \
  --enable-zend-multibyte \
  --with-bz2 \
  --with-curl \
  --with-gd=%{_prefix} --with-jpeg-dir=%{_prefix} --with-png-dir=%{_prefix} --with-freetype-dir=%{_prefix} \
  --with-gettext \
  --with-gmp \
  --with-imap=shared --with-imap-ssl \
%if %{?_dist_release} != "vl4"
  --with-kerberos \
%endif
  --with-ldap=shared \
  --with-mcrypt=shared,%{_prefix} \
  --with-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd \
  --with-openssl \
  --with-pgsql=shared --with-pdo-pgsql=shared,%{_prefix} \
  --with-pic \
  --with-snmp=shared,%{_prefix} \
  --with-sqlite=shared --enable-sqlite-utf8 --with-pdo-sqlite=shared,%{_prefix} \
  --with-unixODBC=shared,%{_prefix} --with-pdo-odbc=shared,unixODBC,%{_prefix} \
  --with-xmlrpc=shared \
  --with-xsl \
  --with-zlib \
  %{?_with_pear:--with-pear=%{pear_rootdir}}%{!?_with_pear:--without-pear} \
  $*
if test $? != 0; then
  tail -500 config.log
  : configure failed
  exit 1
fi

make %{?_smp_mflags}
}

#----------------------------------------------------------------------
# Build /usr/bin/php{,-cgi}, and all the shared extensions
pushd build-cgi
build \
  --with-readline
popd

#----------------------------------------------------------------------
# Build /usr/sbin/php-fpm
pushd build-fpm
build \
  --enable-fpm
popd

#----------------------------------------------------------------------
# Build Apache1 module
%if %{?_dist_release} == "vl5"
pushd build-apache
build \
  --with-apxs=%{_sbindir}/apxs
popd
%endif
#----------------------------------------------------------------------
# Build Apache2 module
%if %{with apache2}
pushd build-apache2
build \
  --with-apxs2=%{_bindir}/apxs
popd
%endif
#======================================================================
%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT

#export PHP_PEAR_SYSCONF_DIR=%{php_confdir}
#export PHP_PEAR_TEMP_DIR=%{pear_cachedir}
#export PHP_PEAR_CACHE_DIR=%{buildroot}%{pear_cachedir}
#export PHP_PEAR_DOWNLOAD_DIR=%{pear_cachedir}
#export PHP_PEAR_PHP_BIN=%{_bindir}/%{_name}

export PHP_PEAR_SYSCONF_DIR=%{php_confdir}
export PHP_PEAR_TEMP_DIR=%{buildroot}%{pear_cachedir}
export PHP_PEAR_CACHE_DIR=%{buildroot}%{pear_cachedir}
export PHP_PEAR_DOWNLOAD_DIR=%{buildroot}%{pear_cachedir}
export PHP_PEAR_PHP_BIN=%{buildroot}%{_bindir}/%{_name}
unset http_proxy

#----------------------------------------------------------------------
pushd build-cgi
# Install everything from the CGI SAPI build
make install INSTALL_ROOT=$RPM_BUILD_ROOT
#cp $RPM_BUILD_ROOT%{_bindir}/%{_name}{,-cgi}
# Install the CLI SAPI as /usr/bin/%{_name}
#make install-cli INSTALL_ROOT=$RPM_BUILD_ROOT
popd

# Install the default configuration file
%{__install} -m 755 -d $RPM_BUILD_ROOT%{php_confdir}
%{__install} -m 644 php.ini-production $RPM_BUILD_ROOT%{php_confdir}/php.ini

# Append php.ini-vine
cat %{SOURCE21} >> $RPM_BUILD_ROOT%{php_confdir}/php.ini
# Use correct libdir
sed -i -e 's|%{_prefix}/lib|%{_libdir}|' $RPM_BUILD_ROOT%{php_confdir}/php.ini

# Remove suffix
ln -sf php-config%{majorver} $RPM_BUILD_ROOT%{_bindir}/php-config
ln -sf phpize%{majorver} $RPM_BUILD_ROOT%{_bindir}/phpize
%{__install} -m 755 scripts/dev/phpextdist $RPM_BUILD_ROOT%{_bindir}
cp $RPM_BUILD_ROOT%{_mandir}/man1/php-config{%{majorver},}.1
cp $RPM_BUILD_ROOT%{_mandir}/man1/phpize{%{majorver},}.1

# fix path in phar

perl -pi -e 's|^#!/.+/build-cgi/sapi/cli/php$|#!/usr/bin/%{_name}|' %{buildroot}%{_bindir}/phar.phar


%if %{with_pear}
# http://pear.php.net/bugs/bug.php?id=6154
perl -pi -e 's#s:([0-9]+):(.)(%{buildroot})+#"s:".($1-length($3)).":$2"#eg;' %{buildroot}%{php_confdir}/pear.conf

for cmd in pear peardev pecl; do
  cp $RPM_BUILD_ROOT%{_bindir}/${cmd}{,%{majorver}}
done
%{__install} -m 755 -d $RPM_BUILD_ROOT%{pear_cachedir}
%endif

# Install cgi/fcgi binaries
mv $RPM_BUILD_ROOT%{_bindir}/php-cgi%{majorver} %{buildroot}%{_bindir}/%{_name}-cgi

# Install fpm binaries
%{__install} -d %{buildroot}%{_sbindir}
%{__install} -d %{buildroot}%{_initdir}
%{__install} -m 755 -d %{buildroot}%{php_confdir}/fpm.d
%{__install} -d %{buildroot}%{_mandir}/man8
%{__install} -d %{buildroot}%{_sysconfdir}/logrotate.d
%{__install} -m 755 build-fpm/sapi/fpm/php-fpm %{buildroot}%{_sbindir}/%{_name}-fpm
%{__install} -m 755 %{SOURCE25} %{buildroot}%{_initdir}/php-fpm
%{__install} -m 644 build-fpm/sapi/fpm/php-fpm.8 %{buildroot}%{_mandir}/man8/
%{__install} -m 644 %{SOURCE26} %{buildroot}%{php_confdir}/
%{__install} -m 644 %{SOURCE27} %{buildroot}%{php_confdir}/fpm.d/
%{__install} -m 644 %{SOURCE28} %{buildroot}%{_sysconfdir}/logrotate.d/php-fpm


# Install the Apache1 module, config fragment
%if %{?_dist_release} == "vl5"
%{__install} -m 755 -d $RPM_BUILD_ROOT%{apache1_moduledir}
%{__install} -m 755 build-apache/libs/lib%{_name}.so $RPM_BUILD_ROOT%{apache1_moduledir}
%{__install} -m 755 -d $RPM_BUILD_ROOT%{apache1_cgidir}
%{__install} -m 755 -d $RPM_BUILD_ROOT%{apache1_fcgidir}
ln -sf %{_bindir}/%{_name}-cgi $RPM_BUILD_ROOT%{apache1_cgidir}/%{_name}-cgi
ln -sf %{_bindir}/%{_name}-cgi $RPM_BUILD_ROOT%{apache1_fcgidir}/%{_name}-fcgi
%{__install} -m 755 -d $RPM_BUILD_ROOT%{apache1_confdir}
%{__install} -m 644 %{SOURCE23} $RPM_BUILD_ROOT%{apache1_confdir}/%{_name}.conf
%endif

# Install the Apache2 module, CGI SAPI, config fragment
%if %{with apache2}
%{__install} -m 755 -d $RPM_BUILD_ROOT%{apache2_moduledir}
%{__install} -m 755 build-apache2/libs/lib%{_name}.so $RPM_BUILD_ROOT%{apache2_moduledir}
%{__install} -m 755 -d $RPM_BUILD_ROOT%{apache2_cgidir}
%{__install} -m 755 -d $RPM_BUILD_ROOT%{apache2_fcgidir}
ln -sf %{_bindir}/%{_name}-cgi $RPM_BUILD_ROOT%{apache2_cgidir}/%{_name}-cgi
ln -sf %{_bindir}/%{_name}-cgi $RPM_BUILD_ROOT%{apache2_fcgidir}/%{_name}-fcgi
%{__install} -m 755 -d $RPM_BUILD_ROOT%{apache2_confdir}
%{__install} -m 644 %{SOURCE24} $RPM_BUILD_ROOT%{apache2_confdir}/%{_name}.conf
%endif

%{__install} -m 755 -d $RPM_BUILD_ROOT%{php_confdir}/php.d
%{__install} -m 755 -d $RPM_BUILD_ROOT%{_localstatedir}/%{_name}
# for session.save_path
%{__install} -m 770 -d $RPM_BUILD_ROOT%{_localstatedir}/%{_name}/session
# for extension modules
%{__install} -m 755 -d $RPM_BUILD_ROOT%{_libdir}/%{_name}
# for --with-exec-dir
%{__install} -m 755 -d $RPM_BUILD_ROOT%{_libdir}/%{_name}/bin

#----------------------------------------------------------------------
# Generate files lists and stub .ini files for each subpackage
for mod in dba imap ldap mcrypt snmp xmlrpc intl \
    mysql mysqli odbc pgsql sqlite \
    pdo pdo_odbc pdo_mysql pdo_pgsql pdo_sqlite; do
    cat > $RPM_BUILD_ROOT%{php_confdir}/php.d/${mod}.ini <<EOF
; Enable ${mod} extension module
extension=${mod}.so
EOF
    cat > files.${mod} <<EOF
%attr(0755,root,root) %{_libdir}/%{_name}/${mod}.so
%config(noreplace) %attr(0644,root,root) %{php_confdir}/php.d/${mod}.ini
EOF
done

# append mysqli module to mysql module.
cat files.mysqli >> files.mysql

# Split out the PDO modules
cat files.pdo_mysql >> files.mysql
cat files.pdo_odbc >> files.odbc
cat files.pdo_pgsql >> files.pgsql

# Package pdo_sqlite with pdo; isolating the sqlite dependency
# isn't useful at this time since rpm itself requires sqlite.
cat files.pdo_sqlite >> files.pdo

#----------------------------------------------------------------------
# Remove unpackaged files
rm -f $RPM_BUILD_ROOT%{_libdir}/%{_name}/*.a

# Remove irrelevant docs
rm -f README.{Zeus,QNX,CVS-RULES}

# fix symlink for phar.

%{__rm} -f %{buildroot}%{_bindir}/phar
%{__ln_s} ./phar.phar %{buildroot}%{_bindir}/phar

# ad-hoc fix for incorrect paths to php5
for X in pear5 peardev5 pecl5 ; do
  sed -e 's|%{buildroot}||g' %{buildroot}%{_bindir}/$X \
	> %{buildroot}%{_bindir}/$X.new
  mv -f %{buildroot}%{_bindir}/$X.new %{buildroot}%{_bindir}/$X
  chmod 0755 %{buildroot}%{_bindir}/$X
done

#----------------------------------------------------------------------
%post
/sbin/update-alternatives --install %{_bindir}/php \
    php %{_bindir}/php%{majorver} %{majorver}0

# fix broken symlink if it's there
if [ ! -f %{_bindir}/php ] ; then
    /sbin/update-alternatives --auto php
fi

%triggerpostun -- php5 < 5.1.4-0vl1
/sbin/update-alternatives --auto php

%preun
if [ "$1" = 0 ]; then
    /sbin/update-alternatives --remove php %{_bindir}/php%{majorver}
    /sbin/update-alternatives --auto php
fi

%post fpm
/sbin/update-alternatives --install %{_sbindir}/php-fpm \
    php-fpm %{_sbindir}/php%{majorver}-fpm %{majorver}0

# fix broken symlink if it's there
if [ ! -f %{_sbindir}/php-fpm ] ; then
    /sbin/update-alternatives --auto php-fpm
fi
/sbin/chkconfig --add php-fpm

%preun fpm
if [ "$1" = 0 ]; then
    /sbin/chkconfig --del php-fpm
    /sbin/update-alternatives --remove php-fpm %{_sbindir}/php%{majorver}-fpm
    /sbin/update-alternatives --auto php-fpm
fi

%post pear
/sbin/update-alternatives \
  --install %{_bindir}/pear     pear    %{_bindir}/pear%{majorver} %{majorver}0 \
  --slave   %{_bindir}/peardev  peardev %{_bindir}/peardev%{majorver} \
  --slave   %{_bindir}/pecl     pecl    %{_bindir}/pecl%{majorver}

# fix broken symlink if it's there
if [ ! -f %{_bindir}/pear ] ; then
    /sbin/update-alternatives --auto pear
fi

%triggerpostun pear -- php5-pear < 5.1.4-0vl1
/sbin/update-alternatives --auto pear

%preun pear
if [ "$1" = "0" ]; then
    /sbin/update-alternatives --remove pear %{_bindir}/pear%{majorver}
    /sbin/update-alternatives --auto pear
fi

%if %{?_dist_release} == "vl5"
%post apache
chown root:apache %{_localstatedir}/%{_name}/session 2>/dev/null || true
%endif

%if %{with apache2}
%post apache2
chown root:apache %{_localstatedir}/%{_name}/session 2>/dev/null || true

MPM=`file /etc/alternatives/apache2 | sed -e 's/^.*apache2\.\([a-z]*\).*$/\1/'`
if [ "$MPM" != "prefork" ]; then
  cat <<EOF

 Apache2 is configured to use $MPM MPM. But php5-apache2 requires
prefork MPM. Run the following command as root to switch MPM:

    /sbin/update-alternatives --config apache2

EOF
fi
%endif

%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
rm -f files.*

#======================================================================
%files
%defattr(-,root,root)
%doc CODING_STANDARDS CREDITS EXTENSIONS INSTALL LICENSE NEWS README*
%doc Zend/ZEND_* TSRM_LICENSE
%doc php.ini-{development,production}
%doc php.gif
%{_mandir}/man1/%{_name}.1*
%config(noreplace) %{php_confdir}/php.ini
%{_bindir}/%{_name}
%{_bindir}/%{_name}-cgi
%{_bindir}/phar
%{_bindir}/phar.phar
%dir %{php_confdir}
%dir %{php_confdir}/php.d
%dir %{_libdir}/%{_name}
%dir %{_libdir}/%{_name}/bin
%dir %{_localstatedir}/%{_name}
%attr(0770,root,apache) %dir %{_localstatedir}/%{_name}/session

%files devel
%defattr(-,root,root)
%{_mandir}/man1/php-config.1*
%{_mandir}/man1/phpize.1*
%{_bindir}/php-config
%{_bindir}/php-config5
%{_bindir}/phpize
%{_bindir}/phpize5
%{_bindir}/phpextdist
%{_includedir}/%{_name}
%{_libdir}/%{_name}/build

%if %{with_pear}
%files pear
%defattr(-,root,root)
%config %{php_confdir}/pear.conf
%{_bindir}/pear%{majorver}
%{_bindir}/peardev%{majorver}
%{_bindir}/pecl%{majorver}
%{pear_rootdir}
%dir %{pear_cachedir}
%endif

%if %{?_dist_release} == "vl5"
%files apache
%defattr(-,root,root)
%config %{apache1_confdir}/%{_name}.conf
%{apache1_moduledir}/lib%{_name}.so
%{apache1_cgidir}/%{_name}-cgi
%{apache1_fcgidir}/%{_name}-fcgi
%endif

%if %{with apache2}
%files apache2
%defattr(-,root,root)
%doc %{_name}-apache2/README.vine
%config %{apache2_confdir}/%{_name}.conf
%{apache2_moduledir}/lib%{_name}.so
%{apache2_cgidir}/%{_name}-cgi
%{apache2_fcgidir}/%{_name}-fcgi
%endif

%files fpm
%defattr(-,root,root)
%{_sbindir}/%{_name}-fpm
%{_initdir}/php-fpm
%{_mandir}/man8/php-fpm.8*
%dir %{php_confdir}/fpm.d
%config(noreplace) %{php_confdir}/php-fpm.conf
%config(noreplace) %{php_confdir}/fpm.d/*.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/php-fpm


%files dba -f files.dba
%files imap -f files.imap
%files ldap -f files.ldap
%files mcrypt -f files.mcrypt
%files mysql -f files.mysql
%files odbc -f files.odbc
%files pdo -f files.pdo
%files pgsql -f files.pgsql
%files snmp -f files.snmp
%files sqlite -f files.sqlite
%files xmlrpc -f files.xmlrpc
%files intl -f files.intl

#======================================================================
%changelog
* Thu Jan 12 2012 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.3.9-1
- new upstream release.

* Sat Oct 29 2011 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.3.8-1
- new upstream release.
- added a subpackage "php5-fpm".

* Tue Aug 23 2011 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.3.7-2
- fixed bug#55439.

* Thu Aug 18 2011 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.3.7-1
- new upstream release.

* Mon Jun 13 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 5.3.6-4
- rebuild with unixODBC-2.2.14-2

* Tue Apr 12 2011 Shu KONNO <owa@bg.wakwak.com> 5.3.6-3
- rebuilt with postgresql-9.0.3

* Sat Apr  9 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.3.6-2
- new upstream release
- dropt apache subpackage on VineSeed (apache1 will be orphaned on Vine 6)

* Mon Mar 28 2011 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.3.6-1
- new upstream release.
- added tags "Vendor:", "Distribution:" and "Packager:".

* Mon Jan 10 2011 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.3.5-1
- new upstream release.

* Fri Dec 10 2010 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.3.4-1
- new upstream release.
- added a sub-package "php5-intl".

* Sun Sep  5 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.3.3-1
- new upstream release

* Fri Nov 20 2009 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.3.1-1
- new upstream release.

* Tue Sep  1 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 5.3.0-2
- fix incorrect path in {pear,peardev,pecl}5 ([vine-users:079537])

* Thu Jul  2 2009 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.3.0-1
- new upstream release.
- updated patch51.
- removed /usr/bin/php5-fcgi.

* Sat Jun 20 2009 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.2.10-1
- new upstream release.
- updated patch51.

* Tue Jun 16 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 5.2.9-6
- update php.ini
  - use UTF-8 for default charset and internal_encoding

* Thu May 21 2009 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.2.9-5
- rebuilt with MySQL-shared-5.1.34.

* Sat May 16 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.2.9-4
- rebuilt with libc-client-2007e
- added --with-kerberos option (VineSeed)

* Fri Apr 03 2009 NAKAMURA Kenta <kenta@vinelinux.org> 5.2.9-3
- rebuilt with openldap-2.4.11

* Fri Mar 27 2009 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.2.9-2
- rebuilt with net-snmp-5.4.2.1-3 (VineSeed x86_64).

* Thu Mar 19 2009 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.2.9-1
- new upstream release.
- wrote specfile in UTF-8.

* Tue May  6 2008 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 5.2.6-2
- move php5-{cgi,fcgi} to %%{_bindir}.

* Tue May  6 2008 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 5.2.6-1
- new upstream release.
- update %%Patch51.

* Sat Apr 26 2008 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 5.2.5-1
- add FastCGI support.

* Tue Jan 08 2008 Shu KONNO <owa@bg.wakwak.com> 5.2.5-0vl5
- rebuilt with postgresql-8.2.6

* Sun Jan 06 2008 Shu KONNO <owa@bg.wakwak.com> 5.2.5-0vl4
- rebuilt with net-snmp-5.4.1

* Thu Dec 13 2007 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 5.2.5-0vl3
- for VineSeed: rebuilt with MySQL-5.0.27-0vl7

* Thu Dec 13 2007 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 5.2.5-0vl2
- rebuilt with MySQL-5.0.27-0vl6

* Fri Nov 23 2007 Atsushi SHICHI <ats777@gmail.com> 5.2.5-0vl1
- new upstream release.

* Thu Sep 20 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.2.4-0vl3
- rebuilt with postgresql-devel 8.2.5

* Sat Sep 15 2007 NAKAMURA Kenta <kenta@vinelinux.org> 5.2.4-0vl2
- replaced BuildRequires: libstdc++3-devel with libstdc++34-devel

* Sun Sep  9 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.2.4-0vl1
- rebuilt for VineSeed

* Tue Sep  4 2007 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 5.2.4-0vl0.40
- new upstream release.
- update Patch33.

* Thu Jun  7 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.2.3-0vl2
- rebuilt for VineSeed

* Tue Jun 05 2007 Atsushi SHICHI <ats777@gmail.com> 5.2.3-0vl1
- new upstream release.
- fix install script.

* Sun May 27 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.2.2-0vl5
- rebuilt with new toolchain (for VineSeed)

* Wed May 16 2007 Atsushi SHICHI <ats777@gmail.com> 5.2.2-0vl4
- remove "Provides: php-devel" from devel subpackage

* Mon May 14 2007 Atsushi SHICHI <ats777@gmail.com> 5.2.2-0vl3
- fix Source24(php5.conf-apache2)

* Fri May 11 2007 Atsushi SHICHI <ats777@gmail.com> 5.2.2-0vl2
- add Provides tag to subpackages.

* Tue May 08 2007 Atsushi SHICHI <ats777@gmail.com> 5.2.2-0vl1
- new upstream release.
- add 'Provides: php = %%{version}-%%{release}' to main package.

* Sun Mar 25 2007 NAKAMURA Kenta <kenta@vinelinux.org> 5.2.1-0vl3
- added --with-libdir=%%{_lib} configure option

* Mon Feb 26 2007 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 5.2.1-0vl2
- built for VineSeed.

* Fri Feb 16 2007 Atsushi SHICHI <ats777@gmail.com> 5.2.1-0vl1
- new upstream release.
- remove unnecessary 'Obsoletes: php-domxml, php-manual'

* Sat Dec 02 2006 Atsushi SHICHI <ats777@gmail.com> 5.2.0-0vl4
- change session.save_path to /var/php5/session in php.ini-vine <BTS:412>
- unset http_proxy in %%install

* Tue Nov  7 2006 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 5.2.0-0vl3
- new upstream release.

* Sun Oct 29 2006 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 5.1.6-0vl6
- build with MySQL-5.0.27.

* Fri Oct 27 2006 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 5.1.6-0vl5
- build with MySQL-5.0.26.
- add mysqli module.
- modify %%BuildRequires 'imap-devel' to 'uw-imap-devel'.

* Sun Oct 22 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.1.6-0vl4
- fixed %triggerpostun section
- added update-alternatives for checking symlink to %post section

* Sat Oct 21 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.1.6-0vl3
- rebuilt for Vine Linux 4.0 <BTS:289>
- added Patch1000 for building with uw-imap-2006b

* Mon Sep 11 2006 Atsushi SHICHI <ats777@gmail.com> 5.1.6-0vl2
- rebuild for VinePlus/4.0
- change 'BuildRequires: fileutils' to coreutils
- add 'BuildRequires: libtool-ltdl-devel' to main package

* Fri Aug 25 2006 Atsushi SHICHI <ats777@gmail.com> 5.1.6-0vl1
- new upstream release

* Wed Aug 23 2006 Atsushi SHICHI <ats777@gmail.com> 5.1.5-0vl1
- new upstream release
- fix bug [vine-users:074749]
-- move php.gif from apache{,2} subpackage to main package
- fix bug [VineLinux:0070], [VineLinux:0106]
-- add 'Conflicts: php-devel' to devel subpackage
-- remove suffix from {php-config,phpize,phpextdist}
-- add alternatives support for {peardev5,pecl5}

* Mon Jun 19 2006 Atsushi SHICHI <ats777@gmail.com> 5.1.4-0vl1.4
- add 'Requires: %%{name}-pdo' to sqlite subpackage [vine-php:137]

* Sun Jun 18 2006 Atsushi SHICHI <ats777@gmail.com> 5.1.4-0vl1.3
- enable sqlite extension and add sqlite subpackage [vine-users:074695]

* Tue May 30 2006 Atsushi SHICHI <ats777@gmail.com> 5.1.4-0vl1.2
- update Source0
- change Requires: to PreReq: in apache{,2} subpackages [vine-php:113]
- fix %%post apache{,2} script

* Tue May 16 2006 Atsushi SHICHI <ats777@gmail.com> 5.1.4-0vl1.1
- fix /etc/httpd/conf.d/php5.conf [VinePlus:02967]

* Sat May 13 2006 Atsushi SHICHI <ats777@gmail.com> 5.1.4-0vl1
- new upstream release
- revive apache{,2} subpackage
- add 'Source24: php.conf-apache2'
- remove php-dbg, mod_php, phpfi, stronghold-php from Obsoletes
- fix Requires of main package and dba subpackage
- remove 'Conflicts: php-apache' from apache subpackage
- remove 'Conflicts: php-apache2' from apache2 subpackage
- add %%post apache{,2} script to chown session directory to root:apache
- modify %%files section

* Sun Apr 30 2006 Atsushi SHICHI <ats777@gmail.com> 5.1.3-0vl0.3
- update to 5.1.3RC3
- fix %%post script and add %%triggerpostun script

* Sat Apr 08 2006 Atsushi SHICHI <ats777@gmail.com> 5.1.3-0vl0.2.3
- drop 'Source10: pear.sh'
- fix 'Source20: README.vine', 'Source21: php.ini-vine', 'Source23: php.conf'
- add alternatives support
-- add 'PreReq: alternatives' to main package and pear subpackage
-- add 'Conflicts: php < 4.4.2-0vl1.1' to main package
-- add 'Conflicts: php-pear < 4.4.2-0vl1.1' to pear subpackage
-- add %%post, %%preun scripts

* Wed Apr 05 2006 Atsushi SHICHI <ats777@gmail.com> 5.1.3-0vl0.2.2
- fix 'Source10: pear.sh'
- add --sysconfdir=%%{php_confdir} to configure

* Tue Apr 04 2006 Atsushi SHICHI <ats777@gmail.com> 5.1.3-0vl0.2.1
- add 'Source10: pear.sh' to replace /usr/bin/{pear,peardev,pecl}
- add 'Patch33: php-5.1.3RC2-phpincludedir.patch'
- remove 'Conflicts: php, php-*'
- add 'export PHP_PEAR_SYSCONF_DIR, PHP_PEAR_CACHE_DIR, PHP_PEAR_PHP_BIN'
  to %%Install section
  -- move pear.conf to %%{_sysconfdir}/%%{_name}
  -- add '%%dir %%{pear_cachedir}' to '%%files pear'
  -- fix php_bin in pear.conf
- rename phpextdist to phpextdist5

* Fri Mar 31 2006 Atsushi SHICHI <ats777@gmail.com> 5.1.3-0vl0.2
- update to 5.1.3RC2

* Mon Mar 20 2006 Atsushi SHICHI <ats7@a.email.ne.jp> 5.1.3-0vl0.1
- new upstream release
- add Source23: php5.conf
- drop Patch21: php-4.3.1-odbc.patch
- drop Patch30: php-4.3.6-dlopen.patch
- drop Patch32: php-4.3.11-mbfilter.patch
- apply strict session patch, thanks to Yasuo Ohgaki
  -- add Patch51: php-5.1.2-session_strict_mode.patch
  -- add session.use_strict_mode = 1 to php.ini-vine
- add BuildRequires: autoconf, automake, bison, flex, gcc-c++,
  readline-devel, sqlite3-devel
- drop BuildRequires: automake15, expat-devel, unixODBC-devel
- build with Apache2. Apache1.3 is still able to used by rebuilding
  with --with apache1
  -- add Requires: apache2
  -- merge apache{,2} subpackage into main package
  -- add Obsoletes: php5-apache, php5-apache2
- add Requires: autoconf, automake to devel subpackage
- add dba, pdo subpackage
- add Requires: php5-pdo to {mysql,odbc,pgsql} subpackage
- drop BuildRequires: expat-devel from xmlrpc subpackage
- add --program-suffix=5 to configure
- add missing files to %%files

* Thu Jan 12 2006 Atsushi SHICHI <ats7@a.email.ne.jp> 5.1.2-0vl1
- new upstream release
- remove workaround for install-pear-nozlib.phar bug (PHP Bug #35780, PEAR Bug #6154)
  -- remove Source2: relocate.php
  -- remove Source10: pear.sh
  -- remove Source11: pecl.sh
  -- remove Source12: peardev.sh
- remove old XSLT extension stuff
  -- remove BuildRequires: libsablotron0-devel
  -- remove --enable-xslt, --with-xslt-sablot configure option

* Thu Dec 07 2005 Atsushi SHICHI <ats7@a.email.ne.jp> 5.1.1-0vl2
- add %%{with_test}
- drop Patch5: php-4.3.3-install.patch
- drop Patch6: php-5.1.0-tests.patch
- drop Patch7: php-5.1.0-libtool15.patch
- drop Patch8: php-5.0.0RC3-miscfix.patch
- drop Patch10: php-5.1.0-sqlite_m4.patch
- change BuildPrereq tag to BuildRequires tag
- add BuildRequires: rpm-devel, popt, bzip2-devel, zlib-devel, glibc-devel
  to snmp subpackage
- comment out CFLAGS, LIBS, IMAP_SHARED_LIBADD environment variable settings
- remove support for FreeType 1.x
  -- remove BuildRequires: freetype, freetype-devel from main package
  -- remove --enable-gd-native-ttf, --with-ttf configure option
- drop --enable-ucd-snmp-hack configure option
- add workaround for install-pear-nozlib.phar bug
  -- add Source2: relocate.php
  -- add Source10: pear.sh
  -- add Source11: pecl.sh
  -- add Source12: peardev.sh
  -- remove include_path entry from vine.ini
- include phpextdist in devel subpackage again
- move pear.conf from main package to pear subpackage
- include pecl, peardev in pear subpackage
- move php.gif from main package to apache/apache2 subpackage
  -- fix %%{contentdir}
- fix typo in %%changelog

* Tue Dec 06 2005 HOTTA Michihide <hotta@net-newbie.com> 5.1.1-0vl1
- new upstream release
- drop Patch #4 (php-4.2.2-cxx.patch)
- change Patch #6 (php-4.3.1-tests.patch) to php-5.1.0-tests.patch
- change Patch #7 (php-4.3.2-libtool15.patch) to php-5.1.0-libtool15.patch
- change Patch #10 (php-5.0.5-sqlite_m4.patch) to php-5.1.0-sqlite_m4.patch
- drop Patch #101 (php-5.0.5-mbfilter.patch)
- append include_path entry to vine.ini

* Sat Oct 15 2005 HOTTA Michihide <hotta@net-newbie.com> 5.0.5-0vl5
- rebuild for VineSeedPlus

* Thu Oct 06 2005 Atsushi SHICHI <ats7@a.email.ne.jp> 5.0.5-0vl4
- modify Source21: vine.ini

* Tue Oct 06 2005 HOTTA Michihide <hotta@net-newbie.com> 5.0.5-0vl3
- drop Patch3: php-5.0.5-lib64.patch
- drop Patch11: php-5.0.5-phpize_in.patch [VinePlus:02737]
- add --libdir=%%{_libdir}/php option to configure [VinePlus:02737]

* Tue Oct 04 2005 HOTTA Michihide <hotta@net-newbie.com> 5.0.5-0vl2
- add mbfilter.c.patch

* Sun Sep 18 2005 Atsushi SHICHI <ats7@a.email.ne.jp> 5.0.5-0vl1
- upstream release
- add Source21: vine.ini (additional settings to php.ini-recommened)
- add Source22: ltmain.sh.vine
- drop Patch2: php-5.0.3-config.patch
- fix Patch3: php-5.0.5-lib64.patch
- drop Patch9: php-5.0.0RC3-oniguruma.patch
- fix Patch10: php-5.0.5-sqlite_m4.patch
- add Patch11: php-5.0.5-phpize_in.patch
- drop Patch246: php-4.3.6-fixattr.patch
- add %%define __libtoolize true
- drop %%{_bindir}phpextdist

* Fri Jun 17 2005 IKEDA Katsumi <ikeda@webmasters.gr.jp> 5.0.3-0vl3.2
- added a security patch for CAN-2005-0524 and CAN-2005-0525 from SuSE.

* Thu May 16 2005 HOTTA Michihide <hotta@net-newbie.com> 5.0.3-0vl3.1
- for VinePlus/3.0
- add README.vine again
- add php-4.3.11-mbfilter.patch for workaround against degrade at 5.0.3
- remove veserion specification on BuildPrereq: curl-devel

* Fri Feb 25 2005 HOTTA Michihide <hotta@net-newbie.com> 5.0.3-0vl3
- drop BuildPrereq: apache2-apr-devel
- drop php-4.2.1-ldap-TSRM.patch

* Sat Dec 25 2004 HOTTA Michihide <hotta@net-newbie.com> 5.0.3-0vl1
- upstream release
- drop php-4.3.2-db4.patch
- add BuildPrereq: apache2-apr-devel

* Mon Oct 18 2004 HOTTA Michihide <hotta@net-newbie.com> 5.0.2-0vl1
- upstream release
- regenerate php5-imap

* Fri Aug 13 2004 HOTTA Michihide <hotta@net-newbie.com> 5.0.1-0vl1
- upstream release

* Tue Aug 03 2004 HOTTA Michihide <hotta@net-newbie.com> 5.0.0-0vl1
- upstream release : many thanks to YOSHIMURA Keitaro <ramsy AT ramix DOT jp>
- remove php4_{namazu,kakasi,chasen} (not supported)
- drop some patches for 4.3.x
- Build fix for oniguruma(re_registers dups)
- remove domxml (updated to libxml2)
- add Conflicts: php, php-*
- add php-5.0.0-authuser.patch (BUG#29129)

* Thu Jul 15 2004 HOTTA Michihide <hotta@net-newbie.com> 4.3.8-0vl1
- upstream release
- add BuildPrereq: freetype

* Sun Jul 11 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 4.3.7-0vl5
- remove explicit buildprereq to build-essential
- build apache2 module
  split apache1/2 module to php-apache/php-apache2
  thanks to jax <jax AT morejams DOT no-ip DOT com>
- add Obsoletes: php < %%{version}-%%{release} in php-apache sub-package
  for upgrade.

* Wed Jul 07 2004 HOTTA Michihide <hotta@net-newbie.com> 4.3.7-0vl4
- add Obsoletes: php-imap, php-manual

* Sat Jun 26 2004 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 4.3.7-0vl3
- enable mcrypt module.

* Mon Jun 07 2004 HOTTA Michihide <hotta@net-newbie.com> 4.3.7-0vl2
- fix bug #28385 <http://bugs.php.net/bug.php?id=28385>

* Fri Jun 04 2004 HOTTA Michihide <hotta@net-newbie.com> 4.3.7-0vl1
- upstream release

* Wed May 12 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.3.6-0vl2
- rebuild with namazu-2.0.13

* Fri Apr 30 2004 HOTTA Michihide <hotta@net-newbie.com> 4.3.6-0vl1
- upstream release

* Mon Mar 15 2004 Tomoya TAKA <taka@vinelinux.org> 4.3.4-0vl2
- fix location of session save path, %%{_localstatedir} is defined as
  /var/lib in Vine's rpm

* Sat Feb 21 2004 HOTTA Michihide <hotta@net-newbie.com> 4.3.4-0vl1
- upstream release
- sync to fedora(php-4.3.4-7)
- drop BuildRequires : aspell
- add workaround for inconsistent dependency of php-devel
- drop --enable-versioning to prevent ext modules loading error

* Thu Feb 05 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.3.2-0vl4
- rebuild with new toolchains (and resolved dependancy about libxslt)
- added patch7 to build with libtool-1.5
- added patch100 to build newest freetype2 library
- force to use automake-1.5 
- added BuildPrereq: curl-devel, automake15
- fixed BuildRequires of php-snmp: net-snmp-devel

* Tue Jul 08 2003 HOTTA Michihide <hotta@net-newbie.com> 4.3.2-0vl3
- add README.vine

* Tue Jul 08 2003 HOTTA Michihide <hotta@net-newbie.com> 4.3.2-0vl2
- install sapi/cgi/php as php-cgi, sapi/cli/php as php

* Tue Jul 08 2003 HOTTA Michihide <hotta@net-newbie.com> 4.3.2-0vl1
- upstream release (sync to rawhide)
- add printf patch, PEAR_Registry patch etc.
- drop package php-manual 

* Fri Jan 24 2003 HOTTA Michihide <hotta@net-newbie.com> 4.2.3-0vl3
- add zend_highlight.c-patch
- add -DHAVE_PQESCAPE to build_ext pgsql

* Wed Jan 22 2003 MACHINO Satoshi <machino@vinelinux.org> 4.2.3-0vl2
- rebuild against gmp-4.1 and sablotron-0.97

* Mon Sep 9 2002 HOTTA Michihide <hotta@net-newbie.com> 4.2.3-0vl1
- for VineSeedPlus
  -- Updated to 4.2.3
  -- added php-4.2.3-mbstr-20020908-2.patch

* Sun Aug 18 2002 Rui HIROKAWA <hirokawa@php.gr.jp> 4.2.2-0vl3
- applied php-4.2.2-mb_output_handler.patch to enable output encoding
for text/hdml.     
- applied php-4.2.2-mb-decode.patch to fix decode problem of GET parameters.
- Patch to fix a problem where, given multiple cookies to set, only the last one would be made (#67853)

* Tue Jul 24 2002 HOTTA Michihide <hotta@net-newbie.com> 4.2.2-0vl2
- for VineSeedPlus
  -- applied php-4.2.2-multibyte.patch.gz which obsolets 4.2.1's
  -- dropped --enable-trans-sid configure option which is no longer meaningful

* Tue Jul 23 2002 HOTTA Michihide <hotta@net-newbie.com> 4.2.2-0vl1
- for VineSeedPlus
  -- Updated to 4.2.2
  -- dropped domxml.patch (merged into original)

* Fri Jul 05 2002 HOTTA Michihide <hotta@net-newbie.com> 4.2.1-0vl8
- for VineSeedPlus
  -- added i18n patch by Fujimoto
  -- dropped php4_mbregex extention (merged into original)

* Tue Jun 04 2002 Satoshi MACHINO <machino@vinelinux.org> 4.2.1-0vl7
- added gmp support
- for VineSeedPlus

* Tue Jun 04 2002 Satoshi MACHINO <machino@vinelinux.org> 4.2.1-0vl6
- for VineSeedPlus
	-- added xslt support
	
* Tue Jun 04 2002 Satoshi MACHINO <machino@vinelinux.org> 4.2.1-0vl5
- added expat-devel in BuildPreReq

* Tue Jun 04 2002 Satoshi MACHINO <machino@vinelinux.org> 4.2.1-0vl4
- added mail functions
- added postfix in BuildPreReq
- updated manual_en(03-Jun-2002)
- updated manual_ja(29-May-2002)
- for VinePlus
	-- dropped xslt support

* Thu May 16 2002 Satoshi MACHINO <machino@vinelinux.org> 4.2.1-0vl3
- for VineSeed Plus
- added xslt support
	-- added enable-xslt, with-xslt-sablot, with-dom-xslt
	-- added BuildPrereq: libxslt-devel, libsablotron0-devel

* Thu May 16 2002 Satoshi MACHINO <machino@vinelinux.org> 4.2.1-0vl2
- for VinePlus 2.5
- added php.in-dist.patch

* Wed May 15 2002 Satoshi MACHINO <machino@vinelinux.org> 4.2.1-0vl1
- updated php-4.2.1
- updated php_manual_en
- dropped reg.patch
- modified configured option
  -- added --with-dom, --with-bz2, --with-png-dir, --with-expat-dir

* Thu May 09 2002 Satoshi MACHINO <machino@vinelinux.org> 4.2.0-99vl1
- updated php-4.2.1RC1
- fixed ereg_replace patch (4.2.1-reg.patch)

* Thu May 09 2002 Satoshi MACHINO <machino@vinelinux.org> 4.2.0-0vl2
- added ereg_replace patch (4.2.0-reg.patch)
- updated manual(en, ja)

* Thu Apr 30 2002 Satoshi MACHINO <machino@vinelinux.org> 4.2.0-0vl1
- updated php-4.2.0

* Fri Mar 01 2002 Satoshi MACHINO <machino@vinelinux.org> 4.1.2-0vl1
- updated php-4.1.2
- updated php4_mbregex-1.3.1
- updated php4_namazu-2.1.0
- updated php4_kakasi-0.3.0
- REMOVED php4_iconv
- fixed patch
	-- added domxml.patch
	-- dropped old patches

* Mon Dec  3 2001 Jun Nishii <jun@vinelinux.org>
- 4.0.6-5vl3
- added --enable-mbstr-enc-trans

* Wed Aug 22 2001 Hisao SHIBUYA <shibuya@alpha.or.jp>
- 4.0.6-5vl2
- fix contentdir

* Tue Aug 21 2001 Hisao SHIBUYA <shibuya@alpha.or.jp>
- 4.0.6-5vl1
- add configure options for Vine
- add ldap, mysql and odbc modules.

* Fri Aug 10 2001 Tim Powers <timp@redhat.com>
- only english in php-manuals, space constraints :P

* Thu Aug  9 2001 Nalin Dahyabhai <nalin@redhat.com>
- include %{_libdir}/%{name}/build instead of %{_libdir}/%{name}4/build (#51141)

* Mon Aug  6 2001 Nalin Dahyabhai <nalin@redhat.com>
- add build deps on pam-devel, pspell-devel, gdbm-devel (#49878)
- add some conditional logic if %%{oracle} is defined (from Antony Nguyen)

* Mon Jul  9 2001 Nalin Dahyabhai <nalin@redhat.com>
- don't obsolete subpackages we ended up not merging

* Mon Jul  2 2001 Nalin Dahyabhai <nalin@redhat.com>
- cleanups
- add manuals in multiple languages (using ko instead of kr for Korean)
- merge all of the manuals into a single -manual subpackage
- use libtool to install binary files which libtool builds
- don't strip any binaries; let the buildroot policies take care of it

* Thu Jun 28 2001 Nalin Dahyabhai <nalin@redhat.com>
- update to 4.0.6 (preliminary)

* Mon Jun 25 2001 Nalin Dahyabhai <nalin@redhat.com>
- enable ttf in the build because the gd support needs it
- add -lfreetype to the LIBS for the same reason

* Wed Jun  6 2001 Nalin Dahyabhai <nalin@redhat.com>
- rebuild in new environment

* Wed May 16 2001 Nalin Dahyabhai <nalin@redhat.com>
- actually use two source trees to build things
- add %%post and %%postun scriptlets to run ldconfig

* Tue May 15 2001 Nalin Dahyabhai <nalin@redhat.com>
- quote part of the AC_ADD_LIBRARY macro to make newer autoconf happy

* Mon May 14 2001 Nalin Dahyabhai <nalin@redhat.com>
- fix error in %%install
- depend on the imap-devel which supplies linkage.c
- modify trigger to disable php versions less than 4.0.0 instead of 3.0.15
- enable DOM support via libxml2 (suggested by Sylvain Berg
- build the OpenSSL extension again

* Mon May  7 2001 Nalin Dahyabhai <nalin@redhat.com>
- enable pspell extensions
- update to 4.0.5

* Mon Apr 30 2001 Nalin Dahyabhai <nalin@redhat.com>
- build the ODBC extension

* Mon Apr 30 2001 Bill Nottingham <notting@redhat.com>
- build on ia64

* Fri Mar  2 2001 Nalin Dahyabhai <nalin@redhat.com>
- rebuild in new environment

* Fri Feb 23 2001 Nalin Dahyabhai <nalin@redhat.com>
- obsolete the old phpfi (PHP 2.x) package

* Thu Feb  8 2001 Nalin Dahyabhai <nalin@redhat.com>
- add a commented-out curl extension to the config file (part of #24933)
- fix the PEAR-installation-directory-not-being-eval'ed problem (#24938)
- find the right starting point for multipart form data (#24933)

* Tue Jan 30 2001 Nalin Dahyabhai <nalin@redhat.com>
- aaarrgh, the fix breaks something else, aaarrgh; revert it (#24933)
- terminate variable names at the right place (#24933)

* Sat Jan 20 2001 Nalin Dahyabhai <nalin@redhat.com>
- tweak the fix some more

* Thu Jan 18 2001 Nalin Dahyabhai <nalin@redhat.com>
- extract stas's fix for quoting problems from CVS for testing
- tweak the fix, ask the PHP folks about the tweak
- tweak the fix some more

* Wed Jan 17 2001 Nalin Dahyabhai <nalin@redhat.com>
- merge mod_php into the main php package (#22906)

* Fri Dec 29 2000 Nalin Dahyabhai <nalin@redhat.com>
- try to fix a quoting problem

* Wed Dec 20 2000 Nalin Dahyabhai <nalin@redhat.com>
- update to 4.0.4 to get a raft of bug fixes
- enable sockets
- enable wddx

* Fri Nov  3 2000 Nalin Dahyabhai <nalin@redhat.com>
- rebuild in updated environment

* Thu Nov  2 2000 Nalin Dahyabhai <nalin@redhat.com>
- add more commented-out modules to the default config file (#19276)

* Wed Nov  1 2000 Nalin Dahyabhai <nalin@redhat.com>
- fix not-using-gd problem (#20137)

* Tue Oct 17 2000 Nalin Dahyabhai <nalin@redhat.com>
- update to 4.0.3pl1 to get some bug fixes

* Sat Oct 14 2000 Nalin Dahyabhai <nalin@redhat.com>
- build for errata

* Wed Oct 11 2000 Nalin Dahyabhai <nalin@redhat.com>
- update to 4.0.3 to get security fixes integrated
- patch around problems configuring without Oracle support
- add TSRM to include path when building individual modules

* Fri Sep  8 2000 Nalin Dahyabhai <nalin@redhat.com>
- rebuild in new environment
- enable OpenSSL support

* Wed Sep  6 2000 Nalin Dahyabhai <nalin@redhat.com>
- update to 4.0.2, and move the peardir settings to configure (#17171)
- require %%{version}-%%{release} for subpackages
- add db2-devel and db3-devel prereqs (#17168)

* Wed Aug 23 2000 Nalin Dahyabhai <nalin@redhat.com>
- rebuild in new environment (new imap-devel)

* Wed Aug 16 2000 Nalin Dahyabhai <nalin@redhat.com>
- fix summary and descriptions to match the specspo package

* Wed Aug  9 2000 Nalin Dahyabhai <nalin@redhat.com>
- hard-code the path to apxs in build_ext() (#15799)

* Tue Aug  1 2000 Nalin Dahyabhai <nalin@redhat.com>
- add "." to the include path again, which is the default

* Wed Jul 19 2000 Nalin Dahyabhai <nalin@redhat.com>
- enable PEAR and add it to the include path
- add the beginnings of a -devel subpackage

* Wed Jul 12 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Fri Jul  7 2000 Nalin Dahyabhai <nalin@redhat.com>
- tweaks to post and postun from Bill Peck

* Thu Jul  6 2000 Nalin Dahyabhai <nalin@redhat.com>
- fixes from Nils for building the MySQL client
- change back to requiring %{version} instead of %{version}-%{release}

* Sat Jul  1 2000 Nalin Dahyabhai <nalin@redhat.com>
- update to 4.0.1pl2
- enable MySQL client
- move the php.ini file to %{_sysconfdir}

* Fri Jun 30 2000 Nils Philippsen <nils@redhat.de>
- build_ext defines HAVE_PGSQL so pgsql.so in fact contains symbols
- post/un scripts tweak php.ini correctly now

* Thu Jun 28 2000 Nalin Dahyabhai <nalin@redhat.com>
- update to 4.0.1
- refresh manual

* Tue Jun 26 2000 Nalin Dahyabhai <nalin@redhat.com>
- rebuild against new krb5 package

* Mon Jun 19 2000 Nalin Dahyabhai <nalin@redhat.com>
- rebuild against new db3 package

* Sat Jun 17 2000 Nalin Dahyabhai <nalin@redhat.com>
- Fix syntax error in post and preun scripts.
- Disable IMAP, LDAP, PgSql in the standalone version because it picks up
  the extensions.

* Fri Jun 16 2000 Nalin Dahyabhai <nalin@redhat.com>
- Unexclude the Sparc arch.
- Exclude the ia64 arch until we get a working Postgres build.
- Stop stripping extensions as aggressively.
- Start linking the IMAP module to libpam again.
- Work around extension loading problems.
- Reintroduce file-editing post and preun scripts for the mod_php extensions
  until we come up with a better way to do it.

* Mon Jun  5 2000 Nalin Dahyabhai <nalin@redhat.com>
- ExcludeArch: sparc for now

* Sun Jun  4 2000 Nalin Dahyabhai <nalin@redhat.com>
- add Obsoletes: phpfi, because their content handler names are the same
- add standalone binary, rename module packages to mod_php
- FHS fixes

* Tue May 23 2000 Nalin Dahyabhai <nalin@redhat.com>
- change license from "GPL" to "PHP"
- add URL: tag
- disable mysql support by default (license not specified)

* Mon May 22 2000 Nalin Dahyabhai <nalin@redhat.com>
- update to PHP 4.0.0
- nuke the -mysql subpackage (php comes with a bundled mysql client lib now)

* Tue May 16 2000 Nalin Dahyabhai <nalin@redhat.com>
- link IMAP module against GSS-API and PAM to get dependencies right
- change most of the Requires to Prereqs, because the post edits config files
- move the PHP *Apache* module back to the right directory
- fix broken postun trigger that broke the post
- change most of the postuns to preuns in case php gets removed before subpkgs

* Thu May 11 2000 Trond Eivind Glomsr <teg@redhat.com>
- rebuilt against new postgres libraries

* Tue May 09 2000 Preston Brown <pbrown@redhat.com>
- php3 .so modules moved to /usr/lib/php3 from /usr/lib/apache (was incorrect)

* Mon Apr 10 2000 Nalin Dahyabhai <nalin@redhat.com>
- make subpackages require php = %{version} (bug #10671)

* Thu Apr 06 2000 Nalin Dahyabhai <nalin@redhat.com>
- update to 3.0.16

* Fri Mar 03 2000 Cristian Gafton <gafton@redhat.com>
- fixed the post script to work when upgrading a package
- add triggere to fix the older packages

* Tue Feb 29 2000 Nalin Dahyabhai <nalin@redhat.com>
- update to 3.0.15
- add build-time dependency for openldap-devel
- enable db,ftp,shm,sem support to fix bug #9648

* Fri Feb 25 2000 Nalin Dahyabhai <nalin@redhat.com>
- add dependency for imap subpackage
- rebuild against Apache 1.3.12

* Thu Feb 24 2000 Preston Brown <pbrown@redhat.com>
- don't include old, outdated manual.  package one from the php distribution.

* Tue Feb 01 2000 Cristian Gafton <gafton@redhat.com>
- rebuild to fix dependency problem

* Fri Jan 14 2000 Preston Brown <pbrown@redhat.com>
- added commented out mysql module, thanks to Jason Duerstock 
  (jason@sdi.cluephone.com). Uncomment to build if you have mysql installed.

* Thu Jan 13 2000 Preston Brown <pbrown@redhat.com>
- rely on imap-devel, don't include imap in src.rpm (#5099).
- xml enabled (#5393)

* Tue Nov 02 1999 Preston Brown <pborwn@redhat.com>
- added post/postun sections to modify httpd.conf (#5259)
- removed old obsolete faq and gif (#5260)
- updated manual.tar.gz package (#5261)

* Thu Oct 07 1999 Matt Wilson <msw@redhat.com>
- rebuilt for sparc glibc brokenness

* Fri Sep 24 1999 Preston Brown <pbrown@redhat.com>
- --with-apxs --> --with-apxs=/usr/sbin/apxs (# 5094)
- ldap support (# 5097)

* Thu Sep 23 1999 Preston Brown <pbrown@redhat.com>
- fix cmdtuples for postgresql, I had it slightly wrong

* Tue Aug 31 1999 Bill Nottingham <notting@redhat.com>
- subpackages must obsolete old stuff...

* Sun Aug 29 1999 Preston Brown <pbrown@redhat.com>
- added -DHAVE_PGCMDTUPLES for postgresql module (bug # 4767)

* Fri Aug 27 1999 Preston Brown <pbrown@redhat.com>
- name change to php to follow real name of package
- fix up references to php3 to refer to php
- upgrade to 3.0.12
- fixed typo in pgsql postun script (bug # 4686)

* Mon Jun 14 1999 Preston Brown <pbrown@redhat.com>
- upgraded to 3.0.9
- fixed postgresql module and made separate package
- separated manual into separate documentation package

* Mon May 24 1999 Preston Brown <pbrown@redhat.com>
- upgraded to 3.0.8, which fixes problems with glibc 2.1.
- took some ideas grom Gomez's RPM.

* Tue May 04 1999 Preston Brown <pbrown@redhat.com>
- hacked in imap support in an ugly way until imap gets an official
  shared library implementation

* Fri Apr 16 1999 Preston Brown <pbrown@redhat.com>
- pick up php3.ini

* Wed Mar 24 1999 Preston Brown <pbrown@redhat.com>
- build against apache 1.3.6

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 2)

* Mon Mar 08 1999 Preston Brown <pbrown@redhat.com>
- upgraded to 3.0.7.

* Wed Feb 24 1999 Preston Brown <pbrown@redhat.com>
- Injected new description and group.

* Sun Feb 07 1999 Preston Brown <pbrown@redhat.com>
- upgrade to php 3.0.6, built against apache 1.3.4

* Mon Oct 12 1998 Cristian Gafton <gafton@redhat.com>
- rebuild for apache 1.3.3

* Thu Oct 08 1998 Preston Brown <pbrown@redhat.com>
- updated to 3.0.5, fixes nasty bugs in 3.0.4.

* Sun Sep 27 1998 Cristian Gafton <gafton@redhat.com>
- updated to 3.0.4 and recompiled for apache 1.3.2

* Thu Sep 03 1998 Preston Brown <pbrown@redhat.com>
- improvements; builds with apache-devel package installed.

* Tue Sep 01 1998 Preston Brown <pbrown@redhat.com>
- Made initial cut for PHP3.
