Gentoo Archives: gentoo-commits

From: Ole Markus With <olemarkus@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/php/
Date: Fri, 02 Oct 2015 16:05:35
Message-Id: 1443801809.567921fa673f5fbebd10ba2c085727a611fbf15c.olemarkus@gentoo
1 commit: 567921fa673f5fbebd10ba2c085727a611fbf15c
2 Author: Ole Markus With <olemarkus <AT> gentoo <DOT> org>
3 AuthorDate: Fri Oct 2 16:01:08 2015 +0000
4 Commit: Ole Markus With <olemarkus <AT> gentoo <DOT> org>
5 CommitDate: Fri Oct 2 16:03:29 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=567921fa
7
8 dev-lang/php: Version bumps
9
10 Package-Manager: portage-2.2.18
11
12 dev-lang/php/Manifest | 3 +
13 dev-lang/php/php-5.5.30.ebuild | 784 ++++++++++++++++++++++++++++++++++++++
14 dev-lang/php/php-5.6.14.ebuild | 784 ++++++++++++++++++++++++++++++++++++++
15 dev-lang/php/php-7.0.0_rc4.ebuild | 760 ++++++++++++++++++++++++++++++++++++
16 4 files changed, 2331 insertions(+)
17
18 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
19 index 70494b0..e4507a2 100644
20 --- a/dev-lang/php/Manifest
21 +++ b/dev-lang/php/Manifest
22 @@ -2,10 +2,13 @@ DIST php-5.4.44.tar.bz2 12705644 SHA256 8dd59e5ce9248cf36ac3de5412a518b8b24c01ac
23 DIST php-5.4.45.tar.bz2 12703324 SHA256 4e0d28b1554c95cfaea6fa2b64aac85433f158ce72bb571bcd5574f98f4c6582 SHA512 ba22207da70e5e8ddf9a1f41bbeb54ef4917630006c3412db8f858782baaa3ff49d7e5ca59bed76c37fc11dc518c475b81f33f0f32c533c8f00be338e0b0d9c5 WHIRLPOOL b34e465dd193e9c1f5dedd7c6f279bb10471e31120f2a84246927f160adb1e54ea56563c719e59ed0654e2fd0805cebcc00198d6f6153791edef52fd0f2288a7
24 DIST php-5.5.28.tar.bz2 13249927 SHA256 197d2c572e030c177e53d3763d59ac6d363d7c78dc22e6cc1e2ac65573d9c2f3 SHA512 4cb1e90d08bc90b35feaa4aa636d8484089d3b1868b19af99cfb27e815941798732c9a44c046bff5d48b60573657e67daff3991abbe6872a9ab3e1ab6f347b5f WHIRLPOOL 276b354cf3aa7ec3bb31602736fd724c0902832dc1a5f30d0ae288cd7c59f4614efda093a9968049996b7f2a5704d846a26e17f872754abf5be2d7badbf7c74b
25 DIST php-5.5.29.tar.bz2 13698565 SHA256 fbcee579ecc77cad6960a541116aee669cf145c2cd9a54bf60503a870843b946 SHA512 dd1e79d9c7b39be4af2bc72f93e6fc212316f1be38ced36b9de7a17f700550b6030402440a44a1b36690580e5ba083e333a0682f36cdfe65176552d8286191ae WHIRLPOOL d35ee633a9802acbbcdbb4d55031e392016ee0d901755e165119ae954185e6d67291d9ea45e6e634cf51601583c1dce4be92faeadb78c6a7e5ca4c7a8b69bd14
26 +DIST php-5.5.30.tar.bz2 13699702 SHA256 e7332a713cecdd1cb44a1b1336739885c9789f633f0f51236b25e48ab03c3b29 SHA512 9458126f579ace9e2aebdfa7ad7f8d097f1fd502f443d8fd66263ba3c542d579ca9c705e227725fae57e452649a3be7cb717a0330d339b93d3c6c94fa80dbc1f WHIRLPOOL 2aa6c61a48a231d81f6c746f94e42589d87b93d0526f02d6d15f731cbbca4aecdee84b443f7ec1891f2a524939c542ac6f94e15db90a23a8b19523463025d395
27 DIST php-5.6.12.tar.bz2 14094148 SHA256 6f27104272af7b2a996f85e4100fac627630fbdaf39d7bd263f16cf529c8853a SHA512 fba0b5d0474ee0429d77bb8848863e68c22bd08d1d675f73a0b09d001b3bbfc5f4c15237055ad9a2e3367dbc1ad52c98db83c093e524a55ef67e573688e4fb03 WHIRLPOOL ae72ac363edca0481bdf7120db8a6d9d923f4bb448eff2bcf95e2c9895a4fcf6e91f185c81fb879f0c75ca21caded4c68ea61262bc93984b9a1789a8dfcf58dd
28 DIST php-5.6.13.tar.bz2 14077633 SHA256 6358837c9cbab41b91ede59dbf0670ae0fb925a1369ecbc1a44a27212420f893 SHA512 80e89ae748255d40b466de6c61b4443432fd81ffb1510ae66f809ed0dd07eb4071ded5b7a975f997b2cb28553ac7e27c57b67734e268c894207e9efd78ae76bf WHIRLPOOL 9b0add1b05220f9ef60de2741dcd198d0b44a9813dc1a999e42700ddb1e879f3749056cdfb151a595bc7a14a65a38eca6d0f416ee36ebd013126a92878fd47db
29 +DIST php-5.6.14.tar.bz2 14073920 SHA256 36f295f11641c1839a5df00e693f685fd134c65e8a1d46e8ee0abae8662b2eb0 SHA512 af0c7fa5c7be15839b1189b2544ff725b935228030087c206f83727e7885750030b10bf2bfbd27adea6f18af90d4ecd3ced9defec88c5f98f7ed26b4e4c57981 WHIRLPOOL 8e31fc3dbeb22fa2a59112d2dcbe28f8102c8d5a14fd716d17f909399c06d27a10ea32d43ebd1a12cea78d9fd949ae7c7882628ae0c3abd7354d165107fa0c9d
30 DIST php-7.0.0RC1.tar.bz2 13882272 SHA256 47fafb124982941dca0ab27020949cc90f80e233cdf08b63b7644e294d0bd203 SHA512 6e099ddd1a2bc01b0bfdcbcd0e35199293af79782b8e9fa26f0dc6bb30a5fab1ff7d552d3e417a1d40d4c87fc1f759e8afbe8a5c735c2f074d18340b1ff7bf2b WHIRLPOOL e8adf87d0ef0cea2deb7e1548fe6a0624f2433a046d4fc823398211fecd22b5e23e15a82ca7d77f611ffae2f23d73c2342946df60db24fe15688101e7daac1f4
31 DIST php-7.0.0RC2.tar.bz2 13911099 SHA256 0b047f1f52eb9236d5a2b4b3112fdd269d00a2ec4d3f6269865a917b80786d57 SHA512 9be983a54fad4e6ab9ec488c34c7732ada77f5fc9e7497188a3853d2bf0fa4da2f5f91ade86a0515574463b6093a29e064957779522cff0469bae0a42fde3d7c WHIRLPOOL 21b90babf62a91ef0d2360100255f71eb8b51a04d893c731b658a7c481a5d179e542b5cd09083acd305dea4c40138ba3b59bab66d22effd0f9aacab79cb7b9e2
32 DIST php-7.0.0RC3.tar.bz2 13941348 SHA256 5f435e2b4e67def405b407b0b2ab3060493bb9a66f83563570a941832493112d SHA512 1251ec2d0dd7ea9da1d1ecf0711fd0347170fe472df2c125817f3bfd2ddbb69e218627f2b49efcbe875f8a9cc8e0e4348aafae2fbb2a45d099d6285eec146945 WHIRLPOOL 1d3663edc24968cb2618020539babae88c248a7eddc2acab0c4a91e4181228b1dfb7a6cd3df9c662329b738c20bb34088aa168c74e5bb2f8978f378a3101688a
33 +DIST php-7.0.0RC4.tar.bz2 13973356 SHA256 5475a6856b600a7a4f31a0276339725140d64da31a8a363e0cdb45ed233f27cd SHA512 02a55ce90d66f6ee2019461658eeb7ce7fd2c78c5c32869a3882f0f6fd6a54454b26f3440266ed8e850da740633243f697086a5c0cf0d616f0029e6ba4ddd1bf WHIRLPOOL 7695a9e3b54470c456104e29082479d27c47806e86f739d9d01ffe57580d28b1130d3aaadd3d78f205b457ed4d3207a3ad52a95996cef6b70898ed948b1373a5
34 DIST php-7.0.0beta1.tar.bz2 14642405 SHA256 04a556a1d9108119c661f6f50ab71f94ad9fb61be3ee08cec8e2710d9df643de SHA512 496388128d5cff5c86bebb253f08e55c6b5957ed33abf96060818c31c3f8b81dd989fc437556b8071b6ba0ebb30e6b251f2b2c3326b204891467ae73c4967d9f WHIRLPOOL 0b33f5bc8df641d04f11c0e8e8a9c6f511521f9bd092392ea2bf25983539f84d1bf636cb90719672032ebdec5c64dc0b9cefe1dbdbb5e28d2c68aab72e950370
35 DIST php-patchset-5.4-r2.tar.bz2 5824 SHA256 4a47f4d31f50a244f85349486cdb3474cf315562e097ed4c116c2b9b5730ecef SHA512 3c2523458a627373da7acb93fb2cd621f50b19fe2ba1d30beb62eeaaa39045262b917cfd0b631046fec9c8027cfa99bd0426a079ab45eb172b21d25d6e085dde WHIRLPOOL fe4f015e2f0dc66cc23ef16fb5bb33117952593ae0770d4bcd37ecc1c431cbcc7874189d265696305c60b4e395e7ce902667e38203db46867304868271affdea
36
37 diff --git a/dev-lang/php/php-5.5.30.ebuild b/dev-lang/php/php-5.5.30.ebuild
38 new file mode 100644
39 index 0000000..dcf8362
40 --- /dev/null
41 +++ b/dev-lang/php/php-5.5.30.ebuild
42 @@ -0,0 +1,784 @@
43 +# Copyright 1999-2015 Gentoo Foundation
44 +# Distributed under the terms of the GNU General Public License v2
45 +# $Id$
46 +
47 +EAPI=5
48 +
49 +inherit eutils autotools flag-o-matic versionator depend.apache apache-module db-use libtool systemd
50 +
51 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
52 +
53 +function php_get_uri ()
54 +{
55 + case "${1}" in
56 + "php-pre")
57 + echo "http://downloads.php.net/dsp/${2}"
58 + ;;
59 + "php")
60 + echo "http://www.php.net/distributions/${2}"
61 + ;;
62 + "olemarkus")
63 + echo "https://dev.gentoo.org/~olemarkus/php/${2}"
64 + ;;
65 + "gentoo")
66 + echo "mirror://gentoo/${2}"
67 + ;;
68 + *)
69 + die "unhandled case in php_get_uri"
70 + ;;
71 + esac
72 +}
73 +
74 +PHP_MV="$(get_major_version)"
75 +SLOT="$(get_version_component_range 1-2)"
76 +
77 +# alias, so we can handle different types of releases (finals, rcs, alphas,
78 +# betas, ...) w/o changing the whole ebuild
79 +PHP_PV="${PV/_rc/RC}"
80 +PHP_PV="${PHP_PV/_alpha/alpha}"
81 +PHP_PV="${PHP_PV/_beta/beta}"
82 +PHP_RELEASE="php"
83 +[[ ${PV} == ${PV/_alpha/} ]] || PHP_RELEASE="php-pre"
84 +[[ ${PV} == ${PV/_beta/} ]] || PHP_RELEASE="php-pre"
85 +[[ ${PV} == ${PV/_rc/} ]] || PHP_RELEASE="php-pre"
86 +PHP_P="${PN}-${PHP_PV}"
87 +
88 +PHP_SRC_URI="$(php_get_uri "${PHP_RELEASE}" "${PHP_P}.tar.bz2")"
89 +
90 +PHP_FPM_CONF_VER="1"
91 +
92 +SRC_URI="${PHP_SRC_URI}"
93 +
94 +DESCRIPTION="The PHP language runtime engine: CLI, CGI, FPM/FastCGI, Apache2 and embed SAPIs"
95 +HOMEPAGE="http://php.net/"
96 +LICENSE="PHP-3"
97 +
98 +S="${WORKDIR}/${PHP_P}"
99 +
100 +# We can build the following SAPIs in the given order
101 +SAPIS="embed cli cgi fpm apache2"
102 +
103 +# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
104 +IUSE="${IUSE}
105 + ${SAPIS/cli/+cli}
106 + threads"
107 +
108 +IUSE="${IUSE} bcmath berkdb bzip2 calendar cdb cjk
109 + crypt +ctype curl debug
110 + enchant exif frontbase +fileinfo +filter firebird
111 + flatfile ftp gd gdbm gmp +hash +iconv imap inifile
112 + intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit mhash
113 + mssql mysql libmysqlclient mysqli nls
114 + oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
115 + readline recode selinux +session sharedmem
116 + +simplexml snmp soap sockets spell sqlite ssl
117 + sybase-ct sysvipc systemd tidy +tokenizer truetype unicode vpx wddx
118 + +xml xmlreader xmlwriter xmlrpc xpm xslt zip zlib"
119 +
120 +DEPEND="
121 + >=app-eselect/eselect-php-0.7.1-r3[apache2?,fpm?]
122 + >=dev-libs/libpcre-8.32[unicode]
123 + apache2? ( || ( >=www-servers/apache-2.4[apache2_modules_unixd,threads=]
124 + <www-servers/apache-2.4[threads=] ) )
125 + berkdb? ( =sys-libs/db-4* )
126 + bzip2? ( app-arch/bzip2 )
127 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
128 + cjk? ( !gd? (
129 + virtual/jpeg:0
130 + media-libs/libpng:0=
131 + sys-libs/zlib
132 + ) )
133 + crypt? ( >=dev-libs/libmcrypt-2.4 )
134 + curl? ( >=net-misc/curl-7.10.5 )
135 + enchant? ( app-text/enchant )
136 + exif? ( !gd? (
137 + virtual/jpeg:0
138 + media-libs/libpng:0=
139 + sys-libs/zlib
140 + ) )
141 + firebird? ( dev-db/firebird )
142 + gd? ( virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
143 + gdbm? ( >=sys-libs/gdbm-1.8.0 )
144 + gmp? ( >=dev-libs/gmp-4.1.2 )
145 + iconv? ( virtual/libiconv )
146 + imap? ( virtual/imap-c-client[ssl=] )
147 + intl? ( dev-libs/icu:= )
148 + iodbc? ( dev-db/libiodbc )
149 + kerberos? ( virtual/krb5 )
150 + ldap? ( >=net-nds/openldap-1.2.11 )
151 + ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
152 + libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
153 + mssql? ( dev-db/freetds[mssql] )
154 + libmysqlclient? (
155 + mysql? ( virtual/mysql )
156 + mysqli? ( >=virtual/mysql-4.1 )
157 + )
158 + nls? ( sys-devel/gettext )
159 + oci8-instant-client? ( dev-db/oracle-instantclient-basic )
160 + odbc? ( >=dev-db/unixODBC-1.8.13 )
161 + postgres? ( dev-db/postgresql )
162 + qdbm? ( dev-db/qdbm )
163 + readline? ( sys-libs/readline )
164 + recode? ( app-text/recode )
165 + sharedmem? ( dev-libs/mm )
166 + simplexml? ( >=dev-libs/libxml2-2.6.8 )
167 + snmp? ( >=net-analyzer/net-snmp-5.2 )
168 + soap? ( >=dev-libs/libxml2-2.6.8 )
169 + spell? ( >=app-text/aspell-0.50 )
170 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
171 + ssl? ( >=dev-libs/openssl-0.9.7 )
172 + sybase-ct? ( dev-db/freetds )
173 + tidy? ( app-text/htmltidy )
174 + truetype? (
175 + =media-libs/freetype-2*
176 + >=media-libs/t1lib-5.0.0
177 + !gd? (
178 + virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
179 + )
180 + unicode? ( dev-libs/oniguruma )
181 + vpx? ( media-libs/libvpx )
182 + wddx? ( >=dev-libs/libxml2-2.6.8 )
183 + xml? ( >=dev-libs/libxml2-2.6.8 )
184 + xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
185 + xmlreader? ( >=dev-libs/libxml2-2.6.8 )
186 + xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
187 + xpm? (
188 + x11-libs/libXpm
189 + virtual/jpeg:0
190 + media-libs/libpng:0= sys-libs/zlib
191 + )
192 + xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
193 + zip? ( sys-libs/zlib )
194 + zlib? ( sys-libs/zlib )
195 + virtual/mta
196 +"
197 +
198 +php="=${CATEGORY}/${PF}"
199 +
200 +REQUIRED_USE="
201 + truetype? ( gd )
202 + vpx? ( gd )
203 + cjk? ( gd )
204 + exif? ( gd )
205 +
206 + xpm? ( gd )
207 + gd? ( zlib )
208 + simplexml? ( xml )
209 + soap? ( xml )
210 + wddx? ( xml )
211 + xmlrpc? ( || ( xml iconv ) )
212 + xmlreader? ( xml )
213 + xslt? ( xml )
214 + ldap-sasl? ( ldap )
215 + mhash? ( hash )
216 + phar? ( hash )
217 + libmysqlclient? ( || (
218 + mysql
219 + mysqli
220 + pdo
221 + ) )
222 +
223 + qdbm? ( !gdbm )
224 + readline? ( !libedit )
225 + recode? ( !imap !mysql !mysqli )
226 + sharedmem? ( !threads )
227 +
228 + !cli? ( !cgi? ( !fpm? ( !apache2? ( !embed? ( cli ) ) ) ) )"
229 +
230 +RDEPEND="${DEPEND}"
231 +
232 +RDEPEND="${RDEPEND}
233 + fpm? (
234 + selinux? ( sec-policy/selinux-phpfpm )
235 + systemd? ( sys-apps/systemd ) )"
236 +
237 +DEPEND="${DEPEND}
238 + sys-devel/flex
239 + >=sys-devel/m4-1.4.3
240 + >=sys-devel/libtool-1.5.18"
241 +
242 +# Allow users to install production version if they want to
243 +
244 +case "${PHP_INI_VERSION}" in
245 + production|development)
246 + ;;
247 + *)
248 + PHP_INI_VERSION="development"
249 + ;;
250 +esac
251 +
252 +PHP_INI_UPSTREAM="php.ini-${PHP_INI_VERSION}"
253 +PHP_INI_FILE="php.ini"
254 +
255 +want_apache
256 +
257 +pkg_setup() {
258 + depend.apache_pkg_setup
259 +}
260 +
261 +php_install_ini() {
262 + local phpsapi="${1}"
263 +
264 + # work out where we are installing the ini file
265 + php_set_ini_dir "${phpsapi}"
266 +
267 + local phpinisrc="${PHP_INI_UPSTREAM}-${phpsapi}"
268 + cp "${PHP_INI_UPSTREAM}" "${phpinisrc}"
269 +
270 + # default to /tmp for save_path, bug #282768
271 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}"
272 +
273 + # Set the extension dir
274 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" -i "${phpinisrc}"
275 +
276 + # Set the include path to point to where we want to find PEAR packages
277 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}"
278 +
279 + dodir "${PHP_INI_DIR#${EPREFIX}}"
280 + insinto "${PHP_INI_DIR#${EPREFIX}}"
281 + newins "${phpinisrc}" "${PHP_INI_FILE}"
282 +
283 + elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
284 + elog
285 +
286 + dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
287 + dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
288 +
289 + if use_if_iuse opcache; then
290 + elog "Adding opcache to $PHP_EXT_INI_DIR"
291 + echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
292 + dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
293 + fi
294 +
295 + # SAPI-specific handling
296 +
297 + if [[ "${sapi}" == "fpm" ]] ; then
298 + [[ -z ${PHP_FPM_CONF_VER} ]] && PHP_FPM_CONF_VER=0
299 + einfo "Installing FPM CGI config file php-fpm.conf"
300 + insinto "${PHP_INI_DIR#${EPREFIX}}"
301 + newins "${FILESDIR}/php-fpm-r${PHP_FPM_CONF_VER}.conf" php-fpm.conf
302 +
303 + # Remove bogus /etc/php-fpm.conf.default (bug 359906)
304 + [[ -f "${ED}/etc/php-fpm.conf.default" ]] && rm "${ED}/etc/php-fpm.conf.default"
305 + fi
306 +
307 + # Install PHP ini files into /usr/share/php
308 +
309 + dodoc php.ini-development
310 + dodoc php.ini-production
311 +
312 +}
313 +
314 +php_set_ini_dir() {
315 + PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
316 + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
317 + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
318 +}
319 +
320 +src_prepare() {
321 + # USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path
322 + # ([empty session.save_path]/session_mm_[sapi][gid].sem)
323 + # there is no easy way to circumvent that, all php calls during
324 + # install use -n, so no php.ini file will be used.
325 + # As such, this is the easiest way to get around
326 + addpredict /session_mm_cli250.sem
327 + addpredict /session_mm_cli0.sem
328 +
329 + # Change PHP branding
330 + # Get the alpha/beta/rc version
331 + sed -re "s|^(PHP_EXTRA_VERSION=\").*(\")|\1-pl${PR/r/}-gentoo\2|g" \
332 + -i configure.in || die "Unable to change PHP branding"
333 +
334 + # Patch PHP to show Gentoo as the server platform
335 + sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
336 + -i configure.in || die "Failed to fix server platform name"
337 +
338 + # Prevent PHP from activating the Apache config,
339 + # as we will do that ourselves
340 + sed -i \
341 + -e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \
342 + -e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \
343 + configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4
344 +
345 + # Patch PHP to support heimdal instead of mit-krb5
346 + if has_version "app-crypt/heimdal" ; then
347 + sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
348 + || die "Failed to fix heimdal libname"
349 + sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
350 + || die "Failed to fix heimdal crypt library reference"
351 + fi
352 +
353 + #Add user patches #357637
354 + epatch_user
355 +
356 + #force rebuilding aclocal.m4
357 + rm aclocal.m4
358 + eautoreconf
359 +
360 + if [[ ${CHOST} == *-darwin* ]] ; then
361 + # http://bugs.php.net/bug.php?id=48795, bug #343481
362 + sed -i -e '/BUILD_CGI="\\$(CC)/s/CC/CXX/' configure || die
363 + fi
364 +}
365 +
366 +src_configure() {
367 + addpredict /usr/share/snmp/mibs/.index
368 + addpredict /var/lib/net-snmp/mib_indexes
369 +
370 + PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
371 +
372 + # This is a global variable and should be in caps. It isn't because the
373 + # phpconfutils eclass relies on exactly this name...
374 + # for --with-libdir see bug #327025
375 + my_conf="
376 + --prefix="${PHP_DESTDIR}"
377 + --mandir="${PHP_DESTDIR}"/man
378 + --infodir="${PHP_DESTDIR}"/info
379 + --libdir="${PHP_DESTDIR}"/lib
380 + --with-libdir=$(get_libdir)
381 + --without-pear
382 + $(use_enable threads maintainer-zts)"
383 +
384 + # extension USE flag shared
385 + my_conf+="
386 + $(use_enable bcmath bcmath )
387 + $(use_with bzip2 bz2 "${EPREFIX}"/usr)
388 + $(use_enable calendar calendar )
389 + $(use_enable ctype ctype )
390 + $(use_with curl curl "${EPREFIX}"/usr)
391 + $(use_enable xml dom )
392 + $(use_with enchant enchant "${EPREFIX}"/usr)
393 + $(use_enable exif exif )
394 + $(use_enable fileinfo fileinfo )
395 + $(use_enable filter filter )
396 + $(use_enable ftp ftp )
397 + $(use_with nls gettext "${EPREFIX}"/usr)
398 + $(use_with gmp gmp "${EPREFIX}"/usr)
399 + $(use_enable hash hash )
400 + $(use_with mhash mhash "${EPREFIX}"/usr)
401 + $(use_with iconv iconv $(use elibc_glibc || use elibc_musl || echo "${EPREFIX}"/usr))
402 + $(use_enable intl intl )
403 + $(use_enable ipv6 ipv6 )
404 + $(use_enable json json )
405 + $(use_with kerberos kerberos "${EPREFIX}"/usr)
406 + $(use_enable xml libxml )
407 + $(use_with xml libxml-dir "${EPREFIX}"/usr)
408 + $(use_enable unicode mbstring )
409 + $(use_with crypt mcrypt "${EPREFIX}"/usr)
410 + $(use_with mssql mssql "${EPREFIX}"/usr)
411 + $(use_with unicode onig "${EPREFIX}"/usr)
412 + $(use_with ssl openssl "${EPREFIX}"/usr)
413 + $(use_with ssl openssl-dir "${EPREFIX}"/usr)
414 + $(use_enable pcntl pcntl )
415 + $(use_enable phar phar )
416 + $(use_enable pdo pdo )
417 + $(use_enable opcache opcache )
418 + $(use_with postgres pgsql "${EPREFIX}"/usr)
419 + $(use_enable posix posix )
420 + $(use_with spell pspell "${EPREFIX}"/usr)
421 + $(use_with recode recode "${EPREFIX}"/usr)
422 + $(use_enable simplexml simplexml )
423 + $(use_enable sharedmem shmop )
424 + $(use_with snmp snmp "${EPREFIX}"/usr)
425 + $(use_enable soap soap )
426 + $(use_enable sockets sockets )
427 + $(use_with sqlite sqlite3 "${EPREFIX}"/usr)
428 + $(use_with sybase-ct sybase-ct "${EPREFIX}"/usr)
429 + $(use_enable sysvipc sysvmsg )
430 + $(use_enable sysvipc sysvsem )
431 + $(use_enable sysvipc sysvshm )
432 + $(use_with systemd fpm-systemd)
433 + $(use_with tidy tidy "${EPREFIX}"/usr)
434 + $(use_enable tokenizer tokenizer )
435 + $(use_enable wddx wddx )
436 + $(use_enable xml xml )
437 + $(use_enable xmlreader xmlreader )
438 + $(use_enable xmlwriter xmlwriter )
439 + $(use_with xmlrpc xmlrpc)
440 + $(use_with xslt xsl "${EPREFIX}"/usr)
441 + $(use_enable zip zip )
442 + $(use_with zlib zlib "${EPREFIX}"/usr)
443 + $(use_enable debug debug )"
444 +
445 + # DBA support
446 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
447 + || use qdbm ; then
448 + my_conf="${my_conf} --enable-dba${shared}"
449 + fi
450 +
451 + # DBA drivers support
452 + my_conf+="
453 + $(use_with cdb cdb)
454 + $(use_with berkdb db4 ${EPREFIX}/usr)
455 + $(use_enable flatfile flatfile )
456 + $(use_with gdbm gdbm ${EPREFIX}/usr)
457 + $(use_enable inifile inifile )
458 + $(use_with qdbm qdbm ${EPREFIX}/usr)"
459 +
460 + # Support for the GD graphics library
461 + my_conf+="
462 + $(use_with truetype freetype-dir ${EPREFIX}/usr)
463 + $(use_with truetype t1lib ${EPREFIX}/usr)
464 + $(use_enable cjk gd-jis-conv )
465 + $(use_with gd jpeg-dir ${EPREFIX}/usr)
466 + $(use_with gd png-dir ${EPREFIX}/usr)
467 + $(use_with xpm xpm-dir ${EPREFIX}/usr)
468 + $(use_with vpx vpx-dir ${EPREFIX}/usr)"
469 + # enable gd last, so configure can pick up the previous settings
470 + my_conf+="
471 + $(use_with gd gd)"
472 +
473 + # IMAP support
474 + if use imap ; then
475 + my_conf+="
476 + $(use_with imap imap ${EPREFIX}/usr)
477 + $(use_with ssl imap-ssl ${EPREFIX}/usr)"
478 + fi
479 +
480 + # Interbase/firebird support
481 +
482 + if use firebird ; then
483 + my_conf+="
484 + $(use_with firebird interbase ${EPREFIX}/usr)"
485 + fi
486 +
487 + # LDAP support
488 + if use ldap ; then
489 + my_conf+="
490 + $(use_with ldap ldap ${EPREFIX}/usr)
491 + $(use_with ldap-sasl ldap-sasl ${EPREFIX}/usr)"
492 + fi
493 +
494 + # MySQL support
495 + local mysqllib="mysqlnd"
496 + local mysqlilib="mysqlnd"
497 + use libmysqlclient && mysqllib="${EPREFIX}/usr"
498 + use libmysqlclient && mysqlilib="${EPREFIX}/usr/bin/mysql_config"
499 +
500 + my_conf+=" $(use_with mysql mysql $mysqllib)"
501 + my_conf+=" $(use_with mysqli mysqli $mysqlilib)"
502 +
503 + local mysqlsock=" $(use_with mysql mysql-sock ${EPREFIX}/var/run/mysqld/mysqld.sock)"
504 + if use mysql ; then
505 + my_conf+="${mysqlsock}"
506 + elif use mysqli ; then
507 + my_conf+="${mysqlsock}"
508 + fi
509 +
510 + # ODBC support
511 + if use odbc ; then
512 + my_conf+="
513 + $(use_with odbc unixODBC ${EPREFIX}/usr)"
514 + fi
515 +
516 + if use iodbc ; then
517 + my_conf+="
518 + $(use_with iodbc iodbc ${EPREFIX}/usr)"
519 + fi
520 +
521 + # Oracle support
522 + if use oci8-instant-client ; then
523 + my_conf+="
524 + $(use_with oci8-instant-client oci8)"
525 + fi
526 +
527 + # PDO support
528 + if use pdo ; then
529 + my_conf+="
530 + $(use_with mssql pdo-dblib )
531 + $(use_with mysql pdo-mysql ${mysqllib})
532 + $(use_with postgres pdo-pgsql )
533 + $(use_with sqlite pdo-sqlite ${EPREFIX}/usr)
534 + $(use_with odbc pdo-odbc unixODBC,${EPREFIX}/usr)"
535 + if use oci8-instant-client ; then
536 + my_conf+="
537 + $(use_with oci8-instant-client pdo-oci)"
538 + fi
539 + fi
540 +
541 + # readline/libedit support
542 + my_conf+="
543 + $(use_with readline readline ${EPREFIX}/usr)
544 + $(use_with libedit libedit ${EPREFIX}/usr)"
545 +
546 + # Session support
547 + if use session ; then
548 + my_conf+="
549 + $(use_with sharedmem mm ${EPREFIX}/usr)"
550 + else
551 + my_conf+="
552 + $(use_enable session session )"
553 + fi
554 +
555 + # Use pic for shared modules such as apache2's mod_php
556 + my_conf="${my_conf} --with-pic"
557 +
558 + # we use the system copy of pcre
559 + # --with-pcre-regex affects ext/pcre
560 + # --with-pcre-dir affects ext/filter and ext/zip
561 + my_conf="${my_conf} --with-pcre-regex=${EPREFIX}/usr --with-pcre-dir=${EPREFIX}/usr"
562 +
563 + # Catch CFLAGS problems
564 + # Fixes bug #14067.
565 + # Changed order to run it in reverse for bug #32022 and #12021.
566 + replace-cpu-flags "k6*" "i586"
567 +
568 + # Support user-passed configuration parameters
569 + my_conf="${my_conf} ${EXTRA_ECONF:-}"
570 +
571 + # Support the Apache2 extras, they must be set globally for all
572 + # SAPIs to work correctly, especially for external PHP extensions
573 +
574 + mkdir -p "${WORKDIR}/sapis-build"
575 + for one_sapi in $SAPIS ; do
576 + use "${one_sapi}" || continue
577 + php_set_ini_dir "${one_sapi}"
578 +
579 + cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
580 + cd "${WORKDIR}/sapis-build/${one_sapi}"
581 +
582 + sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
583 + --with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
584 +
585 + for sapi in $SAPIS ; do
586 + case "$sapi" in
587 + cli|cgi|embed|fpm)
588 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
589 + sapi_conf="${sapi_conf} --enable-${sapi}"
590 + else
591 + sapi_conf="${sapi_conf} --disable-${sapi}"
592 + fi
593 + ;;
594 +
595 + apache2)
596 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
597 + sapi_conf="${sapi_conf} --with-apxs2=${EPREFIX}/usr/sbin/apxs"
598 + else
599 + sapi_conf="${sapi_conf} --without-apxs2"
600 + fi
601 + ;;
602 + esac
603 + done
604 +
605 + econf ${sapi_conf}
606 + done
607 +}
608 +
609 +src_compile() {
610 + # snmp seems to run during src_compile, too (bug #324739)
611 + addpredict /usr/share/snmp/mibs/.index
612 + addpredict /var/lib/net-snmp/mib_indexes
613 +
614 + for sapi in ${SAPIS} ; do
615 + if use "${sapi}"; then
616 + cd "${WORKDIR}/sapis-build/$sapi" || "Failed to change dir to ${WORKDIR}/sapis-build/$1"
617 + emake || die "emake failed"
618 + fi
619 + done
620 +}
621 +
622 +src_install() {
623 + # see bug #324739 for what happens when we don't have that
624 + addpredict /usr/share/snmp/mibs/.index
625 +
626 + # grab the first SAPI that got built and install common files from there
627 + local first_sapi=""
628 + for sapi in $SAPIS ; do
629 + if use $sapi ; then
630 + first_sapi=$sapi
631 + break
632 + fi
633 + done
634 +
635 + # Makefile forgets to create this before trying to write to it...
636 + dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
637 +
638 + # Install php environment (without any sapis)
639 + cd "${WORKDIR}/sapis-build/$first_sapi"
640 + emake INSTALL_ROOT="${D}" \
641 + install-build install-headers install-programs \
642 + || die "emake install failed"
643 +
644 + local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
645 +
646 + # Create the directory where we'll put version-specific php scripts
647 + keepdir /usr/share/php${PHP_MV}
648 +
649 + local sapi="", file=""
650 + local sapi_list=""
651 +
652 + for sapi in ${SAPIS}; do
653 + if use "${sapi}" ; then
654 + einfo "Installing SAPI: ${sapi}"
655 + cd "${WORKDIR}/sapis-build/${sapi}"
656 +
657 + if [[ "${sapi}" == "apache2" ]] ; then
658 + # We're specifically not using emake install-sapi as libtool
659 + # may cause unnecessary relink failures (see bug #351266)
660 + insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
661 + newins ".libs/libphp5$(get_libname)" "libphp${PHP_MV}$(get_libname)"
662 + keepdir "/usr/$(get_libdir)/apache2/modules"
663 + else
664 + # needed each time, php_install_ini would reset it
665 + local dest="${PHP_DESTDIR#${EPREFIX}}"
666 + into "${dest}"
667 + case "$sapi" in
668 + cli)
669 + source="sapi/cli/php"
670 + ;;
671 + cgi)
672 + source="sapi/cgi/php-cgi"
673 + ;;
674 + fpm)
675 + source="sapi/fpm/php-fpm"
676 + ;;
677 + embed)
678 + source="libs/libphp${PHP_MV}$(get_libname)"
679 + ;;
680 + *)
681 + die "unhandled sapi in src_install"
682 + ;;
683 + esac
684 +
685 + if [[ "${source}" == *"$(get_libname)" ]]; then
686 + dolib.so "${source}" || die "Unable to install ${sapi} sapi"
687 + else
688 + dobin "${source}" || die "Unable to install ${sapi} sapi"
689 + local name="$(basename ${source})"
690 + dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
691 + fi
692 + fi
693 +
694 + php_install_ini "${sapi}"
695 +
696 + # construct correct SAPI string for php-config
697 + # thanks to ferringb for the bash voodoo
698 + if [[ "${sapi}" == "apache2" ]]; then
699 + sapi_list="${sapi_list:+${sapi_list} }apache2handler"
700 + else
701 + sapi_list="${sapi_list:+${sapi_list} }${sapi}"
702 + fi
703 + fi
704 + done
705 +
706 + # Installing opcache module
707 + if use_if_iuse opcache ; then
708 + dolib.so "modules/opcache$(get_libname)" || die "Unable to install opcache module"
709 + fi
710 +
711 + # Install env.d files
712 + newenvd "${FILESDIR}/20php5-envd" \
713 + "20php${SLOT}"
714 + sed -e "s|/lib/|/$(get_libdir)/|g" -i \
715 + "${ED}/etc/env.d/20php${SLOT}"
716 + sed -e "s|php5|php${SLOT}|g" -i \
717 + "${ED}/etc/env.d/20php${SLOT}"
718 +
719 + # set php-config variable correctly (bug #278439)
720 + sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
721 + "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config"
722 +
723 + if use fpm ; then
724 + if use systemd; then
725 + systemd_newunit "${FILESDIR}/php-fpm_at.service" "php-fpm@${SLOT}.service"
726 + else
727 + systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" "php-fpm@${SLOT}.service"
728 + fi
729 + fi
730 +}
731 +
732 +src_test() {
733 + echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
734 + PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
735 + if [[ ! -x "${PHP_BIN}" ]] ; then
736 + ewarn "Test phase requires USE=cli, skipping"
737 + return
738 + else
739 + export TEST_PHP_EXECUTABLE="${PHP_BIN}"
740 + fi
741 +
742 + if [[ -x "${WORKDIR}/sapis/cgi/php-cgi" ]] ; then
743 + export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis/cgi/php-cgi"
744 + fi
745 +
746 + REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d "session.save_path=${T}" \
747 + "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d "session.save_path=${T}"
748 +
749 + for name in ${EXPECTED_TEST_FAILURES}; do
750 + mv "${name}.out" "${name}.out.orig" 2>/dev/null
751 + done
752 +
753 + local failed="$(find -name '*.out')"
754 + if [[ ${failed} != "" ]] ; then
755 + ewarn "The following test cases failed unexpectedly:"
756 + for name in ${failed}; do
757 + ewarn " ${name/.out/}"
758 + done
759 + else
760 + einfo "No unexpected test failures, all fine"
761 + fi
762 +
763 + if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
764 + local passed=""
765 + for name in ${EXPECTED_TEST_FAILURES}; do
766 + [[ -f "${name}.diff" ]] && continue
767 + passed="${passed} ${name}"
768 + done
769 + if [[ ${passed} != "" ]] ; then
770 + einfo "The following test cases passed unexpectedly:"
771 + for name in ${passed}; do
772 + ewarn " ${passed}"
773 + done
774 + else
775 + einfo "None of the known-to-fail tests passed, all fine"
776 + fi
777 + fi
778 +}
779 +
780 +pkg_postinst() {
781 + # Output some general info to the user
782 + if use apache2 ; then
783 + APACHE2_MOD_DEFINE="PHP5"
784 + APACHE2_MOD_CONF="70_mod_php5" # actually provided by app-eselect/eselect-php
785 + apache-module_pkg_postinst
786 + fi
787 +
788 + # Create the symlinks for php
789 + for m in ${SAPIS}; do
790 + [[ ${m} == 'embed' ]] && continue;
791 + if use $m ; then
792 + local ci=$(eselect php show $m)
793 + if [[ -z $ci ]]; then
794 + eselect php set $m php${SLOT}
795 + einfo "Switched ${m} to use php:${SLOT}"
796 + einfo
797 + elif [[ $ci != "php${SLOT}" ]] ; then
798 + elog "To switch $m to use php:${SLOT}, run"
799 + elog " eselect php set $m php${SLOT}"
800 + elog
801 + fi
802 + fi
803 + done
804 +
805 + elog "Make sure that PHP_TARGETS in ${EPREFIX}/etc/make.conf includes php${SLOT/./-} in order"
806 + elog "to compile extensions for the ${SLOT} ABI"
807 + elog
808 + if ! use readline && use cli ; then
809 + ewarn "Note that in order to use php interactivly, you need to enable"
810 + ewarn "the readline USE flag or php -a will hang"
811 + fi
812 + elog
813 + elog "This ebuild installed a version of php.ini based on php.ini-${PHP_INI_VERSION} version."
814 + elog "You can chose which version of php.ini to install by default by setting PHP_INI_VERSION to either"
815 + elog "'production' or 'development' in ${EPREFIX}/etc/make.conf"
816 + elog "Both versions of php.ini can be found in ${EPREFIX}/usr/share/doc/${PF}"
817 +
818 + elog
819 + elog "For more details on how minor version slotting works (PHP_TARGETS) please read the upgrade guide:"
820 + elog "https://www.gentoo.org/proj/en/php/php-upgrading.xml"
821 + elog
822 +}
823 +
824 +pkg_prerm() {
825 + eselect php cleanup
826 +}
827
828 diff --git a/dev-lang/php/php-5.6.14.ebuild b/dev-lang/php/php-5.6.14.ebuild
829 new file mode 100644
830 index 0000000..dcf8362
831 --- /dev/null
832 +++ b/dev-lang/php/php-5.6.14.ebuild
833 @@ -0,0 +1,784 @@
834 +# Copyright 1999-2015 Gentoo Foundation
835 +# Distributed under the terms of the GNU General Public License v2
836 +# $Id$
837 +
838 +EAPI=5
839 +
840 +inherit eutils autotools flag-o-matic versionator depend.apache apache-module db-use libtool systemd
841 +
842 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
843 +
844 +function php_get_uri ()
845 +{
846 + case "${1}" in
847 + "php-pre")
848 + echo "http://downloads.php.net/dsp/${2}"
849 + ;;
850 + "php")
851 + echo "http://www.php.net/distributions/${2}"
852 + ;;
853 + "olemarkus")
854 + echo "https://dev.gentoo.org/~olemarkus/php/${2}"
855 + ;;
856 + "gentoo")
857 + echo "mirror://gentoo/${2}"
858 + ;;
859 + *)
860 + die "unhandled case in php_get_uri"
861 + ;;
862 + esac
863 +}
864 +
865 +PHP_MV="$(get_major_version)"
866 +SLOT="$(get_version_component_range 1-2)"
867 +
868 +# alias, so we can handle different types of releases (finals, rcs, alphas,
869 +# betas, ...) w/o changing the whole ebuild
870 +PHP_PV="${PV/_rc/RC}"
871 +PHP_PV="${PHP_PV/_alpha/alpha}"
872 +PHP_PV="${PHP_PV/_beta/beta}"
873 +PHP_RELEASE="php"
874 +[[ ${PV} == ${PV/_alpha/} ]] || PHP_RELEASE="php-pre"
875 +[[ ${PV} == ${PV/_beta/} ]] || PHP_RELEASE="php-pre"
876 +[[ ${PV} == ${PV/_rc/} ]] || PHP_RELEASE="php-pre"
877 +PHP_P="${PN}-${PHP_PV}"
878 +
879 +PHP_SRC_URI="$(php_get_uri "${PHP_RELEASE}" "${PHP_P}.tar.bz2")"
880 +
881 +PHP_FPM_CONF_VER="1"
882 +
883 +SRC_URI="${PHP_SRC_URI}"
884 +
885 +DESCRIPTION="The PHP language runtime engine: CLI, CGI, FPM/FastCGI, Apache2 and embed SAPIs"
886 +HOMEPAGE="http://php.net/"
887 +LICENSE="PHP-3"
888 +
889 +S="${WORKDIR}/${PHP_P}"
890 +
891 +# We can build the following SAPIs in the given order
892 +SAPIS="embed cli cgi fpm apache2"
893 +
894 +# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
895 +IUSE="${IUSE}
896 + ${SAPIS/cli/+cli}
897 + threads"
898 +
899 +IUSE="${IUSE} bcmath berkdb bzip2 calendar cdb cjk
900 + crypt +ctype curl debug
901 + enchant exif frontbase +fileinfo +filter firebird
902 + flatfile ftp gd gdbm gmp +hash +iconv imap inifile
903 + intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit mhash
904 + mssql mysql libmysqlclient mysqli nls
905 + oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
906 + readline recode selinux +session sharedmem
907 + +simplexml snmp soap sockets spell sqlite ssl
908 + sybase-ct sysvipc systemd tidy +tokenizer truetype unicode vpx wddx
909 + +xml xmlreader xmlwriter xmlrpc xpm xslt zip zlib"
910 +
911 +DEPEND="
912 + >=app-eselect/eselect-php-0.7.1-r3[apache2?,fpm?]
913 + >=dev-libs/libpcre-8.32[unicode]
914 + apache2? ( || ( >=www-servers/apache-2.4[apache2_modules_unixd,threads=]
915 + <www-servers/apache-2.4[threads=] ) )
916 + berkdb? ( =sys-libs/db-4* )
917 + bzip2? ( app-arch/bzip2 )
918 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
919 + cjk? ( !gd? (
920 + virtual/jpeg:0
921 + media-libs/libpng:0=
922 + sys-libs/zlib
923 + ) )
924 + crypt? ( >=dev-libs/libmcrypt-2.4 )
925 + curl? ( >=net-misc/curl-7.10.5 )
926 + enchant? ( app-text/enchant )
927 + exif? ( !gd? (
928 + virtual/jpeg:0
929 + media-libs/libpng:0=
930 + sys-libs/zlib
931 + ) )
932 + firebird? ( dev-db/firebird )
933 + gd? ( virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
934 + gdbm? ( >=sys-libs/gdbm-1.8.0 )
935 + gmp? ( >=dev-libs/gmp-4.1.2 )
936 + iconv? ( virtual/libiconv )
937 + imap? ( virtual/imap-c-client[ssl=] )
938 + intl? ( dev-libs/icu:= )
939 + iodbc? ( dev-db/libiodbc )
940 + kerberos? ( virtual/krb5 )
941 + ldap? ( >=net-nds/openldap-1.2.11 )
942 + ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
943 + libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
944 + mssql? ( dev-db/freetds[mssql] )
945 + libmysqlclient? (
946 + mysql? ( virtual/mysql )
947 + mysqli? ( >=virtual/mysql-4.1 )
948 + )
949 + nls? ( sys-devel/gettext )
950 + oci8-instant-client? ( dev-db/oracle-instantclient-basic )
951 + odbc? ( >=dev-db/unixODBC-1.8.13 )
952 + postgres? ( dev-db/postgresql )
953 + qdbm? ( dev-db/qdbm )
954 + readline? ( sys-libs/readline )
955 + recode? ( app-text/recode )
956 + sharedmem? ( dev-libs/mm )
957 + simplexml? ( >=dev-libs/libxml2-2.6.8 )
958 + snmp? ( >=net-analyzer/net-snmp-5.2 )
959 + soap? ( >=dev-libs/libxml2-2.6.8 )
960 + spell? ( >=app-text/aspell-0.50 )
961 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
962 + ssl? ( >=dev-libs/openssl-0.9.7 )
963 + sybase-ct? ( dev-db/freetds )
964 + tidy? ( app-text/htmltidy )
965 + truetype? (
966 + =media-libs/freetype-2*
967 + >=media-libs/t1lib-5.0.0
968 + !gd? (
969 + virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
970 + )
971 + unicode? ( dev-libs/oniguruma )
972 + vpx? ( media-libs/libvpx )
973 + wddx? ( >=dev-libs/libxml2-2.6.8 )
974 + xml? ( >=dev-libs/libxml2-2.6.8 )
975 + xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
976 + xmlreader? ( >=dev-libs/libxml2-2.6.8 )
977 + xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
978 + xpm? (
979 + x11-libs/libXpm
980 + virtual/jpeg:0
981 + media-libs/libpng:0= sys-libs/zlib
982 + )
983 + xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
984 + zip? ( sys-libs/zlib )
985 + zlib? ( sys-libs/zlib )
986 + virtual/mta
987 +"
988 +
989 +php="=${CATEGORY}/${PF}"
990 +
991 +REQUIRED_USE="
992 + truetype? ( gd )
993 + vpx? ( gd )
994 + cjk? ( gd )
995 + exif? ( gd )
996 +
997 + xpm? ( gd )
998 + gd? ( zlib )
999 + simplexml? ( xml )
1000 + soap? ( xml )
1001 + wddx? ( xml )
1002 + xmlrpc? ( || ( xml iconv ) )
1003 + xmlreader? ( xml )
1004 + xslt? ( xml )
1005 + ldap-sasl? ( ldap )
1006 + mhash? ( hash )
1007 + phar? ( hash )
1008 + libmysqlclient? ( || (
1009 + mysql
1010 + mysqli
1011 + pdo
1012 + ) )
1013 +
1014 + qdbm? ( !gdbm )
1015 + readline? ( !libedit )
1016 + recode? ( !imap !mysql !mysqli )
1017 + sharedmem? ( !threads )
1018 +
1019 + !cli? ( !cgi? ( !fpm? ( !apache2? ( !embed? ( cli ) ) ) ) )"
1020 +
1021 +RDEPEND="${DEPEND}"
1022 +
1023 +RDEPEND="${RDEPEND}
1024 + fpm? (
1025 + selinux? ( sec-policy/selinux-phpfpm )
1026 + systemd? ( sys-apps/systemd ) )"
1027 +
1028 +DEPEND="${DEPEND}
1029 + sys-devel/flex
1030 + >=sys-devel/m4-1.4.3
1031 + >=sys-devel/libtool-1.5.18"
1032 +
1033 +# Allow users to install production version if they want to
1034 +
1035 +case "${PHP_INI_VERSION}" in
1036 + production|development)
1037 + ;;
1038 + *)
1039 + PHP_INI_VERSION="development"
1040 + ;;
1041 +esac
1042 +
1043 +PHP_INI_UPSTREAM="php.ini-${PHP_INI_VERSION}"
1044 +PHP_INI_FILE="php.ini"
1045 +
1046 +want_apache
1047 +
1048 +pkg_setup() {
1049 + depend.apache_pkg_setup
1050 +}
1051 +
1052 +php_install_ini() {
1053 + local phpsapi="${1}"
1054 +
1055 + # work out where we are installing the ini file
1056 + php_set_ini_dir "${phpsapi}"
1057 +
1058 + local phpinisrc="${PHP_INI_UPSTREAM}-${phpsapi}"
1059 + cp "${PHP_INI_UPSTREAM}" "${phpinisrc}"
1060 +
1061 + # default to /tmp for save_path, bug #282768
1062 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}"
1063 +
1064 + # Set the extension dir
1065 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" -i "${phpinisrc}"
1066 +
1067 + # Set the include path to point to where we want to find PEAR packages
1068 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}"
1069 +
1070 + dodir "${PHP_INI_DIR#${EPREFIX}}"
1071 + insinto "${PHP_INI_DIR#${EPREFIX}}"
1072 + newins "${phpinisrc}" "${PHP_INI_FILE}"
1073 +
1074 + elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
1075 + elog
1076 +
1077 + dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
1078 + dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
1079 +
1080 + if use_if_iuse opcache; then
1081 + elog "Adding opcache to $PHP_EXT_INI_DIR"
1082 + echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
1083 + dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
1084 + fi
1085 +
1086 + # SAPI-specific handling
1087 +
1088 + if [[ "${sapi}" == "fpm" ]] ; then
1089 + [[ -z ${PHP_FPM_CONF_VER} ]] && PHP_FPM_CONF_VER=0
1090 + einfo "Installing FPM CGI config file php-fpm.conf"
1091 + insinto "${PHP_INI_DIR#${EPREFIX}}"
1092 + newins "${FILESDIR}/php-fpm-r${PHP_FPM_CONF_VER}.conf" php-fpm.conf
1093 +
1094 + # Remove bogus /etc/php-fpm.conf.default (bug 359906)
1095 + [[ -f "${ED}/etc/php-fpm.conf.default" ]] && rm "${ED}/etc/php-fpm.conf.default"
1096 + fi
1097 +
1098 + # Install PHP ini files into /usr/share/php
1099 +
1100 + dodoc php.ini-development
1101 + dodoc php.ini-production
1102 +
1103 +}
1104 +
1105 +php_set_ini_dir() {
1106 + PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
1107 + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
1108 + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
1109 +}
1110 +
1111 +src_prepare() {
1112 + # USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path
1113 + # ([empty session.save_path]/session_mm_[sapi][gid].sem)
1114 + # there is no easy way to circumvent that, all php calls during
1115 + # install use -n, so no php.ini file will be used.
1116 + # As such, this is the easiest way to get around
1117 + addpredict /session_mm_cli250.sem
1118 + addpredict /session_mm_cli0.sem
1119 +
1120 + # Change PHP branding
1121 + # Get the alpha/beta/rc version
1122 + sed -re "s|^(PHP_EXTRA_VERSION=\").*(\")|\1-pl${PR/r/}-gentoo\2|g" \
1123 + -i configure.in || die "Unable to change PHP branding"
1124 +
1125 + # Patch PHP to show Gentoo as the server platform
1126 + sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
1127 + -i configure.in || die "Failed to fix server platform name"
1128 +
1129 + # Prevent PHP from activating the Apache config,
1130 + # as we will do that ourselves
1131 + sed -i \
1132 + -e "s,-i -a -n php${PHP_MV},-i -n php${PHP_MV},g" \
1133 + -e "s,-i -A -n php${PHP_MV},-i -n php${PHP_MV},g" \
1134 + configure sapi/apache2filter/config.m4 sapi/apache2handler/config.m4
1135 +
1136 + # Patch PHP to support heimdal instead of mit-krb5
1137 + if has_version "app-crypt/heimdal" ; then
1138 + sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
1139 + || die "Failed to fix heimdal libname"
1140 + sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
1141 + || die "Failed to fix heimdal crypt library reference"
1142 + fi
1143 +
1144 + #Add user patches #357637
1145 + epatch_user
1146 +
1147 + #force rebuilding aclocal.m4
1148 + rm aclocal.m4
1149 + eautoreconf
1150 +
1151 + if [[ ${CHOST} == *-darwin* ]] ; then
1152 + # http://bugs.php.net/bug.php?id=48795, bug #343481
1153 + sed -i -e '/BUILD_CGI="\\$(CC)/s/CC/CXX/' configure || die
1154 + fi
1155 +}
1156 +
1157 +src_configure() {
1158 + addpredict /usr/share/snmp/mibs/.index
1159 + addpredict /var/lib/net-snmp/mib_indexes
1160 +
1161 + PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
1162 +
1163 + # This is a global variable and should be in caps. It isn't because the
1164 + # phpconfutils eclass relies on exactly this name...
1165 + # for --with-libdir see bug #327025
1166 + my_conf="
1167 + --prefix="${PHP_DESTDIR}"
1168 + --mandir="${PHP_DESTDIR}"/man
1169 + --infodir="${PHP_DESTDIR}"/info
1170 + --libdir="${PHP_DESTDIR}"/lib
1171 + --with-libdir=$(get_libdir)
1172 + --without-pear
1173 + $(use_enable threads maintainer-zts)"
1174 +
1175 + # extension USE flag shared
1176 + my_conf+="
1177 + $(use_enable bcmath bcmath )
1178 + $(use_with bzip2 bz2 "${EPREFIX}"/usr)
1179 + $(use_enable calendar calendar )
1180 + $(use_enable ctype ctype )
1181 + $(use_with curl curl "${EPREFIX}"/usr)
1182 + $(use_enable xml dom )
1183 + $(use_with enchant enchant "${EPREFIX}"/usr)
1184 + $(use_enable exif exif )
1185 + $(use_enable fileinfo fileinfo )
1186 + $(use_enable filter filter )
1187 + $(use_enable ftp ftp )
1188 + $(use_with nls gettext "${EPREFIX}"/usr)
1189 + $(use_with gmp gmp "${EPREFIX}"/usr)
1190 + $(use_enable hash hash )
1191 + $(use_with mhash mhash "${EPREFIX}"/usr)
1192 + $(use_with iconv iconv $(use elibc_glibc || use elibc_musl || echo "${EPREFIX}"/usr))
1193 + $(use_enable intl intl )
1194 + $(use_enable ipv6 ipv6 )
1195 + $(use_enable json json )
1196 + $(use_with kerberos kerberos "${EPREFIX}"/usr)
1197 + $(use_enable xml libxml )
1198 + $(use_with xml libxml-dir "${EPREFIX}"/usr)
1199 + $(use_enable unicode mbstring )
1200 + $(use_with crypt mcrypt "${EPREFIX}"/usr)
1201 + $(use_with mssql mssql "${EPREFIX}"/usr)
1202 + $(use_with unicode onig "${EPREFIX}"/usr)
1203 + $(use_with ssl openssl "${EPREFIX}"/usr)
1204 + $(use_with ssl openssl-dir "${EPREFIX}"/usr)
1205 + $(use_enable pcntl pcntl )
1206 + $(use_enable phar phar )
1207 + $(use_enable pdo pdo )
1208 + $(use_enable opcache opcache )
1209 + $(use_with postgres pgsql "${EPREFIX}"/usr)
1210 + $(use_enable posix posix )
1211 + $(use_with spell pspell "${EPREFIX}"/usr)
1212 + $(use_with recode recode "${EPREFIX}"/usr)
1213 + $(use_enable simplexml simplexml )
1214 + $(use_enable sharedmem shmop )
1215 + $(use_with snmp snmp "${EPREFIX}"/usr)
1216 + $(use_enable soap soap )
1217 + $(use_enable sockets sockets )
1218 + $(use_with sqlite sqlite3 "${EPREFIX}"/usr)
1219 + $(use_with sybase-ct sybase-ct "${EPREFIX}"/usr)
1220 + $(use_enable sysvipc sysvmsg )
1221 + $(use_enable sysvipc sysvsem )
1222 + $(use_enable sysvipc sysvshm )
1223 + $(use_with systemd fpm-systemd)
1224 + $(use_with tidy tidy "${EPREFIX}"/usr)
1225 + $(use_enable tokenizer tokenizer )
1226 + $(use_enable wddx wddx )
1227 + $(use_enable xml xml )
1228 + $(use_enable xmlreader xmlreader )
1229 + $(use_enable xmlwriter xmlwriter )
1230 + $(use_with xmlrpc xmlrpc)
1231 + $(use_with xslt xsl "${EPREFIX}"/usr)
1232 + $(use_enable zip zip )
1233 + $(use_with zlib zlib "${EPREFIX}"/usr)
1234 + $(use_enable debug debug )"
1235 +
1236 + # DBA support
1237 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
1238 + || use qdbm ; then
1239 + my_conf="${my_conf} --enable-dba${shared}"
1240 + fi
1241 +
1242 + # DBA drivers support
1243 + my_conf+="
1244 + $(use_with cdb cdb)
1245 + $(use_with berkdb db4 ${EPREFIX}/usr)
1246 + $(use_enable flatfile flatfile )
1247 + $(use_with gdbm gdbm ${EPREFIX}/usr)
1248 + $(use_enable inifile inifile )
1249 + $(use_with qdbm qdbm ${EPREFIX}/usr)"
1250 +
1251 + # Support for the GD graphics library
1252 + my_conf+="
1253 + $(use_with truetype freetype-dir ${EPREFIX}/usr)
1254 + $(use_with truetype t1lib ${EPREFIX}/usr)
1255 + $(use_enable cjk gd-jis-conv )
1256 + $(use_with gd jpeg-dir ${EPREFIX}/usr)
1257 + $(use_with gd png-dir ${EPREFIX}/usr)
1258 + $(use_with xpm xpm-dir ${EPREFIX}/usr)
1259 + $(use_with vpx vpx-dir ${EPREFIX}/usr)"
1260 + # enable gd last, so configure can pick up the previous settings
1261 + my_conf+="
1262 + $(use_with gd gd)"
1263 +
1264 + # IMAP support
1265 + if use imap ; then
1266 + my_conf+="
1267 + $(use_with imap imap ${EPREFIX}/usr)
1268 + $(use_with ssl imap-ssl ${EPREFIX}/usr)"
1269 + fi
1270 +
1271 + # Interbase/firebird support
1272 +
1273 + if use firebird ; then
1274 + my_conf+="
1275 + $(use_with firebird interbase ${EPREFIX}/usr)"
1276 + fi
1277 +
1278 + # LDAP support
1279 + if use ldap ; then
1280 + my_conf+="
1281 + $(use_with ldap ldap ${EPREFIX}/usr)
1282 + $(use_with ldap-sasl ldap-sasl ${EPREFIX}/usr)"
1283 + fi
1284 +
1285 + # MySQL support
1286 + local mysqllib="mysqlnd"
1287 + local mysqlilib="mysqlnd"
1288 + use libmysqlclient && mysqllib="${EPREFIX}/usr"
1289 + use libmysqlclient && mysqlilib="${EPREFIX}/usr/bin/mysql_config"
1290 +
1291 + my_conf+=" $(use_with mysql mysql $mysqllib)"
1292 + my_conf+=" $(use_with mysqli mysqli $mysqlilib)"
1293 +
1294 + local mysqlsock=" $(use_with mysql mysql-sock ${EPREFIX}/var/run/mysqld/mysqld.sock)"
1295 + if use mysql ; then
1296 + my_conf+="${mysqlsock}"
1297 + elif use mysqli ; then
1298 + my_conf+="${mysqlsock}"
1299 + fi
1300 +
1301 + # ODBC support
1302 + if use odbc ; then
1303 + my_conf+="
1304 + $(use_with odbc unixODBC ${EPREFIX}/usr)"
1305 + fi
1306 +
1307 + if use iodbc ; then
1308 + my_conf+="
1309 + $(use_with iodbc iodbc ${EPREFIX}/usr)"
1310 + fi
1311 +
1312 + # Oracle support
1313 + if use oci8-instant-client ; then
1314 + my_conf+="
1315 + $(use_with oci8-instant-client oci8)"
1316 + fi
1317 +
1318 + # PDO support
1319 + if use pdo ; then
1320 + my_conf+="
1321 + $(use_with mssql pdo-dblib )
1322 + $(use_with mysql pdo-mysql ${mysqllib})
1323 + $(use_with postgres pdo-pgsql )
1324 + $(use_with sqlite pdo-sqlite ${EPREFIX}/usr)
1325 + $(use_with odbc pdo-odbc unixODBC,${EPREFIX}/usr)"
1326 + if use oci8-instant-client ; then
1327 + my_conf+="
1328 + $(use_with oci8-instant-client pdo-oci)"
1329 + fi
1330 + fi
1331 +
1332 + # readline/libedit support
1333 + my_conf+="
1334 + $(use_with readline readline ${EPREFIX}/usr)
1335 + $(use_with libedit libedit ${EPREFIX}/usr)"
1336 +
1337 + # Session support
1338 + if use session ; then
1339 + my_conf+="
1340 + $(use_with sharedmem mm ${EPREFIX}/usr)"
1341 + else
1342 + my_conf+="
1343 + $(use_enable session session )"
1344 + fi
1345 +
1346 + # Use pic for shared modules such as apache2's mod_php
1347 + my_conf="${my_conf} --with-pic"
1348 +
1349 + # we use the system copy of pcre
1350 + # --with-pcre-regex affects ext/pcre
1351 + # --with-pcre-dir affects ext/filter and ext/zip
1352 + my_conf="${my_conf} --with-pcre-regex=${EPREFIX}/usr --with-pcre-dir=${EPREFIX}/usr"
1353 +
1354 + # Catch CFLAGS problems
1355 + # Fixes bug #14067.
1356 + # Changed order to run it in reverse for bug #32022 and #12021.
1357 + replace-cpu-flags "k6*" "i586"
1358 +
1359 + # Support user-passed configuration parameters
1360 + my_conf="${my_conf} ${EXTRA_ECONF:-}"
1361 +
1362 + # Support the Apache2 extras, they must be set globally for all
1363 + # SAPIs to work correctly, especially for external PHP extensions
1364 +
1365 + mkdir -p "${WORKDIR}/sapis-build"
1366 + for one_sapi in $SAPIS ; do
1367 + use "${one_sapi}" || continue
1368 + php_set_ini_dir "${one_sapi}"
1369 +
1370 + cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
1371 + cd "${WORKDIR}/sapis-build/${one_sapi}"
1372 +
1373 + sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
1374 + --with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
1375 +
1376 + for sapi in $SAPIS ; do
1377 + case "$sapi" in
1378 + cli|cgi|embed|fpm)
1379 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
1380 + sapi_conf="${sapi_conf} --enable-${sapi}"
1381 + else
1382 + sapi_conf="${sapi_conf} --disable-${sapi}"
1383 + fi
1384 + ;;
1385 +
1386 + apache2)
1387 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
1388 + sapi_conf="${sapi_conf} --with-apxs2=${EPREFIX}/usr/sbin/apxs"
1389 + else
1390 + sapi_conf="${sapi_conf} --without-apxs2"
1391 + fi
1392 + ;;
1393 + esac
1394 + done
1395 +
1396 + econf ${sapi_conf}
1397 + done
1398 +}
1399 +
1400 +src_compile() {
1401 + # snmp seems to run during src_compile, too (bug #324739)
1402 + addpredict /usr/share/snmp/mibs/.index
1403 + addpredict /var/lib/net-snmp/mib_indexes
1404 +
1405 + for sapi in ${SAPIS} ; do
1406 + if use "${sapi}"; then
1407 + cd "${WORKDIR}/sapis-build/$sapi" || "Failed to change dir to ${WORKDIR}/sapis-build/$1"
1408 + emake || die "emake failed"
1409 + fi
1410 + done
1411 +}
1412 +
1413 +src_install() {
1414 + # see bug #324739 for what happens when we don't have that
1415 + addpredict /usr/share/snmp/mibs/.index
1416 +
1417 + # grab the first SAPI that got built and install common files from there
1418 + local first_sapi=""
1419 + for sapi in $SAPIS ; do
1420 + if use $sapi ; then
1421 + first_sapi=$sapi
1422 + break
1423 + fi
1424 + done
1425 +
1426 + # Makefile forgets to create this before trying to write to it...
1427 + dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
1428 +
1429 + # Install php environment (without any sapis)
1430 + cd "${WORKDIR}/sapis-build/$first_sapi"
1431 + emake INSTALL_ROOT="${D}" \
1432 + install-build install-headers install-programs \
1433 + || die "emake install failed"
1434 +
1435 + local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
1436 +
1437 + # Create the directory where we'll put version-specific php scripts
1438 + keepdir /usr/share/php${PHP_MV}
1439 +
1440 + local sapi="", file=""
1441 + local sapi_list=""
1442 +
1443 + for sapi in ${SAPIS}; do
1444 + if use "${sapi}" ; then
1445 + einfo "Installing SAPI: ${sapi}"
1446 + cd "${WORKDIR}/sapis-build/${sapi}"
1447 +
1448 + if [[ "${sapi}" == "apache2" ]] ; then
1449 + # We're specifically not using emake install-sapi as libtool
1450 + # may cause unnecessary relink failures (see bug #351266)
1451 + insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
1452 + newins ".libs/libphp5$(get_libname)" "libphp${PHP_MV}$(get_libname)"
1453 + keepdir "/usr/$(get_libdir)/apache2/modules"
1454 + else
1455 + # needed each time, php_install_ini would reset it
1456 + local dest="${PHP_DESTDIR#${EPREFIX}}"
1457 + into "${dest}"
1458 + case "$sapi" in
1459 + cli)
1460 + source="sapi/cli/php"
1461 + ;;
1462 + cgi)
1463 + source="sapi/cgi/php-cgi"
1464 + ;;
1465 + fpm)
1466 + source="sapi/fpm/php-fpm"
1467 + ;;
1468 + embed)
1469 + source="libs/libphp${PHP_MV}$(get_libname)"
1470 + ;;
1471 + *)
1472 + die "unhandled sapi in src_install"
1473 + ;;
1474 + esac
1475 +
1476 + if [[ "${source}" == *"$(get_libname)" ]]; then
1477 + dolib.so "${source}" || die "Unable to install ${sapi} sapi"
1478 + else
1479 + dobin "${source}" || die "Unable to install ${sapi} sapi"
1480 + local name="$(basename ${source})"
1481 + dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
1482 + fi
1483 + fi
1484 +
1485 + php_install_ini "${sapi}"
1486 +
1487 + # construct correct SAPI string for php-config
1488 + # thanks to ferringb for the bash voodoo
1489 + if [[ "${sapi}" == "apache2" ]]; then
1490 + sapi_list="${sapi_list:+${sapi_list} }apache2handler"
1491 + else
1492 + sapi_list="${sapi_list:+${sapi_list} }${sapi}"
1493 + fi
1494 + fi
1495 + done
1496 +
1497 + # Installing opcache module
1498 + if use_if_iuse opcache ; then
1499 + dolib.so "modules/opcache$(get_libname)" || die "Unable to install opcache module"
1500 + fi
1501 +
1502 + # Install env.d files
1503 + newenvd "${FILESDIR}/20php5-envd" \
1504 + "20php${SLOT}"
1505 + sed -e "s|/lib/|/$(get_libdir)/|g" -i \
1506 + "${ED}/etc/env.d/20php${SLOT}"
1507 + sed -e "s|php5|php${SLOT}|g" -i \
1508 + "${ED}/etc/env.d/20php${SLOT}"
1509 +
1510 + # set php-config variable correctly (bug #278439)
1511 + sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
1512 + "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config"
1513 +
1514 + if use fpm ; then
1515 + if use systemd; then
1516 + systemd_newunit "${FILESDIR}/php-fpm_at.service" "php-fpm@${SLOT}.service"
1517 + else
1518 + systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" "php-fpm@${SLOT}.service"
1519 + fi
1520 + fi
1521 +}
1522 +
1523 +src_test() {
1524 + echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
1525 + PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
1526 + if [[ ! -x "${PHP_BIN}" ]] ; then
1527 + ewarn "Test phase requires USE=cli, skipping"
1528 + return
1529 + else
1530 + export TEST_PHP_EXECUTABLE="${PHP_BIN}"
1531 + fi
1532 +
1533 + if [[ -x "${WORKDIR}/sapis/cgi/php-cgi" ]] ; then
1534 + export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis/cgi/php-cgi"
1535 + fi
1536 +
1537 + REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d "session.save_path=${T}" \
1538 + "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d "session.save_path=${T}"
1539 +
1540 + for name in ${EXPECTED_TEST_FAILURES}; do
1541 + mv "${name}.out" "${name}.out.orig" 2>/dev/null
1542 + done
1543 +
1544 + local failed="$(find -name '*.out')"
1545 + if [[ ${failed} != "" ]] ; then
1546 + ewarn "The following test cases failed unexpectedly:"
1547 + for name in ${failed}; do
1548 + ewarn " ${name/.out/}"
1549 + done
1550 + else
1551 + einfo "No unexpected test failures, all fine"
1552 + fi
1553 +
1554 + if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
1555 + local passed=""
1556 + for name in ${EXPECTED_TEST_FAILURES}; do
1557 + [[ -f "${name}.diff" ]] && continue
1558 + passed="${passed} ${name}"
1559 + done
1560 + if [[ ${passed} != "" ]] ; then
1561 + einfo "The following test cases passed unexpectedly:"
1562 + for name in ${passed}; do
1563 + ewarn " ${passed}"
1564 + done
1565 + else
1566 + einfo "None of the known-to-fail tests passed, all fine"
1567 + fi
1568 + fi
1569 +}
1570 +
1571 +pkg_postinst() {
1572 + # Output some general info to the user
1573 + if use apache2 ; then
1574 + APACHE2_MOD_DEFINE="PHP5"
1575 + APACHE2_MOD_CONF="70_mod_php5" # actually provided by app-eselect/eselect-php
1576 + apache-module_pkg_postinst
1577 + fi
1578 +
1579 + # Create the symlinks for php
1580 + for m in ${SAPIS}; do
1581 + [[ ${m} == 'embed' ]] && continue;
1582 + if use $m ; then
1583 + local ci=$(eselect php show $m)
1584 + if [[ -z $ci ]]; then
1585 + eselect php set $m php${SLOT}
1586 + einfo "Switched ${m} to use php:${SLOT}"
1587 + einfo
1588 + elif [[ $ci != "php${SLOT}" ]] ; then
1589 + elog "To switch $m to use php:${SLOT}, run"
1590 + elog " eselect php set $m php${SLOT}"
1591 + elog
1592 + fi
1593 + fi
1594 + done
1595 +
1596 + elog "Make sure that PHP_TARGETS in ${EPREFIX}/etc/make.conf includes php${SLOT/./-} in order"
1597 + elog "to compile extensions for the ${SLOT} ABI"
1598 + elog
1599 + if ! use readline && use cli ; then
1600 + ewarn "Note that in order to use php interactivly, you need to enable"
1601 + ewarn "the readline USE flag or php -a will hang"
1602 + fi
1603 + elog
1604 + elog "This ebuild installed a version of php.ini based on php.ini-${PHP_INI_VERSION} version."
1605 + elog "You can chose which version of php.ini to install by default by setting PHP_INI_VERSION to either"
1606 + elog "'production' or 'development' in ${EPREFIX}/etc/make.conf"
1607 + elog "Both versions of php.ini can be found in ${EPREFIX}/usr/share/doc/${PF}"
1608 +
1609 + elog
1610 + elog "For more details on how minor version slotting works (PHP_TARGETS) please read the upgrade guide:"
1611 + elog "https://www.gentoo.org/proj/en/php/php-upgrading.xml"
1612 + elog
1613 +}
1614 +
1615 +pkg_prerm() {
1616 + eselect php cleanup
1617 +}
1618
1619 diff --git a/dev-lang/php/php-7.0.0_rc4.ebuild b/dev-lang/php/php-7.0.0_rc4.ebuild
1620 new file mode 100644
1621 index 0000000..c81046f
1622 --- /dev/null
1623 +++ b/dev-lang/php/php-7.0.0_rc4.ebuild
1624 @@ -0,0 +1,760 @@
1625 +# Copyright 1999-2015 Gentoo Foundation
1626 +# Distributed under the terms of the GNU General Public License v2
1627 +# $Id$
1628 +
1629 +EAPI=5
1630 +
1631 +inherit eutils autotools flag-o-matic versionator depend.apache apache-module db-use libtool systemd
1632 +
1633 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
1634 +
1635 +function php_get_uri ()
1636 +{
1637 + case "${1}" in
1638 + "php-pre")
1639 + echo "http://downloads.php.net/ab/${2}"
1640 + ;;
1641 + "php")
1642 + echo "http://www.php.net/distributions/${2}"
1643 + ;;
1644 + "olemarkus")
1645 + echo "https://dev.gentoo.org/~olemarkus/php/${2}"
1646 + ;;
1647 + "gentoo")
1648 + echo "mirror://gentoo/${2}"
1649 + ;;
1650 + *)
1651 + die "unhandled case in php_get_uri"
1652 + ;;
1653 + esac
1654 +}
1655 +
1656 +PHP_MV="$(get_major_version)"
1657 +SLOT="$(get_version_component_range 1-2)"
1658 +
1659 +# alias, so we can handle different types of releases (finals, rcs, alphas,
1660 +# betas, ...) w/o changing the whole ebuild
1661 +PHP_PV="${PV/_rc/RC}"
1662 +PHP_PV="${PHP_PV/_alpha/alpha}"
1663 +PHP_PV="${PHP_PV/_beta/beta}"
1664 +PHP_RELEASE="php"
1665 +[[ ${PV} == ${PV/_alpha/} ]] || PHP_RELEASE="php-pre"
1666 +[[ ${PV} == ${PV/_beta/} ]] || PHP_RELEASE="php-pre"
1667 +[[ ${PV} == ${PV/_rc/} ]] || PHP_RELEASE="php-pre"
1668 +PHP_P="${PN}-${PHP_PV}"
1669 +
1670 +PHP_SRC_URI="$(php_get_uri "${PHP_RELEASE}" "${PHP_P}.tar.bz2")"
1671 +
1672 +PHP_FPM_CONF_VER="1"
1673 +
1674 +SRC_URI="${PHP_SRC_URI}"
1675 +
1676 +DESCRIPTION="The PHP language runtime engine: CLI, CGI, FPM/FastCGI, Apache2 and embed SAPIs"
1677 +HOMEPAGE="http://php.net/"
1678 +LICENSE="PHP-3"
1679 +
1680 +S="${WORKDIR}/${PHP_P}"
1681 +
1682 +# We can build the following SAPIs in the given order
1683 +SAPIS="embed cli cgi fpm apache2"
1684 +
1685 +# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
1686 +IUSE="${IUSE}
1687 + ${SAPIS/cli/+cli}
1688 + threads"
1689 +
1690 +IUSE="${IUSE} bcmath berkdb bzip2 calendar cdb cjk
1691 + crypt +ctype curl debug
1692 + enchant exif frontbase +fileinfo +filter firebird
1693 + flatfile ftp gd gdbm gmp +hash +iconv imap inifile
1694 + intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit mhash
1695 + mysql mysqli nls
1696 + oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
1697 + readline recode selinux +session sharedmem
1698 + +simplexml snmp soap sockets spell sqlite ssl
1699 + sysvipc systemd tidy +tokenizer truetype unicode vpx wddx
1700 + +xml xmlreader xmlwriter xmlrpc xpm xslt zip zlib"
1701 +
1702 +DEPEND="
1703 + >=app-eselect/eselect-php-0.7.1-r3[apache2?,fpm?]
1704 + >=dev-libs/libpcre-8.32[unicode]
1705 + apache2? ( || ( >=www-servers/apache-2.4[apache2_modules_unixd,threads=]
1706 + <www-servers/apache-2.4[threads=] ) )
1707 + berkdb? ( =sys-libs/db-4* )
1708 + bzip2? ( app-arch/bzip2 )
1709 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
1710 + cjk? ( !gd? (
1711 + virtual/jpeg:0
1712 + media-libs/libpng:0=
1713 + sys-libs/zlib
1714 + ) )
1715 + crypt? ( >=dev-libs/libmcrypt-2.4 )
1716 + curl? ( >=net-misc/curl-7.10.5 )
1717 + enchant? ( app-text/enchant )
1718 + exif? ( !gd? (
1719 + virtual/jpeg:0
1720 + media-libs/libpng:0=
1721 + sys-libs/zlib
1722 + ) )
1723 + firebird? ( dev-db/firebird )
1724 + gd? ( virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
1725 + gdbm? ( >=sys-libs/gdbm-1.8.0 )
1726 + gmp? ( >=dev-libs/gmp-4.1.2 )
1727 + iconv? ( virtual/libiconv )
1728 + imap? ( virtual/imap-c-client[ssl=] )
1729 + intl? ( dev-libs/icu:= )
1730 + iodbc? ( dev-db/libiodbc )
1731 + kerberos? ( virtual/krb5 )
1732 + ldap? ( >=net-nds/openldap-1.2.11 )
1733 + ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
1734 + libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
1735 + nls? ( sys-devel/gettext )
1736 + oci8-instant-client? ( dev-db/oracle-instantclient-basic )
1737 + odbc? ( >=dev-db/unixODBC-1.8.13 )
1738 + postgres? ( dev-db/postgresql )
1739 + qdbm? ( dev-db/qdbm )
1740 + readline? ( sys-libs/readline )
1741 + recode? ( app-text/recode )
1742 + sharedmem? ( dev-libs/mm )
1743 + simplexml? ( >=dev-libs/libxml2-2.6.8 )
1744 + snmp? ( >=net-analyzer/net-snmp-5.2 )
1745 + soap? ( >=dev-libs/libxml2-2.6.8 )
1746 + spell? ( >=app-text/aspell-0.50 )
1747 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
1748 + ssl? ( >=dev-libs/openssl-0.9.7 )
1749 + tidy? ( app-text/htmltidy )
1750 + truetype? (
1751 + =media-libs/freetype-2*
1752 + !gd? (
1753 + virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
1754 + )
1755 + unicode? ( dev-libs/oniguruma )
1756 + vpx? ( media-libs/libvpx )
1757 + wddx? ( >=dev-libs/libxml2-2.6.8 )
1758 + xml? ( >=dev-libs/libxml2-2.6.8 )
1759 + xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
1760 + xmlreader? ( >=dev-libs/libxml2-2.6.8 )
1761 + xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
1762 + xpm? (
1763 + x11-libs/libXpm
1764 + virtual/jpeg:0
1765 + media-libs/libpng:0= sys-libs/zlib
1766 + )
1767 + xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
1768 + zip? ( sys-libs/zlib )
1769 + zlib? ( sys-libs/zlib )
1770 + virtual/mta
1771 +"
1772 +
1773 +php="=${CATEGORY}/${PF}"
1774 +
1775 +REQUIRED_USE="
1776 + truetype? ( gd )
1777 + vpx? ( gd )
1778 + cjk? ( gd )
1779 + exif? ( gd )
1780 +
1781 + xpm? ( gd )
1782 + gd? ( zlib )
1783 + simplexml? ( xml )
1784 + soap? ( xml )
1785 + wddx? ( xml )
1786 + xmlrpc? ( || ( xml iconv ) )
1787 + xmlreader? ( xml )
1788 + xslt? ( xml )
1789 + ldap-sasl? ( ldap )
1790 + mhash? ( hash )
1791 + phar? ( hash )
1792 +
1793 + qdbm? ( !gdbm )
1794 + readline? ( !libedit )
1795 + recode? ( !imap !mysqli )
1796 + sharedmem? ( !threads )
1797 +
1798 + mysql? ( || ( mysqli pdo ) )
1799 +
1800 + !cli? ( !cgi? ( !fpm? ( !apache2? ( !embed? ( cli ) ) ) ) )"
1801 +
1802 +RDEPEND="${DEPEND}"
1803 +
1804 +RDEPEND="${RDEPEND}
1805 + fpm? (
1806 + selinux? ( sec-policy/selinux-phpfpm )
1807 + systemd? ( sys-apps/systemd ) )"
1808 +
1809 +DEPEND="${DEPEND}
1810 + sys-devel/flex
1811 + >=sys-devel/m4-1.4.3
1812 + >=sys-devel/libtool-1.5.18"
1813 +
1814 +# Allow users to install production version if they want to
1815 +
1816 +case "${PHP_INI_VERSION}" in
1817 + production|development)
1818 + ;;
1819 + *)
1820 + PHP_INI_VERSION="development"
1821 + ;;
1822 +esac
1823 +
1824 +PHP_INI_UPSTREAM="php.ini-${PHP_INI_VERSION}"
1825 +PHP_INI_FILE="php.ini"
1826 +
1827 +want_apache
1828 +
1829 +pkg_setup() {
1830 + depend.apache_pkg_setup
1831 +}
1832 +
1833 +php_install_ini() {
1834 + local phpsapi="${1}"
1835 +
1836 + # work out where we are installing the ini file
1837 + php_set_ini_dir "${phpsapi}"
1838 +
1839 + local phpinisrc="${PHP_INI_UPSTREAM}-${phpsapi}"
1840 + cp "${PHP_INI_UPSTREAM}" "${phpinisrc}"
1841 +
1842 + # default to /tmp for save_path, bug #282768
1843 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}"
1844 +
1845 + # Set the extension dir
1846 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" -i "${phpinisrc}"
1847 +
1848 + # Set the include path to point to where we want to find PEAR packages
1849 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}"
1850 +
1851 + dodir "${PHP_INI_DIR#${EPREFIX}}"
1852 + insinto "${PHP_INI_DIR#${EPREFIX}}"
1853 + newins "${phpinisrc}" "${PHP_INI_FILE}"
1854 +
1855 + elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
1856 + elog
1857 +
1858 + dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
1859 + dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
1860 +
1861 + if use_if_iuse opcache; then
1862 + elog "Adding opcache to $PHP_EXT_INI_DIR"
1863 + echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
1864 + dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
1865 + fi
1866 +
1867 + # SAPI-specific handling
1868 +
1869 + if [[ "${sapi}" == "fpm" ]] ; then
1870 + [[ -z ${PHP_FPM_CONF_VER} ]] && PHP_FPM_CONF_VER=0
1871 + einfo "Installing FPM CGI config file php-fpm.conf"
1872 + insinto "${PHP_INI_DIR#${EPREFIX}}"
1873 + newins "${FILESDIR}/php-fpm-r${PHP_FPM_CONF_VER}.conf" php-fpm.conf
1874 +
1875 + # Remove bogus /etc/php-fpm.conf.default (bug 359906)
1876 + [[ -f "${ED}/etc/php-fpm.conf.default" ]] && rm "${ED}/etc/php-fpm.conf.default"
1877 + fi
1878 +
1879 + # Install PHP ini files into /usr/share/php
1880 +
1881 + dodoc php.ini-development
1882 + dodoc php.ini-production
1883 +
1884 +}
1885 +
1886 +php_set_ini_dir() {
1887 + PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
1888 + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
1889 + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
1890 +}
1891 +
1892 +src_prepare() {
1893 + # USE=sharedmem (session/mod_mm to be exact) tries to mmap() this path
1894 + # ([empty session.save_path]/session_mm_[sapi][gid].sem)
1895 + # there is no easy way to circumvent that, all php calls during
1896 + # install use -n, so no php.ini file will be used.
1897 + # As such, this is the easiest way to get around
1898 + addpredict /session_mm_cli250.sem
1899 + addpredict /session_mm_cli0.sem
1900 +
1901 + # Change PHP branding
1902 + # Get the alpha/beta/rc version
1903 + sed -re "s|^(PHP_EXTRA_VERSION=\").*(\")|\1-pl${PR/r/}-gentoo\2|g" \
1904 + -i configure.in || die "Unable to change PHP branding"
1905 +
1906 + # Patch PHP to show Gentoo as the server platform
1907 + sed -e 's/PHP_UNAME=`uname -a | xargs`/PHP_UNAME=`uname -s -n -r -v | xargs`/g' \
1908 + -i configure.in || die "Failed to fix server platform name"
1909 +
1910 + # Patch PHP to support heimdal instead of mit-krb5
1911 + if has_version "app-crypt/heimdal" ; then
1912 + sed -e 's|gssapi_krb5|gssapi|g' -i acinclude.m4 \
1913 + || die "Failed to fix heimdal libname"
1914 + sed -e 's|PHP_ADD_LIBRARY(k5crypto, 1, $1)||g' -i acinclude.m4 \
1915 + || die "Failed to fix heimdal crypt library reference"
1916 + fi
1917 +
1918 + #Add user patches #357637
1919 + epatch_user
1920 +
1921 + #force rebuilding aclocal.m4
1922 + rm aclocal.m4
1923 + eautoreconf
1924 +
1925 + if [[ ${CHOST} == *-darwin* ]] ; then
1926 + # http://bugs.php.net/bug.php?id=48795, bug #343481
1927 + sed -i -e '/BUILD_CGI="\\$(CC)/s/CC/CXX/' configure || die
1928 + fi
1929 +}
1930 +
1931 +src_configure() {
1932 + addpredict /usr/share/snmp/mibs/.index
1933 + addpredict /var/lib/net-snmp/mib_indexes
1934 +
1935 + PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
1936 +
1937 + # This is a global variable and should be in caps. It isn't because the
1938 + # phpconfutils eclass relies on exactly this name...
1939 + # for --with-libdir see bug #327025
1940 + my_conf="
1941 + --prefix="${PHP_DESTDIR}"
1942 + --mandir="${PHP_DESTDIR}"/man
1943 + --infodir="${PHP_DESTDIR}"/info
1944 + --libdir="${PHP_DESTDIR}"/lib
1945 + --with-libdir=$(get_libdir)
1946 + --without-pear
1947 + $(use_enable threads maintainer-zts)"
1948 +
1949 + # extension USE flag shared
1950 + my_conf+="
1951 + $(use_enable bcmath bcmath )
1952 + $(use_with bzip2 bz2 "${EPREFIX}"/usr)
1953 + $(use_enable calendar calendar )
1954 + $(use_enable ctype ctype )
1955 + $(use_with curl curl "${EPREFIX}"/usr)
1956 + $(use_enable xml dom )
1957 + $(use_with enchant enchant "${EPREFIX}"/usr)
1958 + $(use_enable exif exif )
1959 + $(use_enable fileinfo fileinfo )
1960 + $(use_enable filter filter )
1961 + $(use_enable ftp ftp )
1962 + $(use_with nls gettext "${EPREFIX}"/usr)
1963 + $(use_with gmp gmp "${EPREFIX}"/usr)
1964 + $(use_enable hash hash )
1965 + $(use_with mhash mhash "${EPREFIX}"/usr)
1966 + $(use_with iconv iconv $(use elibc_glibc || use elibc_musl || echo "${EPREFIX}"/usr))
1967 + $(use_enable intl intl )
1968 + $(use_enable ipv6 ipv6 )
1969 + $(use_enable json json )
1970 + $(use_with kerberos kerberos "${EPREFIX}"/usr)
1971 + $(use_enable xml libxml )
1972 + $(use_with xml libxml-dir "${EPREFIX}"/usr)
1973 + $(use_enable unicode mbstring )
1974 + $(use_with crypt mcrypt "${EPREFIX}"/usr)
1975 + $(use_with unicode onig "${EPREFIX}"/usr)
1976 + $(use_with ssl openssl "${EPREFIX}"/usr)
1977 + $(use_with ssl openssl-dir "${EPREFIX}"/usr)
1978 + $(use_enable pcntl pcntl )
1979 + $(use_enable phar phar )
1980 + $(use_enable pdo pdo )
1981 + $(use_enable opcache opcache )
1982 + $(use_with postgres pgsql "${EPREFIX}"/usr)
1983 + $(use_enable posix posix )
1984 + $(use_with spell pspell "${EPREFIX}"/usr)
1985 + $(use_with recode recode "${EPREFIX}"/usr)
1986 + $(use_enable simplexml simplexml )
1987 + $(use_enable sharedmem shmop )
1988 + $(use_with snmp snmp "${EPREFIX}"/usr)
1989 + $(use_enable soap soap )
1990 + $(use_enable sockets sockets )
1991 + $(use_with sqlite sqlite3 "${EPREFIX}"/usr)
1992 + $(use_enable sysvipc sysvmsg )
1993 + $(use_enable sysvipc sysvsem )
1994 + $(use_enable sysvipc sysvshm )
1995 + $(use_with systemd fpm-systemd)
1996 + $(use_with tidy tidy "${EPREFIX}"/usr)
1997 + $(use_enable tokenizer tokenizer )
1998 + $(use_enable wddx wddx )
1999 + $(use_enable xml xml )
2000 + $(use_enable xmlreader xmlreader )
2001 + $(use_enable xmlwriter xmlwriter )
2002 + $(use_with xmlrpc xmlrpc)
2003 + $(use_with xslt xsl "${EPREFIX}"/usr)
2004 + $(use_enable zip zip )
2005 + $(use_with zlib zlib "${EPREFIX}"/usr)
2006 + $(use_enable debug debug )"
2007 +
2008 + # DBA support
2009 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
2010 + || use qdbm ; then
2011 + my_conf="${my_conf} --enable-dba${shared}"
2012 + fi
2013 +
2014 + # DBA drivers support
2015 + my_conf+="
2016 + $(use_with cdb cdb)
2017 + $(use_with berkdb db4 ${EPREFIX}/usr)
2018 + $(use_enable flatfile flatfile )
2019 + $(use_with gdbm gdbm ${EPREFIX}/usr)
2020 + $(use_enable inifile inifile )
2021 + $(use_with qdbm qdbm ${EPREFIX}/usr)"
2022 +
2023 + # Support for the GD graphics library
2024 + my_conf+="
2025 + $(use_with truetype freetype-dir ${EPREFIX}/usr)
2026 + $(use_enable cjk gd-jis-conv )
2027 + $(use_with gd jpeg-dir ${EPREFIX}/usr)
2028 + $(use_with gd png-dir ${EPREFIX}/usr)
2029 + $(use_with xpm xpm-dir ${EPREFIX}/usr)
2030 + $(use_with vpx vpx-dir ${EPREFIX}/usr)"
2031 + # enable gd last, so configure can pick up the previous settings
2032 + my_conf+="
2033 + $(use_with gd gd)"
2034 +
2035 + # IMAP support
2036 + if use imap ; then
2037 + my_conf+="
2038 + $(use_with imap imap ${EPREFIX}/usr)
2039 + $(use_with ssl imap-ssl ${EPREFIX}/usr)"
2040 + fi
2041 +
2042 + # Interbase/firebird support
2043 +
2044 + if use firebird ; then
2045 + my_conf+="
2046 + $(use_with firebird interbase ${EPREFIX}/usr)"
2047 + fi
2048 +
2049 + # LDAP support
2050 + if use ldap ; then
2051 + my_conf+="
2052 + $(use_with ldap ldap ${EPREFIX}/usr)
2053 + $(use_with ldap-sasl ldap-sasl ${EPREFIX}/usr)"
2054 + fi
2055 +
2056 + # MySQL support
2057 + local mysqllib="mysqlnd"
2058 + local mysqlilib="mysqlnd"
2059 +
2060 + my_conf+=" $(use_with mysqli mysqli $mysqlilib)"
2061 +
2062 + local mysqlsock=" $(use_with mysql mysql-sock ${EPREFIX}/var/run/mysqld/mysqld.sock)"
2063 + if use mysql ; then
2064 + my_conf+="${mysqlsock}"
2065 + elif use mysqli ; then
2066 + my_conf+="${mysqlsock}"
2067 + fi
2068 +
2069 + # ODBC support
2070 + if use odbc ; then
2071 + my_conf+="
2072 + $(use_with odbc unixODBC ${EPREFIX}/usr)"
2073 + fi
2074 +
2075 + if use iodbc ; then
2076 + my_conf+="
2077 + $(use_with iodbc iodbc ${EPREFIX}/usr)"
2078 + fi
2079 +
2080 + # Oracle support
2081 + if use oci8-instant-client ; then
2082 + my_conf+="
2083 + $(use_with oci8-instant-client oci8)"
2084 + fi
2085 +
2086 + # PDO support
2087 + if use pdo ; then
2088 + my_conf+="
2089 + $(use_with mysql pdo-mysql ${mysqllib})
2090 + $(use_with postgres pdo-pgsql )
2091 + $(use_with sqlite pdo-sqlite ${EPREFIX}/usr)
2092 + $(use_with odbc pdo-odbc unixODBC,${EPREFIX}/usr)"
2093 + if use oci8-instant-client ; then
2094 + my_conf+="
2095 + $(use_with oci8-instant-client pdo-oci)"
2096 + fi
2097 + fi
2098 +
2099 + # readline/libedit support
2100 + my_conf+="
2101 + $(use_with readline readline ${EPREFIX}/usr)
2102 + $(use_with libedit libedit ${EPREFIX}/usr)"
2103 +
2104 + # Session support
2105 + if use session ; then
2106 + my_conf+="
2107 + $(use_with sharedmem mm ${EPREFIX}/usr)"
2108 + else
2109 + my_conf+="
2110 + $(use_enable session session )"
2111 + fi
2112 +
2113 + # Use pic for shared modules such as apache2's mod_php
2114 + my_conf="${my_conf} --with-pic"
2115 +
2116 + # we use the system copy of pcre
2117 + # --with-pcre-regex affects ext/pcre
2118 + # --with-pcre-dir affects ext/filter and ext/zip
2119 + my_conf="${my_conf} --with-pcre-regex=${EPREFIX}/usr --with-pcre-dir=${EPREFIX}/usr"
2120 +
2121 + # Catch CFLAGS problems
2122 + # Fixes bug #14067.
2123 + # Changed order to run it in reverse for bug #32022 and #12021.
2124 + replace-cpu-flags "k6*" "i586"
2125 +
2126 + # Support user-passed configuration parameters
2127 + my_conf="${my_conf} ${EXTRA_ECONF:-}"
2128 +
2129 + # Support the Apache2 extras, they must be set globally for all
2130 + # SAPIs to work correctly, especially for external PHP extensions
2131 +
2132 + mkdir -p "${WORKDIR}/sapis-build"
2133 + for one_sapi in $SAPIS ; do
2134 + use "${one_sapi}" || continue
2135 + php_set_ini_dir "${one_sapi}"
2136 +
2137 + cp -r "${S}" "${WORKDIR}/sapis-build/${one_sapi}"
2138 + cd "${WORKDIR}/sapis-build/${one_sapi}"
2139 +
2140 + sapi_conf="${my_conf} --with-config-file-path=${PHP_INI_DIR}
2141 + --with-config-file-scan-dir=${PHP_EXT_INI_DIR_ACTIVE}"
2142 +
2143 + for sapi in $SAPIS ; do
2144 + case "$sapi" in
2145 + cli|cgi|embed|fpm)
2146 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
2147 + sapi_conf="${sapi_conf} --enable-${sapi}"
2148 + else
2149 + sapi_conf="${sapi_conf} --disable-${sapi}"
2150 + fi
2151 + ;;
2152 +
2153 + apache2)
2154 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
2155 + sapi_conf="${sapi_conf} --with-apxs2=${EPREFIX}/usr/sbin/apxs"
2156 + else
2157 + sapi_conf="${sapi_conf} --without-apxs2"
2158 + fi
2159 + ;;
2160 + esac
2161 + done
2162 +
2163 + econf ${sapi_conf}
2164 + done
2165 +}
2166 +
2167 +src_compile() {
2168 + # snmp seems to run during src_compile, too (bug #324739)
2169 + addpredict /usr/share/snmp/mibs/.index
2170 + addpredict /var/lib/net-snmp/mib_indexes
2171 +
2172 + for sapi in ${SAPIS} ; do
2173 + if use "${sapi}"; then
2174 + cd "${WORKDIR}/sapis-build/$sapi" || "Failed to change dir to ${WORKDIR}/sapis-build/$1"
2175 + emake || die "emake failed"
2176 + fi
2177 + done
2178 +}
2179 +
2180 +src_install() {
2181 + # see bug #324739 for what happens when we don't have that
2182 + addpredict /usr/share/snmp/mibs/.index
2183 +
2184 + # grab the first SAPI that got built and install common files from there
2185 + local first_sapi=""
2186 + for sapi in $SAPIS ; do
2187 + if use $sapi ; then
2188 + first_sapi=$sapi
2189 + break
2190 + fi
2191 + done
2192 +
2193 + # Makefile forgets to create this before trying to write to it...
2194 + dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
2195 +
2196 + # Install php environment (without any sapis)
2197 + cd "${WORKDIR}/sapis-build/$first_sapi"
2198 + emake INSTALL_ROOT="${D}" \
2199 + install-build install-headers install-programs \
2200 + || die "emake install failed"
2201 +
2202 + local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
2203 +
2204 + # Create the directory where we'll put version-specific php scripts
2205 + keepdir /usr/share/php${PHP_MV}
2206 +
2207 + local sapi="", file=""
2208 + local sapi_list=""
2209 +
2210 + for sapi in ${SAPIS}; do
2211 + if use "${sapi}" ; then
2212 + einfo "Installing SAPI: ${sapi}"
2213 + cd "${WORKDIR}/sapis-build/${sapi}"
2214 +
2215 + if [[ "${sapi}" == "apache2" ]] ; then
2216 + # We're specifically not using emake install-sapi as libtool
2217 + # may cause unnecessary relink failures (see bug #351266)
2218 + insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
2219 + newins ".libs/libphp${PHP_MV}$(get_libname)" "libphp${PHP_MV}$(get_libname)"
2220 + keepdir "/usr/$(get_libdir)/apache2/modules"
2221 + else
2222 + # needed each time, php_install_ini would reset it
2223 + local dest="${PHP_DESTDIR#${EPREFIX}}"
2224 + into "${dest}"
2225 + case "$sapi" in
2226 + cli)
2227 + source="sapi/cli/php"
2228 + ;;
2229 + cgi)
2230 + source="sapi/cgi/php-cgi"
2231 + ;;
2232 + fpm)
2233 + source="sapi/fpm/php-fpm"
2234 + ;;
2235 + embed)
2236 + source="libs/libphp${PHP_MV}$(get_libname)"
2237 + ;;
2238 + *)
2239 + die "unhandled sapi in src_install"
2240 + ;;
2241 + esac
2242 +
2243 + if [[ "${source}" == *"$(get_libname)" ]]; then
2244 + dolib.so "${source}" || die "Unable to install ${sapi} sapi"
2245 + else
2246 + dobin "${source}" || die "Unable to install ${sapi} sapi"
2247 + local name="$(basename ${source})"
2248 + dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
2249 + fi
2250 + fi
2251 +
2252 + php_install_ini "${sapi}"
2253 +
2254 + # construct correct SAPI string for php-config
2255 + # thanks to ferringb for the bash voodoo
2256 + if [[ "${sapi}" == "apache2" ]]; then
2257 + sapi_list="${sapi_list:+${sapi_list} }apache2handler"
2258 + else
2259 + sapi_list="${sapi_list:+${sapi_list} }${sapi}"
2260 + fi
2261 + fi
2262 + done
2263 +
2264 + # Installing opcache module
2265 + if use_if_iuse opcache ; then
2266 + dolib.so "modules/opcache$(get_libname)" || die "Unable to install opcache module"
2267 + fi
2268 +
2269 + # Install env.d files
2270 + newenvd "${FILESDIR}/20php5-envd" \
2271 + "20php${SLOT}"
2272 + sed -e "s|/lib/|/$(get_libdir)/|g" -i \
2273 + "${ED}/etc/env.d/20php${SLOT}"
2274 + sed -e "s|php5|php${SLOT}|g" -i \
2275 + "${ED}/etc/env.d/20php${SLOT}"
2276 +
2277 + # set php-config variable correctly (bug #278439)
2278 + sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
2279 + "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config"
2280 +
2281 + if use fpm ; then
2282 + if use systemd; then
2283 + systemd_newunit "${FILESDIR}/php-fpm_at.service" "php-fpm@${SLOT}.service"
2284 + else
2285 + systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" "php-fpm@${SLOT}.service"
2286 + fi
2287 + fi
2288 +}
2289 +
2290 +src_test() {
2291 + echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
2292 + PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
2293 + if [[ ! -x "${PHP_BIN}" ]] ; then
2294 + ewarn "Test phase requires USE=cli, skipping"
2295 + return
2296 + else
2297 + export TEST_PHP_EXECUTABLE="${PHP_BIN}"
2298 + fi
2299 +
2300 + if [[ -x "${WORKDIR}/sapis/cgi/php-cgi" ]] ; then
2301 + export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis/cgi/php-cgi"
2302 + fi
2303 +
2304 + REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d "session.save_path=${T}" \
2305 + "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d "session.save_path=${T}"
2306 +
2307 + for name in ${EXPECTED_TEST_FAILURES}; do
2308 + mv "${name}.out" "${name}.out.orig" 2>/dev/null
2309 + done
2310 +
2311 + local failed="$(find -name '*.out')"
2312 + if [[ ${failed} != "" ]] ; then
2313 + ewarn "The following test cases failed unexpectedly:"
2314 + for name in ${failed}; do
2315 + ewarn " ${name/.out/}"
2316 + done
2317 + else
2318 + einfo "No unexpected test failures, all fine"
2319 + fi
2320 +
2321 + if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
2322 + local passed=""
2323 + for name in ${EXPECTED_TEST_FAILURES}; do
2324 + [[ -f "${name}.diff" ]] && continue
2325 + passed="${passed} ${name}"
2326 + done
2327 + if [[ ${passed} != "" ]] ; then
2328 + einfo "The following test cases passed unexpectedly:"
2329 + for name in ${passed}; do
2330 + ewarn " ${passed}"
2331 + done
2332 + else
2333 + einfo "None of the known-to-fail tests passed, all fine"
2334 + fi
2335 + fi
2336 +}
2337 +
2338 +pkg_postinst() {
2339 + # Output some general info to the user
2340 + if use apache2 ; then
2341 + APACHE2_MOD_DEFINE="PHP5"
2342 + APACHE2_MOD_CONF="70_mod_php5" # actually provided by app-eselect/eselect-php
2343 + apache-module_pkg_postinst
2344 + fi
2345 +
2346 + # Create the symlinks for php
2347 + for m in ${SAPIS}; do
2348 + [[ ${m} == 'embed' ]] && continue;
2349 + if use $m ; then
2350 + local ci=$(eselect php show $m)
2351 + if [[ -z $ci ]]; then
2352 + eselect php set $m php${SLOT}
2353 + einfo "Switched ${m} to use php:${SLOT}"
2354 + einfo
2355 + elif [[ $ci != "php${SLOT}" ]] ; then
2356 + elog "To switch $m to use php:${SLOT}, run"
2357 + elog " eselect php set $m php${SLOT}"
2358 + elog
2359 + fi
2360 + fi
2361 + done
2362 +
2363 + elog "Make sure that PHP_TARGETS in ${EPREFIX}/etc/make.conf includes php${SLOT/./-} in order"
2364 + elog "to compile extensions for the ${SLOT} ABI"
2365 + elog
2366 + if ! use readline && use cli ; then
2367 + ewarn "Note that in order to use php interactivly, you need to enable"
2368 + ewarn "the readline USE flag or php -a will hang"
2369 + fi
2370 + elog
2371 + elog "This ebuild installed a version of php.ini based on php.ini-${PHP_INI_VERSION} version."
2372 + elog "You can chose which version of php.ini to install by default by setting PHP_INI_VERSION to either"
2373 + elog "'production' or 'development' in ${EPREFIX}/etc/make.conf"
2374 + elog "Both versions of php.ini can be found in ${EPREFIX}/usr/share/doc/${PF}"
2375 +
2376 + elog
2377 + elog "For more details on how minor version slotting works (PHP_TARGETS) please read the upgrade guide:"
2378 + elog "https://www.gentoo.org/proj/en/php/php-upgrading.xml"
2379 + elog
2380 +}
2381 +
2382 +pkg_prerm() {
2383 + eselect php cleanup
2384 +}