Skip to content

Instantly share code, notes, and snippets.

@vvuksan
Created July 12, 2011 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vvuksan/1079081 to your computer and use it in GitHub Desktop.
Save vvuksan/1079081 to your computer and use it in GitHub Desktop.
PHP Spec file
%define contentdir /var/www
%define apiver 20041225
%define zendver 20050922
%define pdover 20060409
Summary: The PHP HTML-embedded scripting language. (PHP: Hypertext Preprocessor)
Name: php
Version: 5.3.0
Release: 1%{?dist}
License: The PHP License v3.01
Group: Development/Languages
URL: http://www.php.net/
Source0: http://www.php.net/distributions/php-%{version}.tar.bz2
Source1: httpd.conf
Source50: php.conf
Source51: php.ini
BuildRoot: %{_tmppath}/%{name}-root
BuildRequires: bzip2-devel, curl-devel >= 7.9, db4-devel, expat-devel
BuildRequires: gmp-devel, aspell-devel >= 0.50.0
BuildRequires: httpd-devel >= 2.0.46-1, libjpeg-devel, libpng-devel, pam-devel
BuildRequires: libstdc++-devel, openssl-devel, sqlite-devel >= 3.0.0
BuildRequires: zlib-devel, pcre-devel >= 4.5, smtpdaemon
BuildRequires: bzip2, fileutils, file >= 4.0, perl, libtool >= 1.4.3, gcc-c++
Obsoletes: php-dbg, php3, phpfi, stronghold-php
# Enforce Apache module ABI compatibility
Requires: httpd-mmn = %(cat %{_includedir}/httpd/.mmn || echo missing-httpd-devel)
Requires: file >= 4.0
Provides: mod_php = %{version}-%{release}
Requires: php-common = %{version}-%{release}
# For backwards-compatibility, require php-cli for the time being:
Requires: php-cli = %{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 php package contains the module which adds support for the PHP
language to Apache HTTP Server.
%package cli
Group: Development/Languages
Summary: Command-line interface for PHP
Requires: php-common = %{version}-%{release}
Provides: php-cgi = %{version}-%{release}
Provides: php-pcntl
Requires: file >= 4.0
%description cli
The php-cli package contains the command-line interface
executing PHP scripts, /usr/bin/php, and the CGI interface.
%package common
Group: Development/Languages
Summary: Common files for PHP
Provides: php-api = %{apiver}, php-zend-abi = %{zendver}
# Provides for all builtin modules:
Provides: php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif
Provides: php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-libxml
Provides: php-mime_magic, php-openssl, php-pcre, php-posix, php-pspell
Provides: php-reflection, php-session, php-shmop, php-simplexml, php-sockets
Provides: php-spl, php-sysvsem, php-sysvshm, php-sysvmsg, php-tokenizer
Provides: php-wddx, php-zlib, php-dbase
Obsoletes: php-openssl, php-dbase
%description common
The php-common package contains files used by both the php
package and the php-cli package.
%package devel
Group: Development/Libraries
Summary: Files needed for building PHP extensions.
Requires: php = %{version}-%{release}, autoconf, automake
Obsoletes: php-pecl-pdo-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.
%package imap
Summary: A module for PHP applications that use IMAP.
Group: Development/Languages
Requires: php-common = %{version}-%{release}
Obsoletes: mod_php3-imap, stronghold-php-imap
BuildRequires: krb5-devel, openssl-devel, libc-client-devel
%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
Requires: php-common = %{version}-%{release}
Obsoletes: mod_php3-ldap, stronghold-php-ldap
BuildRequires: cyrus-sasl-devel, openldap-devel, openssl-devel
%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 pdo
Summary: A database access abstraction module for PHP applications
Group: Development/Languages
Requires: php-common = %{version}-%{release}
Obsoletes: php-pecl-pdo-sqlite, php-pecl-pdo
Provides: php-pdo-abi = %{pdover}
%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 mysql
Summary: A module for PHP applications that use MySQL databases.
Group: Development/Languages
Requires: php-common = %{version}-%{release}, php-pdo
Provides: php_database, php-mysqli
Obsoletes: mod_php3-mysql, stronghold-php-mysql
BuildRequires: mysql-devel >= 4.1.0
%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 package.
%package pgsql
Summary: A PostgreSQL database module for PHP.
Group: Development/Languages
Requires: php-common = %{version}-%{release}, php-pdo
Provides: php_database
Obsoletes: mod_php3-pgsql, stronghold-php-pgsql
BuildRequires: krb5-devel, openssl-devel, postgresql-devel
%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 odbc
Group: Development/Languages
Requires: php-common = %{version}-%{release}, php-pdo
Summary: A module for PHP applications that use ODBC databases.
Provides: php_database
Obsoletes: stronghold-php-odbc
BuildRequires: unixODBC-devel
%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 soap
Group: Development/Languages
Requires: php-common = %{version}-%{release}
Summary: A module for PHP applications that use the SOAP protocol
BuildRequires: libxml2-devel
%description soap
The php-soap package contains a dynamic shared object that will add
support to PHP for using the SOAP web services protocol.
%package snmp
Summary: A module for PHP applications that query SNMP-managed devices.
Group: Development/Languages
Requires: php-common = %{version}-%{release}, net-snmp
BuildRequires: net-snmp-devel
%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 xml
Summary: A module for PHP applications which use XML
Group: Development/Languages
Requires: php-common = %{version}-%{release}
Obsoletes: php-domxml, php-dom
Provides: php-dom, php-xsl, php-domxml
BuildRequires: libxslt-devel >= 1.0.18-1, libxml2-devel >= 2.4.14-1
%description xml
The php-xml package contains dynamic shared objects which add support
to PHP for manipulating XML documents using the DOM tree,
and performing XSL transformations on XML documents.
%package xmlrpc
Summary: A module for PHP applications which use the XML-RPC protocol
Group: Development/Languages
Requires: php-common = %{version}-%{release}
BuildRequires: expat-devel
%description xmlrpc
The php-xmlrpc package contains a dynamic shared object that will add
support for the XML-RPC protocol to PHP.
%package mbstring
Summary: A module for PHP applications which need multi-byte string handling
Group: Development/Languages
Requires: php-common = %{version}-%{release}
%description mbstring
The php-mbstring package contains a dynamic shared object that will add
support for multi-byte string handling to PHP.
%package ncurses
Summary: A module for PHP applications for using ncurses interfaces
Group: Development/Languages
Requires: php-common = %{version}-%{release}
BuildRequires: ncurses-devel
%description ncurses
The php-ncurses package contains a dynamic shared object that will add
support for using the ncurses terminal output interfaces.
%package gd
Summary: A module for PHP applications for using the gd graphics library
Group: Development/Languages
Requires: php-common = %{version}-%{release}
BuildRequires: gd-devel, freetype-devel
%description gd
The php-gd package contains a dynamic shared object that will add
support for using the gd graphics library to PHP.
%package bcmath
Summary: A module for PHP applications for using the bcmath library
Group: Development/Languages
Requires: php-common = %{version}-%{release}
%description bcmath
The php-bcmath package contains a dynamic shared object that will add
support for using the bcmath library to PHP.
%package dba
Summary: A database abstraction layer module for PHP applications
Group: Development/Languages
Requires: php-common = %{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.
%prep
%setup -q
# Prevent %%doc confusion over LICENSE files
cp Zend/LICENSE Zend/ZEND_LICENSE
cp TSRM/LICENSE TSRM_LICENSE
cp ext/gd/libgd/README gd_README
# Source is built twice: once for /usr/bin/php, once for the Apache DSO.
mkdir build-cgi build-apache
# Remove bogus test; position of read position after fopen(, "a+")
# is not defined by C standard, so don't presume anything.
rm -f ext/standard/tests/file/bug21131.phpt
# Tests that fail.
rm -f ext/standard/tests/file/bug22414.phpt \
ext/iconv/tests/bug16069.phpt
# Safety check for API version change.
#vapi=`sed -n '/#define PHP_API_VERSION/{s/.* //;p}' main/php.h`
#if test "x${vapi}" != "x%{apiver}"; then
# : Error: Upstream API version is now ${vapi}, expecting %{apiver}.
# : Update the apiver macro and rebuild.
# exit 1
#fi
# Safety check for Zend API version change.
#vzend=`sed -n '/#define ZEND_MODULE_API_NO/{s/^[^0-9]*//;p;}' Zend/zend_modules.h`
#if test "x${vzend}" != "x%{zendver}"; then
# : Error: Upstream Zend module ABI version is now ${vzend}, expecting %{zendver}.
# : Update the zendver macro and rebuild.
# exit 1
#fi
# Safety check for PDO ABI version change
#vpdo=`sed -n '/#define PDO_DRIVER_API/{s/.*[ ]//;p}' ext/pdo/php_pdo_driver.h`
#if test "x${vpdo}" != "x%{pdover}"; then
# : Error: Upstream PDO ABI version is now ${vpdo}, expecting %{pdover}.
# : Update the pdover macro and rebuild.
# exit 1
#fi
%build
# Force use of system libtool:
libtoolize --force --copy
cat `aclocal --print-ac-dir`/libtool.m4 > build/libtool.m4
# Regenerate configure scripts (patches change config.m4's)
./buildconf --force
CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -Wno-pointer-sign"
CPPFLAGS="-DLDAP_DEPRECATED=1"
export CFLAGS CPPFLAGS
# Install extension modules in %{_libdir}/php/modules.
EXTENSION_DIR=%{_libdir}/php/modules; export EXTENSION_DIR
# Set PEAR_INSTALLDIR to ensure that the hard-coded include_path
# includes the PEAR directory even though pear is packaged
# separately.
PEAR_INSTALLDIR=%{_datadir}/pear; export PEAR_INSTALLDIR
# Shell function to configure and build a PHP tree.
build() {
# bison-1.875-2 seems to produce a broken parser; workaround.
mkdir Zend && cp ../Zend/zend_{language,ini}_{parser,scanner}.[ch] Zend
ln -sf ../configure
%configure \
--cache-file=../config.cache \
--with-libdir=%{_lib} \
--with-config-file-path=%{_sysconfdir} \
--with-config-file-scan-dir=%{_sysconfdir}/php.d \
--disable-debug \
--with-pic \
--disable-rpath \
--without-pear \
--with-bz2 \
--with-curl \
--with-exec-dir=%{_bindir} \
--with-freetype-dir=%{_prefix} \
--with-png-dir=%{_prefix} \
--enable-gd-native-ttf \
--without-gdbm \
--with-gettext \
--with-gmp \
--with-iconv \
--with-jpeg-dir=%{_prefix} \
--with-openssl \
--with-png \
--with-pspell \
--with-expat-dir=%{_prefix} \
--with-pcre-regex=%{_prefix} \
--with-zlib \
--with-layout=GNU \
--enable-exif \
--enable-ftp \
--enable-magic-quotes \
--enable-sockets \
--enable-sysvsem --enable-sysvshm --enable-sysvmsg \
--enable-track-vars \
--enable-trans-sid \
--enable-yp \
--enable-wddx \
--with-kerberos \
--enable-ucd-snmp-hack \
--with-unixODBC=shared,%{_prefix} \
--enable-memory-limit \
--enable-shmop \
--enable-calendar \
--enable-dbx \
--enable-dio \
--with-mime-magic=%{_datadir}/file/magic.mime \
--without-sqlite \
--with-libxml-dir=%{_prefix} \
--with-xml \
--with-system-tzdata \
$*
if test $? != 0; then
tail -500 config.log
: configure failed
exit 1
fi
make %{?_smp_mflags}
}
# Build /usr/bin/php-cgi with the CGI SAPI, and all the shared extensions
pushd build-cgi
build --enable-force-cgi-redirect \
--enable-pcntl \
--with-imap=shared --with-imap-ssl \
--enable-mbstring=shared --enable-mbstr-enc-trans \
--enable-mbregex \
--with-ncurses=shared \
--with-gd=shared \
--enable-bcmath=shared \
--enable-dba=shared --with-db4=%{_prefix} \
--with-xmlrpc=shared \
--with-ldap=shared --with-ldap-sasl \
--with-mysql=shared,%{_prefix} \
--with-mysqli=shared,%{_bindir}/mysql_config \
--enable-dom=shared \
--with-dom-xslt=%{_prefix} --with-dom-exslt=%{_prefix} \
--with-pgsql=shared \
--with-snmp=shared,%{_prefix} \
--enable-soap=shared \
--with-xsl=shared,%{_prefix} \
--enable-xmlreader=shared --enable-xmlwriter=shared \
--enable-fastcgi \
--enable-pdo=shared \
--with-pdo-odbc=shared,unixODBC,%{_prefix} \
--with-pdo-mysql=shared,%{_prefix} \
--with-pdo-pgsql=shared,%{_prefix} \
--with-pdo-sqlite=shared,%{_prefix} \
--enable-dbase=shared
popd
# Build Apache module, and the CLI SAPI, /usr/bin/php
pushd build-apache
build --with-apxs2=%{_sbindir}/apxs \
--without-mysql --without-gd \
--without-odbc --disable-dom \
--disable-dba --without-unixODBC \
--disable-pdo --disable-xmlreader --disable-xmlwriter
popd
%check
cd build-apache
# Run tests, using the CLI SAPI
export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
unset TZ LANG LC_ALL
make test || true
set +x
for f in `find .. -name \*.diff -type f -print`; do
echo "TEST FAILURE: $f --"
cat "$f"
echo -e "\n-- $f result ends."
done
set -x
%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
# Install everything from the CGI SAPI build
pushd build-cgi
make install INSTALL_ROOT=$RPM_BUILD_ROOT
mv $RPM_BUILD_ROOT%{_bindir}/php $RPM_BUILD_ROOT%{_bindir}/php-cgi
# Install the CLI SAPI as /usr/bin/php
make install-cli INSTALL_ROOT=$RPM_BUILD_ROOT
popd
# Install the Apache module
pushd build-apache
make install-sapi INSTALL_ROOT=$RPM_BUILD_ROOT
popd
# Install the default configuration file and icons
install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/
install -m 644 $RPM_SOURCE_DIR/php.ini $RPM_BUILD_ROOT%{_sysconfdir}/php.ini
install -m 755 -d $RPM_BUILD_ROOT%{contentdir}/icons
install -m 644 *.gif $RPM_BUILD_ROOT%{contentdir}/icons/
# For PEAR packaging:
install -m 755 -d $RPM_BUILD_ROOT%{_libdir}/php/pear
# Use correct libdir
sed -i -e 's|%{_prefix}/lib|%{_libdir}|' $RPM_BUILD_ROOT%{_sysconfdir}/php.ini
# install the DSO
install -m 755 -d $RPM_BUILD_ROOT%{_libdir}/httpd/modules
install -m 755 build-apache/libs/libphp5.so $RPM_BUILD_ROOT%{_libdir}/httpd/modules
# Apache config fragment
install -m 755 -d $RPM_BUILD_ROOT/etc/httpd/conf.d
install -m 644 $RPM_SOURCE_DIR/php.conf $RPM_BUILD_ROOT/etc/httpd/conf.d
install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/php.d
install -m 755 -d $RPM_BUILD_ROOT%{_localstatedir}/lib/php
install -m 700 -d $RPM_BUILD_ROOT%{_localstatedir}/lib/php/session
# Generate files lists and stub .ini files for each subpackage
for mod in pgsql mysql mysqli odbc ldap snmp xmlrpc imap \
mbstring ncurses gd dom xsl soap bcmath dba xmlreader xmlwriter \
pdo pdo_mysql pdo_pgsql pdo_odbc pdo_sqlite dbase; do
cat > $RPM_BUILD_ROOT%{_sysconfdir}/php.d/${mod}.ini <<EOF
; Enable ${mod} extension module
extension=${mod}.so
EOF
cat > files.${mod} <<EOF
%attr(755,root,root) %{_libdir}/php/modules/${mod}.so
%config(noreplace) %attr(644,root,root) %{_sysconfdir}/php.d/${mod}.ini
EOF
done
# The dom, xsl and xml* modules are all packaged in php-xml
cat files.dom files.xsl files.xml{reader,writer} > files.xml
# The mysql and mysqli modules are both packaged in php-mysql
cat files.mysqli >> files.mysql
# Split out the PDO modules
cat files.pdo_mysql >> files.mysql
cat files.pdo_pgsql >> files.pgsql
cat files.pdo_odbc >> files.odbc
# 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
# Package dbase in -common.
cat files.dbase > files.common
# Remove unpackaged files
rm -rf $RPM_BUILD_ROOT%{_libdir}/php/modules/*.a \
$RPM_BUILD_ROOT%{_bindir}/{phptar} \
$RPM_BUILD_ROOT%{_datadir}/pear
# Remove irrelevant docs
rm -f README.{Zeus,QNX,CVS-RULES}
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
rm files.*
%files
%defattr(-,root,root)
%{_libdir}/httpd/modules/libphp5.so
%attr(0770,root,apache) %dir %{_localstatedir}/lib/php/session
%config %{_sysconfdir}/httpd/conf.d/php.conf
%{contentdir}/icons/php.gif
%files common -f files.common
%defattr(-,root,root)
%doc CODING_STANDARDS CREDITS EXTENSIONS INSTALL LICENSE NEWS README*
%doc Zend/ZEND_* TSRM_LICENSE regex_COPYRIGHT
%config %{_sysconfdir}/php.ini
%dir %{_sysconfdir}/php.d
%dir %{_libdir}/php
%dir %{_libdir}/php/modules
%dir %{_localstatedir}/lib/php
%dir %{_libdir}/php/pear
%files cli
%defattr(-,root,root)
%{_bindir}/php
%{_bindir}/php-cgi
%{_mandir}/man1/php.1*
%files devel
%defattr(-,root,root)
%{_bindir}/php-config
%{_bindir}/phpize
%{_includedir}/php
%{_libdir}/php/build
%{_mandir}/man1/php-config.1*
%{_mandir}/man1/phpize.1*
%files pgsql -f files.pgsql
%files mysql -f files.mysql
%files odbc -f files.odbc
%files imap -f files.imap
%files ldap -f files.ldap
%files snmp -f files.snmp
%files xml -f files.xml
%files xmlrpc -f files.xmlrpc
%files mbstring -f files.mbstring
%files ncurses -f files.ncurses
%files gd -f files.gd
%doc gd_README
%files soap -f files.soap
%files bcmath -f files.bcmath
%files dba -f files.dba
%files pdo -f files.pdo
%changelog
* Wed Nov 12 2008 Joe Orton <jorton@redhat.com> 5.1.6-23.el5
- date: further relative time handling fix for strotime (#444425)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment