2024-02-21 20:14:44 +06:00
|
|
|
%define php_ver 83
|
|
|
|
%define php_prefix /opt/php%{php_ver}
|
|
|
|
|
|
|
|
%define _default_patch_fuzz 2
|
|
|
|
%undefine _missing_build_ids_terminate_build
|
|
|
|
|
|
|
|
%if 0%{?rhel} >= 7
|
|
|
|
%define apxs /usr/bin/apxs
|
|
|
|
%else
|
|
|
|
%define apxs /usr/sbin/apxs
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%bcond_without memcache
|
|
|
|
%bcond_without memcached
|
|
|
|
%bcond_without redis
|
|
|
|
%bcond_without igbinary
|
|
|
|
%bcond_without tzdata
|
|
|
|
|
|
|
|
# Extension versions
|
|
|
|
%global memcached_ver 3.2.0
|
|
|
|
%global memcache_ver 8.2
|
|
|
|
%global igbinary_ver 3.2.15
|
|
|
|
%global redis_ver 6.0.2
|
|
|
|
|
|
|
|
Summary: PHP scripting language for creating dynamic web sites
|
|
|
|
Name: isp-php%{php_ver}
|
2024-08-28 17:00:53 +06:00
|
|
|
Version: 8.3.11
|
2024-02-21 20:14:44 +06:00
|
|
|
Release: 1%{?dist}
|
|
|
|
License: PHP
|
|
|
|
Group: Development/Languages
|
|
|
|
URL: http://www.php.net/
|
|
|
|
|
|
|
|
Source0: http://www.php.net/distributions/php-%{version}.tar.xz
|
|
|
|
Source1: php.conf
|
|
|
|
Source2: php.ini
|
|
|
|
Source3: macros.php
|
|
|
|
Source4: php%{php_ver}.conf
|
|
|
|
|
|
|
|
Source10: https://pecl.php.net/get/memcached-%{memcached_ver}.tgz
|
|
|
|
Source11: https://pecl.php.net/get/memcache-%{memcache_ver}.tgz
|
|
|
|
Source12: https://pecl.php.net/get/igbinary-%{igbinary_ver}.tgz
|
|
|
|
Source13: https://pecl.php.net/get/redis-%{redis_ver}.tgz
|
|
|
|
|
|
|
|
# Build fixes
|
|
|
|
Patch1: php-7.4.0-httpd.patch
|
|
|
|
Patch5: php-7.2.0-includedir.patch
|
|
|
|
Patch6: php-8.0.0-embed.patch
|
|
|
|
Patch8: php-8.1.0-libdb.patch
|
|
|
|
Patch9: memcache-build-fix.patch
|
|
|
|
# RHEL backports
|
|
|
|
Patch10: php-8.2.0-curl.patch
|
|
|
|
|
|
|
|
# Functional changes
|
|
|
|
# Use system nikic/php-parser
|
|
|
|
Patch41: php-8.3.0-parser.patch
|
|
|
|
# use system tzdata
|
2024-08-28 17:00:53 +06:00
|
|
|
Patch42: php-8.3.11-systzdata-v24.patch
|
2024-02-21 20:14:44 +06:00
|
|
|
# See http://bugs.php.net/53436
|
|
|
|
Patch43: php-7.4.0-phpize.patch
|
|
|
|
# Use -lldap_r for OpenLDAP
|
|
|
|
Patch45: php-7.4.0-ldap_r.patch
|
|
|
|
# Ignore unsupported "threads" option on password_hash
|
|
|
|
Patch46: php-8.0.7-argon2.patch
|
|
|
|
# drop "Configure command" from phpinfo output
|
|
|
|
# and only use gcc (instead of full version)
|
|
|
|
Patch47: php-8.1.0-phpinfo.patch
|
|
|
|
|
|
|
|
Patch48: php-8.3.0-openssl-ec-param.patch
|
|
|
|
|
|
|
|
# RC Patch
|
|
|
|
Patch91: php-7.2.0-oci8conf.patch
|
|
|
|
|
|
|
|
# Upstream fixes (100+)
|
|
|
|
Patch121: php_fpm_stop.patch
|
|
|
|
Patch122: php_fpm_service.patch
|
|
|
|
Patch124: krb.patch
|
|
|
|
Patch125: mbstring_onig_cent6.patch
|
|
|
|
|
|
|
|
# Security fixes (200+)
|
|
|
|
|
|
|
|
# Fixes for tests (300+)
|
|
|
|
# Factory is droped from system tzdata
|
|
|
|
Patch300: php-7.4.0-datetests.patch
|
|
|
|
|
|
|
|
# WIP
|
|
|
|
|
|
|
|
|
|
|
|
%if 0%{?rhel} < 7
|
|
|
|
BuildRequires: automake
|
|
|
|
BuildRequires: oniguruma5php-devel
|
|
|
|
BuildRequires: mysqlclient18-devel >= 5.5.28
|
|
|
|
BuildRequires: libpq-devel
|
|
|
|
BuildRequires: libxcrypt-devel
|
|
|
|
%else
|
|
|
|
BuildRequires: automake
|
|
|
|
BuildRequires: postgresql-devel
|
|
|
|
%if 0%{?rhel} == 8
|
|
|
|
BuildRequires: mysql-devel
|
|
|
|
%else
|
|
|
|
BuildRequires: mariadb-devel
|
|
|
|
%endif
|
|
|
|
%endif
|
2024-02-28 10:19:05 +06:00
|
|
|
BuildRequires: pkgconfig(openssl) >= 3.0
|
2024-02-21 20:14:44 +06:00
|
|
|
BuildRequires: autoconf, m4
|
|
|
|
BuildRequires: gmp-devel
|
|
|
|
BuildRequires: libxml2-devel
|
|
|
|
BuildRequires: libwebp-devel
|
|
|
|
BuildRequires: libcurl-devel
|
|
|
|
BuildRequires: libffi-devel
|
|
|
|
BuildRequires: krb5-devel
|
|
|
|
BuildRequires: cyrus-sasl-devel
|
|
|
|
BuildRequires: bzip2-devel
|
|
|
|
BuildRequires: libssh2-devel
|
|
|
|
BuildRequires: openldap-devel
|
|
|
|
BuildRequires: oniguruma-devel
|
|
|
|
BuildRequires: libacl-devel
|
|
|
|
BuildRequires: wget, tar
|
|
|
|
BuildRequires: pam-devel libstdc++-devel
|
|
|
|
BuildRequires: sqlite-devel zlib-devel
|
|
|
|
BuildRequires: smtpdaemon libedit-devel, libtool > 1.4.2
|
|
|
|
BuildRequires: perl
|
|
|
|
BuildRequires: enchant-devel lmdb-devel firebird-devel
|
|
|
|
BuildRequires: recode-devel aspell-devel
|
|
|
|
BuildRequires: libtidy-devel libXpm-devel libxslt-devel
|
|
|
|
BuildRequires: net-snmp-devel unixODBC-devel
|
|
|
|
BuildRequires: libtool-ltdl-devel libXpm-devel
|
|
|
|
BuildRequires: libjpeg-devel libpng-devel freetype-devel
|
|
|
|
BuildRequires: mhash-devel systemtap-sdt-devel gdbm-devel
|
|
|
|
%if 0%{?rhel} < 7
|
|
|
|
BuildRequires: db4-devel
|
|
|
|
BuildRequires: libc-client-devel
|
|
|
|
BuildRequires: rx-libxml2-devel
|
|
|
|
BuildRequires: rx-krb5-devel
|
|
|
|
BuildRequires: rx-cyrus-sasl-devel
|
|
|
|
%else
|
|
|
|
BuildRequires: libdb-devel
|
|
|
|
BuildRequires: uw-imap-static
|
|
|
|
%endif
|
|
|
|
BuildRequires: patch
|
|
|
|
BuildRequires: httpd-devel
|
|
|
|
%if 0%{?rhel} >= 7
|
|
|
|
BuildRequires: systemd-devel
|
|
|
|
%endif
|
|
|
|
BuildRequires: libmemcached-devel >= 1.0.15
|
|
|
|
BuildRequires: libevent2-devel
|
|
|
|
BuildRequires: pkgconfig(icu-i18n) >= 60
|
|
|
|
BuildRequires: pkgconfig(libsodium)
|
|
|
|
BuildRequires: freetds-devel
|
|
|
|
BuildRequires: re2c >= 0.13.4
|
|
|
|
BuildRequires: gd-devel >= 2.3.0
|
|
|
|
BuildRequires: bats
|
|
|
|
BuildRequires: pkgconfig(capstone) >= 3.0
|
|
|
|
BuildRequires: tokyocabinet-devel
|
|
|
|
%if 0%{?rhel} == 7
|
|
|
|
Provides: bundled(pcre2) = 10.32
|
|
|
|
%else
|
|
|
|
BuildRequires: pcre2-devel >= 10.30
|
|
|
|
%endif
|
|
|
|
%if 0%{?rhel} >= 8
|
|
|
|
BuildRequires: gcc gcc-c++
|
|
|
|
BuildRequires: libzip-devel
|
|
|
|
%else
|
|
|
|
%if 0%{?rhel} == 7
|
|
|
|
BuildRequires: devtoolset-8-gcc devtoolset-8-gcc-c++ devtoolset-8-build
|
|
|
|
%else
|
|
|
|
BuildRequires: gcc gcc-c++
|
|
|
|
%endif
|
|
|
|
BuildRequires: libzip5-devel
|
|
|
|
%endif
|
|
|
|
|
|
|
|
Requires: freetds
|
|
|
|
Requires: libpq >= 15
|
|
|
|
|
|
|
|
%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.
|
|
|
|
|
|
|
|
%package mod-apache
|
|
|
|
Summary: Apache module
|
|
|
|
Requires: %{name}%{?_isa} = %{version}-%{release}
|
|
|
|
|
|
|
|
%description mod-apache
|
|
|
|
Apache module
|
|
|
|
|
|
|
|
%package fpm
|
|
|
|
Summary: Fpm service
|
|
|
|
Requires: %{name}%{?_isa} = %{version}-%{release}
|
|
|
|
|
|
|
|
%description fpm
|
|
|
|
PHP-fpm service %{version}
|
|
|
|
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -q -n php-%{version}
|
|
|
|
|
|
|
|
tar -xf %{SOURCE10}
|
|
|
|
tar -xf %{SOURCE11}
|
|
|
|
tar -xf %{SOURCE12}
|
|
|
|
tar -xf %{SOURCE13}
|
|
|
|
mv memcached-%{memcached_ver} ext/memcached
|
|
|
|
mv memcache-%{memcache_ver} ext/memcache
|
|
|
|
mv igbinary-%{igbinary_ver} ext/igbinary
|
|
|
|
mv redis-%{redis_ver} ext/redis
|
|
|
|
|
|
|
|
%patch1 -p1 -b .mpmcheck
|
|
|
|
%patch5 -p1 -b .includedir
|
|
|
|
%patch6 -p1 -b .embed
|
|
|
|
%patch8 -p1 -b .libdb
|
|
|
|
%patch9 -p1 -b .memcache
|
|
|
|
%if 0%{?rhel}
|
|
|
|
%patch10 -p1 -b .curltls
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%patch41 -p1 -b .syslib
|
|
|
|
%if %{with tzdata}
|
|
|
|
%patch42 -p1 -b .systzdata
|
|
|
|
%endif
|
|
|
|
%patch43 -p1 -b .headers
|
|
|
|
%patch45 -p1 -b .ldap_r
|
|
|
|
%patch46 -p1 -b .argon2
|
|
|
|
%patch47 -p1 -b .phpinfo
|
|
|
|
|
|
|
|
%patch91 -p1 -b .remi-oci8
|
|
|
|
|
|
|
|
# upstream patches
|
|
|
|
%patch121 -p1 -b .fpmstop
|
|
|
|
%patch122 -p1 -b .fpmservice
|
|
|
|
|
|
|
|
%patch124 -p1 -b .krb
|
|
|
|
%patch125 -p1 -b .onig
|
|
|
|
|
|
|
|
# security patches
|
|
|
|
|
|
|
|
# Fixes for tests related to tzdata
|
|
|
|
%if %{with tzdata}
|
|
|
|
%patch300 -p1 -b .datetests
|
|
|
|
%endif
|
|
|
|
|
|
|
|
# WIP patch
|
|
|
|
|
|
|
|
# Multiple builds for multiple SAPIs
|
|
|
|
mkdir \
|
|
|
|
build-fpm \
|
|
|
|
build-apache \
|
|
|
|
build-embedded \
|
|
|
|
build-cgi
|
|
|
|
|
|
|
|
# https://bugs.php.net/63362 - Not needed but installed headers.
|
|
|
|
# Drop some Windows specific headers to avoid installation,
|
|
|
|
# before build to ensure they are really not needed.
|
|
|
|
rm -f TSRM/tsrm_win32.h \
|
|
|
|
TSRM/tsrm_config.w32.h \
|
|
|
|
Zend/zend_config.w32.h \
|
|
|
|
ext/mysqlnd/config-win.h \
|
|
|
|
ext/standard/winver.h \
|
|
|
|
main/win32_internal_function_disabled.h \
|
|
|
|
main/win95nt.h
|
|
|
|
|
|
|
|
# Fix some bogus permissions
|
|
|
|
find . -name \*.[ch] -exec chmod 644 {} \;
|
|
|
|
chmod 644 README.*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%build
|
|
|
|
%if 0%{?rhel} == 7
|
|
|
|
. /opt/rh/devtoolset-8/enable
|
|
|
|
export CC=/opt/rh/devtoolset-8/root/usr/bin/gcc
|
|
|
|
export CPP=/opt/rh/devtoolset-8/root/usr/bin/cpp
|
|
|
|
export CXX=/opt/rh/devtoolset-8/root/usr/bin/c++
|
|
|
|
#. /etc/profile.d/modules.sh
|
|
|
|
#module load automake
|
|
|
|
%endif
|
|
|
|
|
|
|
|
./buildconf --force
|
|
|
|
CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -Wno-pointer-sign"
|
|
|
|
%if 0%{?rhel} > 7
|
|
|
|
CFLAGS="$CFLAGS -mshstk"
|
|
|
|
%endif
|
|
|
|
export CFLAGS
|
|
|
|
|
|
|
|
PREFIX=%{php_prefix}
|
|
|
|
syspref=/usr
|
|
|
|
%define syspref /usr
|
|
|
|
|
|
|
|
EXTENSION_DIR=%{php_prefix}/lib/php/modules; export EXTENSION_DIR
|
|
|
|
PEAR_INSTALLDIR=%{php_prefix}/share/pear; export PEAR_INSTALLDIR
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Set build date from https://reproducible-builds.org/specs/source-date-epoch/
|
|
|
|
export SOURCE_DATE_EPOCH=$(date +%s -r NEWS)
|
|
|
|
export PHP_UNAME=$(uname)
|
|
|
|
export PHP_BUILD_SYSTEM=$(cat /etc/redhat-release | sed -e 's/ Beta//')
|
|
|
|
%if 0%{?vendor:1}
|
|
|
|
export PHP_BUILD_PROVIDER="%{vendor}"
|
|
|
|
%endif
|
|
|
|
export PHP_BUILD_COMPILER="$(gcc --version | head -n1)"
|
|
|
|
export PHP_BUILD_ARCH="%{_arch}"
|
|
|
|
|
|
|
|
# Force use of system libtool:
|
|
|
|
libtoolize --force --copy
|
|
|
|
cat $(aclocal --print-ac-dir)/{libtool,ltoptions,ltsugar,ltversion,lt~obsolete}.m4 >build/libtool.m4
|
|
|
|
|
|
|
|
%if 0%{?gh_date}
|
|
|
|
# Bison files
|
|
|
|
scripts/dev/genfiles
|
|
|
|
%endif
|
|
|
|
|
|
|
|
# Regenerate configure scripts (patches change config.m4's)
|
|
|
|
touch configure.ac
|
|
|
|
./buildconf --force
|
|
|
|
|
|
|
|
CFLAGS=" $RPM_OPT_FLAGS $CFLAGS -fno-strict-aliasing -Wno-pointer-sign "
|
|
|
|
%if 0%{?rhel} == 6
|
|
|
|
CFLAGS="-I/opt/rx/includes $RPM_OPT_FLAGS $CFLAGS -fno-strict-aliasing -Wno-pointer-sign "
|
|
|
|
%endif
|
|
|
|
export CFLAGS
|
|
|
|
|
|
|
|
LDFLAGS="-L%{syspref}/%{_lib}/pgsql -Wl,-rpath=%{syspref}/%{_lib}/pgsql -L/opt/rx/lib -Wl,-rpath=/opt/rx/lib $LDFLAGS"
|
|
|
|
export LDFLAGS
|
|
|
|
|
|
|
|
CXXFLAGS=" $CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0 "
|
|
|
|
|
|
|
|
export PKG_CONFIG_PATH=/opt/rx/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}
|
|
|
|
|
|
|
|
# Shell function to configure and build a PHP tree.
|
|
|
|
build() {
|
|
|
|
# Old/recent bison version seems to produce a broken parser;
|
|
|
|
# upstream uses GNU Bison 2.3. Workaround:
|
|
|
|
mkdir Zend && cp ../Zend/zend_{language,ini}_{parser,scanner}.[ch] Zend
|
|
|
|
|
|
|
|
# Always static:
|
|
|
|
# date, filter, libxml, reflection, spl: not supported
|
|
|
|
# hash: for PHAR_SIG_SHA256 and PHAR_SIG_SHA512
|
|
|
|
# session: dep on hash, used by soap
|
|
|
|
# pcre: used by filter, zip
|
|
|
|
# pcntl, readline: only used by CLI sapi
|
|
|
|
# openssl: for PHAR_SIG_OPENSSL
|
|
|
|
# zlib: used by image
|
|
|
|
|
|
|
|
ln -sf ../configure
|
|
|
|
./configure \
|
|
|
|
--prefix=%{php_prefix} \
|
|
|
|
--with-config-file-path=%{php_prefix}/etc \
|
|
|
|
--with-config-file-scan-dir=%{php_prefix}/etc/php.d \
|
|
|
|
--enable-rtld-now \
|
|
|
|
--cache-file=../config.cache \
|
|
|
|
--with-libdir=%{_lib} \
|
|
|
|
--disable-debug \
|
|
|
|
--with-pic \
|
|
|
|
--disable-rpath \
|
|
|
|
--without-gdbm \
|
2024-02-28 10:19:05 +06:00
|
|
|
--with-openssl=/usr \
|
2024-02-21 20:14:44 +06:00
|
|
|
--with-libxml=/opt/rx \
|
|
|
|
--without-external-libcrypt \
|
|
|
|
--with-system-ciphers \
|
|
|
|
%if 0%{?rhel} != 7
|
|
|
|
--with-external-pcre \
|
|
|
|
%endif
|
|
|
|
--with-zlib \
|
|
|
|
--with-layout=GNU \
|
|
|
|
--with-kerberos \
|
|
|
|
%if 0%{?fedora} >= 28 || 0%{?rhel} >= 6
|
|
|
|
--with-system-tzdata \
|
|
|
|
%endif
|
|
|
|
--with-mhash \
|
|
|
|
--without-password-argon2 \
|
|
|
|
--enable-dtrace \
|
|
|
|
$*
|
|
|
|
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 most the shared extensions
|
|
|
|
pushd build-cgi
|
|
|
|
|
|
|
|
%if 0%{?rhel} == 6
|
|
|
|
export SASL_LIBS="-lsasl2"
|
|
|
|
export SASL_CFLAGS=""
|
|
|
|
export ONIG_LIBS="`onig-config --libs`"
|
|
|
|
export ONIG_CFLAGS="`onig-config --cflags`"
|
|
|
|
export ORIG_LDFLAGS=$LDFLAGS
|
|
|
|
%endif
|
|
|
|
|
|
|
|
build --libdir=%{_libdir}/php \
|
|
|
|
--enable-pcntl \
|
|
|
|
--enable-opcache \
|
|
|
|
%if 0%{?rhel} == 6
|
|
|
|
--disable-huge-code-pages \
|
|
|
|
%endif
|
|
|
|
--enable-phpdbg \
|
|
|
|
--with-imap=shared --with-imap-ssl \
|
|
|
|
--enable-mbstring=shared \
|
|
|
|
--enable-mbregex \
|
|
|
|
--enable-gd=shared \
|
|
|
|
--with-pear \
|
|
|
|
%if 0%{?rhel}
|
|
|
|
--with-external-gd \
|
|
|
|
%else
|
|
|
|
--with-webp \
|
|
|
|
--with-jpeg \
|
|
|
|
--with-xpm \
|
|
|
|
--with-freetype \
|
|
|
|
%endif
|
|
|
|
--with-gmp=shared,%{syspref} \
|
|
|
|
--enable-calendar=shared \
|
|
|
|
--enable-bcmath=shared \
|
|
|
|
--with-bz2=shared,%{syspref} \
|
|
|
|
--enable-ctype=shared \
|
|
|
|
--enable-dba=shared \
|
|
|
|
--with-tcadb=%{syspref} \
|
|
|
|
--with-lmdb=%{syspref} \
|
|
|
|
--enable-exif=shared \
|
|
|
|
--enable-ftp=shared \
|
|
|
|
--with-gettext=shared \
|
|
|
|
--with-iconv=shared \
|
|
|
|
--enable-sockets=shared \
|
|
|
|
--enable-tokenizer=shared \
|
|
|
|
--with-ldap=shared --with-ldap-sasl \
|
|
|
|
--enable-mysqlnd=shared,%{_prefix} \
|
|
|
|
--with-mysqli=shared,mysqlnd \
|
|
|
|
--with-mysql-sock=%{mysql_sock} \
|
|
|
|
--with-pdo-firebird=shared \
|
|
|
|
--enable-dom=shared \
|
|
|
|
--with-pgsql=shared,%{_prefix} \
|
|
|
|
--enable-simplexml=shared \
|
|
|
|
--enable-xml=shared \
|
|
|
|
--with-snmp=shared,%{syspref} \
|
|
|
|
--enable-soap=shared \
|
|
|
|
--with-xsl=shared,%{syspref} \
|
|
|
|
--enable-xmlreader=shared --enable-xmlwriter=shared \
|
|
|
|
--with-curl=shared,%{syspref} \
|
|
|
|
--enable-pdo=shared \
|
|
|
|
--with-pdo-odbc=shared,unixODBC,%{syspref} \
|
|
|
|
--with-pdo-mysql=shared,mysqlnd \
|
|
|
|
--with-pdo-pgsql=shared,%{syspref} \
|
|
|
|
--with-pdo-sqlite=shared \
|
|
|
|
--with-sqlite3=shared,%{syspref} \
|
|
|
|
--with-zip=shared \
|
|
|
|
--without-readline \
|
|
|
|
--with-libedit \
|
|
|
|
--with-pspell=shared \
|
|
|
|
--enable-phar=shared \
|
|
|
|
--with-tidy=shared,%{syspref} \
|
|
|
|
--with-pdo-dblib=shared,%{syspref} \
|
|
|
|
--enable-sysvmsg=shared --enable-sysvshm=shared --enable-sysvsem=shared \
|
|
|
|
--enable-shmop=shared \
|
|
|
|
--enable-posix=shared \
|
|
|
|
--with-unixODBC=shared,%{syspref} \
|
|
|
|
--enable-intl=shared \
|
|
|
|
--with-enchant=shared \
|
|
|
|
--enable-fileinfo=shared \
|
|
|
|
--with-ffi=shared,%{syspref} \
|
|
|
|
%if %{with igbinary}
|
|
|
|
--enable-igbinary=shared \
|
|
|
|
%endif
|
|
|
|
%if %{with redis}
|
|
|
|
--enable-redis=shared \
|
|
|
|
--enable-redis-json \
|
|
|
|
%if %{with igbinary}
|
|
|
|
--enable-redis-igbinary \
|
|
|
|
%endif
|
|
|
|
%endif
|
|
|
|
%if %{with memcache}
|
|
|
|
--enable-memcache=shared \
|
|
|
|
%endif
|
|
|
|
%if %{with memcached}
|
|
|
|
--disable-memcached-sasl \
|
|
|
|
--enable-memcached=shared \
|
|
|
|
--enable-memcached-session \
|
|
|
|
--enable-memcached-json \
|
|
|
|
--with-libmemcached-dir=${syspref} \
|
|
|
|
%endif
|
|
|
|
--with-sodium=shared
|
|
|
|
|
|
|
|
popd
|
|
|
|
|
|
|
|
without_shared="--disable-gd \
|
|
|
|
--disable-dom --disable-dba --without-unixODBC \
|
|
|
|
--disable-opcache \
|
|
|
|
--disable-phpdbg \
|
|
|
|
--without-ffi \
|
|
|
|
--disable-xmlreader --disable-xmlwriter \
|
|
|
|
--without-sodium \
|
|
|
|
--without-sqlite3 --disable-phar --disable-fileinfo \
|
|
|
|
--without-pspell \
|
|
|
|
--without-curl --disable-posix --disable-xml \
|
|
|
|
--disable-simplexml --disable-exif --without-gettext \
|
|
|
|
--without-iconv --disable-ftp --without-bz2 --disable-ctype \
|
|
|
|
--disable-shmop --disable-sockets --disable-tokenizer \
|
|
|
|
--disable-sysvmsg --disable-sysvshm --disable-sysvsem"
|
|
|
|
|
|
|
|
# Build Apache module, and the CLI SAPI, /usr/bin/php
|
|
|
|
pushd build-apache
|
|
|
|
build --with-apxs2=%{apxs} \
|
|
|
|
--libdir=%{_libdir}/php \
|
|
|
|
--without-mysqli \
|
|
|
|
--disable-pdo \
|
|
|
|
${without_shared}
|
|
|
|
popd
|
|
|
|
|
|
|
|
# Build php-fpm
|
|
|
|
pushd build-fpm
|
|
|
|
build --enable-fpm \
|
|
|
|
%if 0%{?rhel} >= 7
|
|
|
|
--with-fpm-systemd \
|
|
|
|
%else
|
|
|
|
--without-fpm-systemd \
|
|
|
|
%endif
|
|
|
|
--with-fpm-acl \
|
|
|
|
--libdir=%{_libdir}/php \
|
|
|
|
--without-mysqli \
|
|
|
|
--disable-pdo \
|
|
|
|
${without_shared}
|
|
|
|
popd
|
|
|
|
|
|
|
|
# Build for inclusion as embedded script language into applications,
|
|
|
|
# /usr/lib[64]/libphp.so
|
|
|
|
pushd build-embedded
|
|
|
|
build --enable-embed \
|
|
|
|
--without-mysqli \
|
|
|
|
--disable-pdo \
|
|
|
|
${without_shared}
|
|
|
|
popd
|
|
|
|
|
|
|
|
%install
|
|
|
|
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
|
|
|
|
CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -Wno-pointer-sign"
|
|
|
|
export CFLAGS
|
|
|
|
|
|
|
|
make -C build-cgi install INSTALL_ROOT=$RPM_BUILD_ROOT
|
|
|
|
make -C build-fpm install INSTALL_ROOT=$RPM_BUILD_ROOT
|
|
|
|
|
|
|
|
# Install the version for embedded script language in applications + php_embed.h
|
|
|
|
make -C build-embedded install-sapi install-headers \
|
|
|
|
INSTALL_ROOT=$RPM_BUILD_ROOT
|
|
|
|
|
|
|
|
install -m 755 -d $RPM_BUILD_ROOT/%{php_prefix}/lib/httpd/modules
|
|
|
|
install -m 755 build-apache/libs/libphp.so $RPM_BUILD_ROOT/%{php_prefix}/lib/httpd/modules
|
|
|
|
|
|
|
|
# apache load
|
|
|
|
install -m 755 -d $RPM_BUILD_ROOT/etc/httpd/php-available.d
|
|
|
|
install -m 644 %{SOURCE4} $RPM_BUILD_ROOT/etc/httpd/php-available.d
|
|
|
|
|
|
|
|
# # Ioncube
|
|
|
|
# install -m 755 ioncube/ioncube_loader_lin_8.1.so $RPM_BUILD_ROOT/%{php_prefix}/lib/php/modules/
|
|
|
|
|
|
|
|
ln -sf phar.phar $RPM_BUILD_ROOT/%{php_prefix}/bin/phar
|
|
|
|
|
|
|
|
# php.ini
|
|
|
|
mkdir -p $RPM_BUILD_ROOT/%{php_prefix}/etc
|
|
|
|
install -m 644 %{SOURCE2} $RPM_BUILD_ROOT/%{php_prefix}/etc/php.ini
|
|
|
|
|
|
|
|
# fpm.conf
|
|
|
|
cp $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.conf.default $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.conf
|
|
|
|
sed -i -r '/('"'"'|\[)www('"'"'|\])/Q' $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.conf
|
|
|
|
grep -qE "include=%{php_prefix}/etc/php-fpm.d/\*.conf" $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.conf || echo "include = %{php_prefix}/etc/php-fpm.d/*.conf" >> $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.conf
|
|
|
|
grep -qE "include=%{php_prefix}/etc/php-fpm.d/pool.d/\*.conf" $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.conf || echo "include=%{php_prefix}/etc/php-fpm.d/pool.d/*.conf" >> $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.conf
|
|
|
|
sed -i -r "s/^;(syslog.ident = ).*/\1php-fpm%{php_ver}/" $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.conf
|
|
|
|
sed -i -r "s/^;(error_log = ).*/\1syslog/" $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.conf
|
|
|
|
mkdir -p $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.d
|
|
|
|
mkdir -p $RPM_BUILD_ROOT/%{php_prefix}/etc/php-fpm.d/pool.d
|
|
|
|
|
|
|
|
# fpm service
|
|
|
|
%if 0%{?rhel} >= 7
|
|
|
|
install -d -m 755 %{buildroot}%{_unitdir}
|
|
|
|
sed -i -r 's|\$\{prefix\}|%{php_prefix}|g; s|\$\{exec_prefix\}|%{php_prefix}|g' fpm/sapi/fpm/php-fpm.service
|
|
|
|
install -m 644 fpm/sapi/fpm/php-fpm.service %{buildroot}%{_unitdir}/php-fpm%{php_ver}.service
|
|
|
|
%else
|
|
|
|
install -d -m 755 %{buildroot}%{_initrddir}
|
|
|
|
install -p -D -m 0755 build-fpm/sapi/fpm/init.d.php-fpm %{buildroot}%{_initrddir}/php-fpm%{php_ver}
|
|
|
|
sed -i -r "/### BEGIN/,/### END/s/php-fpm/php-fpm%{php_ver}/g" %{buildroot}%{_initrddir}/php-fpm%{php_ver}
|
|
|
|
%endif
|
|
|
|
|
|
|
|
# fpm var run
|
|
|
|
install -d -m 755 %{buildroot}%{php_prefix}/var/run
|
|
|
|
|
|
|
|
mkdir -p $RPM_BUILD_ROOT/%{php_prefix}/etc/php.d
|
|
|
|
mkdir -p $RPM_BUILD_ROOT/%{php_prefix}/etc/mods-available
|
|
|
|
for ext in $(find $RPM_BUILD_ROOT/%{php_prefix}/lib/php/modules/ -name '*.so' | grep -Evi 'zend|ioncube|opcache.so' | awk -F/ '{print $NF}' | sed 's/\.so$//'); do
|
|
|
|
echo "extension=${ext}.so" > $RPM_BUILD_ROOT/%{php_prefix}/etc/mods-available/${ext}.ini
|
|
|
|
done
|
|
|
|
#echo "zend_extension=%{php_prefix}/lib/php/modules/ioncube_loader_lin_8.0.so" > $RPM_BUILD_ROOT/%{php_prefix}/etc/mods-available/ioncube.ini
|
|
|
|
echo "zend_extension=%{php_prefix}/lib/php/modules/opcache.so" >> $RPM_BUILD_ROOT/%{php_prefix}/etc/mods-available/zendopcache.ini
|
|
|
|
|
|
|
|
rm -rf $RPM_BUILD_ROOT/%{php_prefix}/lib/php/modules/*.a \
|
|
|
|
$RPM_BUILD_ROOT/\.channels* \
|
|
|
|
$RPM_BUILD_ROOT/\.depdb* \
|
|
|
|
$RPM_BUILD_ROOT/\.filemap \
|
|
|
|
$RPM_BUILD_ROOT/\.lock \
|
|
|
|
$RPM_BUILD_ROOT/\.registry
|
|
|
|
|
|
|
|
mv $RPM_BUILD_ROOT%{_libdir}/php/build $RPM_BUILD_ROOT%{php_prefix}/lib/php
|
|
|
|
|
|
|
|
%check
|
|
|
|
#installdir=%{buildroot} bats -t bats/test.bats
|
|
|
|
|
|
|
|
|
|
|
|
%post
|
|
|
|
if [ $1 -eq 1 ]; then
|
|
|
|
if [ -f /etc/sysconfig/clock ]; then
|
|
|
|
TZ=$(cat /etc/sysconfig/clock | sed "s|\"||g" | awk -F= '{print $2}')
|
|
|
|
elif [ -x /usr/bin/timedatectl ]; then
|
|
|
|
TZ=$(/usr/bin/timedatectl | awk '$1 ~ /Timezone:/ {print $2}')
|
|
|
|
test -z "${TZ}" && TZ=$(timedatectl | awk '$0 ~ /Time zone:/ {print $3}')
|
|
|
|
else
|
|
|
|
TZ=UTC
|
|
|
|
fi
|
|
|
|
if grep -qE "^date.timezone\s*=" %{php_prefix}/etc/php.ini ; then
|
|
|
|
sed -i -r "s|^date.timezone\s*=.*|date.timezone = ${TZ}|" %{php_prefix}/etc/php.ini
|
|
|
|
else
|
|
|
|
echo "date.timezone = ${TZ}" >> %{php_prefix}/etc/php.ini
|
|
|
|
fi
|
|
|
|
for ext in dom gd mbstring mysqlnd mysqli pdo pdo_mysql json curl zendopcache intl xmlreader xmlwriter zip ; do
|
|
|
|
case ${ext} in
|
|
|
|
mysqlnd|pdo)
|
|
|
|
extl=10-${ext}
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
extl=20-${ext}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
if [ -e %{php_prefix}/etc/mods-available/${ext}.ini ]; then
|
|
|
|
ln -sf ../mods-available/${ext}.ini %{php_prefix}/etc/php.d/${extl}.ini
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
else
|
|
|
|
if [ -f %{php_prefix}/etc/php.d/mysqli.ini ]; then
|
|
|
|
if [ ! -f %{php_prefix}/etc/php.d/10-mysqlnd.ini ] && [ ! -f %{php_prefix}/etc/php.d/mysqlnd.ini ]; then
|
|
|
|
ln -s ../mods-available/mysqlnd.ini %{php_prefix}/etc/php.d/10-mysqlnd.ini
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
# Fix DEVOPS-843
|
|
|
|
if [ -L %{php_prefix}/etc/php.d/20-json.ini ]; then
|
|
|
|
rm -f %{php_prefix}/etc/php.d/20-json.ini
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
%postun
|
|
|
|
if [ $1 -eq 0 ]; then
|
|
|
|
find %{php_prefix}/etc/php.d -type l -delete
|
|
|
|
fi
|
|
|
|
|
|
|
|
%post fpm
|
|
|
|
%if 0%{?rhel} >= 7
|
|
|
|
%systemd_post php-fpm%{php_ver}.service
|
|
|
|
if [ $1 -ge 1 ] ; then
|
|
|
|
systemctl try-restart php-fpm%{php_ver}.service >/dev/null 2>&1 || :
|
|
|
|
fi
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%preun fpm
|
|
|
|
%if 0%{?rhel} >= 7
|
|
|
|
%systemd_preun php-fpm%{php_ver}.service
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%postun fpm
|
|
|
|
%if 0%{?rhel} >= 7
|
|
|
|
%systemd_postun_with_restart php-fpm%{php_ver}.service
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
|
|
%files
|
|
|
|
%{php_prefix}/bin
|
|
|
|
%{php_prefix}/lib/php
|
|
|
|
%{php_prefix}/share/man/man1
|
|
|
|
%{php_prefix}/share/pear
|
|
|
|
%{php_prefix}/include
|
|
|
|
%config(noreplace) %{php_prefix}/etc/php.ini
|
|
|
|
#config(noreplace) %{php_prefix}/etc/pear.conf
|
|
|
|
%config(noreplace) %{php_prefix}/etc/mods-available/*.ini
|
|
|
|
%dir %{php_prefix}/etc/php.d
|
|
|
|
%dir %{php_prefix}/etc/mods-available
|
|
|
|
|
|
|
|
%files mod-apache
|
|
|
|
%{php_prefix}/lib/httpd/modules/*
|
|
|
|
%config(noreplace) /etc/httpd/php-available.d/php%{php_ver}.conf
|
|
|
|
|
|
|
|
%files fpm
|
|
|
|
%{php_prefix}/sbin/php-fpm
|
|
|
|
%dir %{php_prefix}/etc/php-fpm.d
|
|
|
|
%dir %{php_prefix}/etc/php-fpm.d/pool.d
|
|
|
|
%dir %{php_prefix}/var/run
|
|
|
|
%{php_prefix}/share/man/man8/php-fpm.8
|
|
|
|
%{php_prefix}/share/php/fpm/status.html
|
|
|
|
%{php_prefix}/etc/php-fpm.conf.default
|
|
|
|
%{php_prefix}/etc/php-fpm.d/www.conf.default
|
|
|
|
%config(noreplace) %{php_prefix}/etc/php-fpm.conf
|
|
|
|
%if 0%{?rhel} >= 7
|
|
|
|
%{_unitdir}/php-fpm%{php_ver}.service
|
|
|
|
%else
|
|
|
|
%{_initrddir}/php-fpm%{php_ver}
|
|
|
|
%endif
|