Gentoo Archives: gentoo-commits

From: Brian Evans <grknight@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/php/
Date: Thu, 02 May 2019 19:56:53
Message-Id: 1556826779.8f7a5e0ee29253e90f350051700f82cf28c5c9b2.grknight@gentoo
1 commit: 8f7a5e0ee29253e90f350051700f82cf28c5c9b2
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Thu May 2 19:52:59 2019 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Thu May 2 19:52:59 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8f7a5e0e
7
8 dev-lang/php: Version bump for 7.1.29
9
10 Package-Manager: Portage-2.3.66, Repoman-2.3.12
11 Signed-off-by: Brian Evans <grknight <AT> gentoo.org>
12
13 dev-lang/php/Manifest | 1 +
14 dev-lang/php/php-7.1.29.ebuild | 737 +++++++++++++++++++++++++++++++++++++++++
15 2 files changed, 738 insertions(+)
16
17 diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest
18 index 143f994dfd8..fd385020cce 100644
19 --- a/dev-lang/php/Manifest
20 +++ b/dev-lang/php/Manifest
21 @@ -1,6 +1,7 @@
22 DIST php-5.6.40.tar.xz 12472236 BLAKE2B f41147eaec9b15e965540f9e871691cc88848dd619bae6af85e7bba0130b71ce91bad5cdbbadbb537c42df83369f5c731007339a9d9e21e689e913c135201afc SHA512 997b5a952a60cf9166671cc91fcc34c674dd62bfd5cb0a9cdf3fdf2d088b5d19943d94c1cf193f8ab71fc4957d9a9a4c7c2fb8826f937501c1c0a0858f10e329
23 DIST php-7.1.27.tar.xz 12219868 BLAKE2B 9de4902504e50b53aab28eac2252aa79302541352b1323a17e68cc58e22cd3b6108b3f7d6ba4779a7f87a561442cf3c44c5660418a354d3b48b6df270a761f8b SHA512 a7019788b02f624e19f804cb0c34578443fc2e0a582a32e72d1340f3cd7bb866631497fe61d18f31f92bad5aa7667847e21bd3916fcdd6f04a3b8f88c805f544
24 DIST php-7.1.28.tar.xz 12222508 BLAKE2B 1e52632f801a717ea7020665da11536ba7ab21ea0e5d5ccf147003cb9a87878053ebabf5f4cdd0810207de1e2ebdd683d7afefd72aa5be521c5690130a72b349 SHA512 fcf983adb7669b83ff3aee33f9d18328f8f36b304bc51bfd1f13a7493365e98204c63214fe4add157dffa44d5407b257dee7247168a14efa36dcfa70d4909a6e
25 +DIST php-7.1.29.tar.xz 12221984 BLAKE2B a07e7e5ee58f9a74437d865bb7ee9a4458fde52cf3e678128fb4c2d1cc076da0d37dc16c8908011ed542cc37f492d56a6565e06315630d2a213e2a42accdc4f4 SHA512 97575ec588fd3ab51360525fc02058254b95e89e0a36c74a2890ae7619adda1a5489f3675fa83754f8f693af463cdf17232db071351b6ace9f83d4c3c643f682
26 DIST php-7.2.16.tar.xz 12166372 BLAKE2B c59ac69b717a8ee88f229baa94c43f9ee1d9c7161c767a95c3a9719ee70cdc9b61aaff75504aca09bba10d224d9a717cb7c985060b6912491857a003e6cbc349 SHA512 cd2ea3c68d7ed20317800f4b838b0dd9ae2fde508c79662b296dacdacf6c7e35b6ef30a6564516d7b22e82749a6e9e2ffcfd95b05cd79a9f227fbfaf9e25bc31
27 DIST php-7.2.18.tar.xz 12172696 BLAKE2B c23f4dffe60ad48b53de1c565ecb4f378f5d3daccde98ec8d9bddcfce8bd1a48a75061a72d0094d0db6719a3c0a96cae25ce0ef0fbfadc28fbeff27b332c8107 SHA512 b38034aa13867496009903ba64e4e8bf3216307a9ff1dade60a1477671ecf7bceb5062b349f6997d9af414d58d46ea7bb3f9855e372c230f4a6cff26ad9985d6
28 DIST php-7.3.5.tar.xz 11981356 BLAKE2B f0ea69358519458d1e48f598f3af808f560d824f417995ea80fc63c8610fb04144a471cee7941802b29eaf24b233b506baa4fff390e57292335f88c434b8dc46 SHA512 3231947b01333987568ec3304bebf0c089a23cd6bc4a7139683bd36b2490fef13ed494108b645d40d5ab55f65990004445ba04af48393a9a508cfa7379ba81d3
29
30 diff --git a/dev-lang/php/php-7.1.29.ebuild b/dev-lang/php/php-7.1.29.ebuild
31 new file mode 100644
32 index 00000000000..21ae6551ee5
33 --- /dev/null
34 +++ b/dev-lang/php/php-7.1.29.ebuild
35 @@ -0,0 +1,737 @@
36 +# Copyright 1999-2019 Gentoo Authors
37 +# Distributed under the terms of the GNU General Public License v2
38 +
39 +EAPI="7"
40 +
41 +inherit flag-o-matic systemd autotools
42 +
43 +DESCRIPTION="The PHP language runtime engine"
44 +HOMEPAGE="https://php.net/"
45 +SRC_URI="https://php.net/distributions/${P}.tar.xz"
46 +
47 +LICENSE="PHP-3.01
48 + BSD
49 + Zend-2.0
50 + bcmath? ( LGPL-2.1+ )
51 + fpm? ( BSD-2 )
52 + gd? ( gd )
53 + unicode? ( BSD-2 LGPL-2.1 )"
54 +
55 +SLOT="$(ver_cut 1-2)"
56 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
57 +
58 +# We can build the following SAPIs in the given order
59 +SAPIS="embed cli cgi fpm apache2 phpdbg"
60 +
61 +# SAPIs and SAPI-specific USE flags (cli SAPI is default on):
62 +IUSE="${IUSE}
63 + ${SAPIS/cli/+cli}
64 + threads"
65 +
66 +IUSE="${IUSE} acl bcmath berkdb bzip2 calendar cdb cjk
67 + coverage crypt +ctype curl debug
68 + enchant exif +fileinfo +filter firebird
69 + flatfile ftp gd gdbm gmp +hash +iconv imap inifile
70 + intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit libressl
71 + mhash mssql mysql mysqli nls
72 + oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm
73 + readline recode selinux +session session-mm sharedmem
74 + +simplexml snmp soap sockets spell sqlite ssl
75 + sysvipc systemd test tidy +tokenizer truetype unicode wddx webp
76 + +xml xmlreader xmlwriter xmlrpc xpm xslt zip zlib"
77 +
78 +# The supported (that is, autodetected) versions of BDB are listed in
79 +# the ./configure script. Other versions *work*, but we need to stick to
80 +# the ones that can be detected to avoid a repeat of bug #564824.
81 +COMMON_DEPEND="
82 + >=app-eselect/eselect-php-0.9.1[apache2?,fpm?]
83 + >=dev-libs/libpcre-8.32[unicode]
84 + fpm? ( acl? ( sys-apps/acl ) )
85 + apache2? ( || ( >=www-servers/apache-2.4[apache2_modules_unixd,threads=]
86 + <www-servers/apache-2.4[threads=] ) )
87 + berkdb? ( || ( sys-libs/db:5.3
88 + sys-libs/db:5.1
89 + sys-libs/db:4.8
90 + sys-libs/db:4.7
91 + sys-libs/db:4.6
92 + sys-libs/db:4.5 ) )
93 + bzip2? ( app-arch/bzip2:0= )
94 + cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
95 + coverage? ( dev-util/lcov )
96 + crypt? ( >=dev-libs/libmcrypt-2.4 )
97 + curl? ( >=net-misc/curl-7.10.5 )
98 + enchant? ( <app-text/enchant-2.0:0 )
99 + firebird? ( dev-db/firebird )
100 + gd? ( virtual/jpeg:0 media-libs/libpng:0= sys-libs/zlib )
101 + gdbm? ( >=sys-libs/gdbm-1.8.0:0= )
102 + gmp? ( dev-libs/gmp:0= )
103 + iconv? ( virtual/libiconv )
104 + imap? ( virtual/imap-c-client[kerberos=,ssl=] )
105 + intl? ( dev-libs/icu:= )
106 + iodbc? ( dev-db/libiodbc )
107 + kerberos? ( virtual/krb5 )
108 + ldap? ( >=net-nds/openldap-1.2.11 )
109 + ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 )
110 + libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) )
111 + mssql? ( dev-db/freetds[mssql] )
112 + nls? ( sys-devel/gettext )
113 + oci8-instant-client? ( dev-db/oracle-instantclient-basic )
114 + odbc? ( >=dev-db/unixODBC-1.8.13 )
115 + postgres? ( dev-db/postgresql:* )
116 + qdbm? ( dev-db/qdbm )
117 + readline? ( sys-libs/readline:0= )
118 + recode? ( app-text/recode )
119 + session-mm? ( dev-libs/mm )
120 + simplexml? ( >=dev-libs/libxml2-2.6.8 )
121 + snmp? ( >=net-analyzer/net-snmp-5.2 )
122 + soap? ( >=dev-libs/libxml2-2.6.8 )
123 + spell? ( >=app-text/aspell-0.50 )
124 + sqlite? ( >=dev-db/sqlite-3.7.6.3 )
125 + ssl? (
126 + !libressl? ( dev-libs/openssl:0= )
127 + libressl? ( dev-libs/libressl:0= )
128 + )
129 + tidy? ( || ( app-text/tidy-html5 app-text/htmltidy ) )
130 + truetype? ( =media-libs/freetype-2* )
131 + unicode? ( dev-libs/oniguruma:= )
132 + wddx? ( >=dev-libs/libxml2-2.6.8 )
133 + webp? ( media-libs/libwebp:0= )
134 + xml? ( >=dev-libs/libxml2-2.6.8 )
135 + xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv )
136 + xmlreader? ( >=dev-libs/libxml2-2.6.8 )
137 + xmlwriter? ( >=dev-libs/libxml2-2.6.8 )
138 + xpm? ( x11-libs/libXpm )
139 + xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 )
140 + zip? ( sys-libs/zlib:0= )
141 + zlib? ( sys-libs/zlib:0= )
142 +"
143 +
144 +RDEPEND="${COMMON_DEPEND}
145 + virtual/mta
146 + fpm? (
147 + selinux? ( sec-policy/selinux-phpfpm )
148 + systemd? ( sys-apps/systemd ) )"
149 +
150 +# Bison isn't actually needed when building from a release tarball
151 +# However, the configure script will warn if it's absent or if you
152 +# have an incompatible version installed. See bug 593278.
153 +DEPEND="${COMMON_DEPEND}
154 + app-arch/xz-utils
155 + >=sys-devel/bison-3.0.1"
156 +
157 +BDEPEND="virtual/pkgconfig"
158 +
159 +# Without USE=readline or libedit, the interactive "php -a" CLI will hang.
160 +REQUIRED_USE="
161 + || ( cli cgi fpm apache2 embed phpdbg )
162 + cli? ( ^^ ( readline libedit ) )
163 + truetype? ( gd zlib )
164 + webp? ( gd zlib )
165 + cjk? ( gd zlib )
166 + exif? ( gd zlib )
167 + xpm? ( gd zlib )
168 + gd? ( zlib )
169 + simplexml? ( xml )
170 + soap? ( xml )
171 + wddx? ( xml )
172 + xmlrpc? ( || ( xml iconv ) )
173 + xmlreader? ( xml )
174 + xslt? ( xml )
175 + ldap-sasl? ( ldap )
176 + mhash? ( hash )
177 + phar? ( hash )
178 + qdbm? ( !gdbm )
179 + readline? ( !libedit )
180 + recode? ( !imap !mysqli !mysql )
181 + session-mm? ( session !threads )
182 + mysql? ( hash || ( mysqli pdo ) )
183 + mysqli? ( hash )
184 +"
185 +PATCHES=(
186 + "${FILESDIR}/php-freetype-2.9.1.patch"
187 + "${FILESDIR}/php-7.1.25-intl-use-icu-namespace.patch"
188 +)
189 +
190 +PHP_MV="$(ver_cut 1)"
191 +
192 +php_install_ini() {
193 + local phpsapi="${1}"
194 +
195 + # work out where we are installing the ini file
196 + php_set_ini_dir "${phpsapi}"
197 +
198 + # Always install the production INI file, bug 611214.
199 + local phpinisrc="php.ini-production-${phpsapi}"
200 + cp php.ini-production "${phpinisrc}" || die
201 +
202 + # default to /tmp for save_path, bug #282768
203 + sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die
204 +
205 + # Set the extension dir
206 + sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \
207 + -i "${phpinisrc}" || die
208 +
209 + # Set the include path to point to where we want to find PEAR packages
210 + sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die
211 +
212 + dodir "${PHP_INI_DIR#${EPREFIX}}"
213 + insinto "${PHP_INI_DIR#${EPREFIX}}"
214 + newins "${phpinisrc}" php.ini
215 +
216 + elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}"
217 + elog
218 +
219 + dodir "${PHP_EXT_INI_DIR#${EPREFIX}}"
220 + dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}"
221 +
222 + if use opcache; then
223 + elog "Adding opcache to $PHP_EXT_INI_DIR"
224 + echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \
225 + "${D}/${PHP_EXT_INI_DIR}"/opcache.ini
226 + dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" \
227 + "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini"
228 + fi
229 +
230 + # SAPI-specific handling
231 + if [[ "${sapi}" == "fpm" ]] ; then
232 + einfo "Installing FPM config files php-fpm.conf and www.conf"
233 + insinto "${PHP_INI_DIR#${EPREFIX}}"
234 + doins sapi/fpm/php-fpm.conf
235 + insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d"
236 + doins sapi/fpm/www.conf
237 + fi
238 +
239 + dodoc php.ini-{development,production}
240 +}
241 +
242 +php_set_ini_dir() {
243 + PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}"
244 + PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext"
245 + PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active"
246 +}
247 +
248 +src_prepare() {
249 + default
250 +
251 + # In php-7.x, the FPM pool configuration files have been split off
252 + # of the main config. By default the pool config files go in
253 + # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the
254 + # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later
255 + # we'll install the pool configuration file "www.conf" there.
256 + php_set_ini_dir fpm
257 + sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \
258 + sapi/fpm/php-fpm.conf.in \
259 + || die 'failed to move the include directory in php-fpm.conf'
260 +
261 + # Bug 669566 - necessary so that build tools are updated for commands like pecl
262 + # Force rebuilding aclocal.m4
263 + rm -f aclocal.m4 || die "failed to remove aclocal.m4 in src_prepare"
264 + eautoreconf
265 +}
266 +
267 +src_configure() {
268 + addpredict /usr/share/snmp/mibs/.index #nowarn
269 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
270 +
271 + PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}"
272 +
273 + # The php-fpm config file wants localstatedir to be ${EPREFIX}/var
274 + # and not the Gentoo default ${EPREFIX}/var/lib. See bug 572002.
275 + local our_conf=(
276 + --prefix="${PHP_DESTDIR}"
277 + --mandir="${PHP_DESTDIR}/man"
278 + --infodir="${PHP_DESTDIR}/info"
279 + --libdir="${PHP_DESTDIR}/lib"
280 + --with-libdir="$(get_libdir)"
281 + --localstatedir="${EPREFIX}/var"
282 + --without-pear
283 + $(use_enable threads maintainer-zts)
284 + )
285 +
286 + our_conf+=(
287 + $(use_enable bcmath bcmath)
288 + $(use_with bzip2 bz2 "${EPREFIX}/usr")
289 + $(use_enable calendar calendar)
290 + $(use_enable coverage gcov)
291 + $(use_enable ctype ctype)
292 + $(use_with curl curl "${EPREFIX}/usr")
293 + $(use_enable xml dom)
294 + $(use_with enchant enchant "${EPREFIX}/usr")
295 + $(use_enable exif exif)
296 + $(use_enable fileinfo fileinfo)
297 + $(use_enable filter filter)
298 + $(use_enable ftp ftp)
299 + $(use_with nls gettext "${EPREFIX}/usr")
300 + $(use_with gmp gmp "${EPREFIX}/usr")
301 + $(use_enable hash hash)
302 + $(use_with mhash mhash "${EPREFIX}/usr")
303 + $(use_with iconv iconv \
304 + $(use elibc_glibc || use elibc_musl || use elibc_FreeBSD || echo "${EPREFIX}/usr"))
305 + $(use_enable intl intl)
306 + $(use_enable ipv6 ipv6)
307 + $(use_enable json json)
308 + $(use_with kerberos kerberos "${EPREFIX}/usr")
309 + $(use_enable xml libxml)
310 + $(use_with xml libxml-dir "${EPREFIX}/usr")
311 + $(use_enable unicode mbstring)
312 + $(use_with crypt mcrypt "${EPREFIX}/usr")
313 + $(use_with unicode onig "${EPREFIX}/usr")
314 + $(use_with ssl openssl "${EPREFIX}/usr")
315 + $(use_with ssl openssl-dir "${EPREFIX}/usr")
316 + $(use_enable pcntl pcntl)
317 + $(use_enable phar phar)
318 + $(use_enable pdo pdo)
319 + $(use_enable opcache opcache)
320 + $(use_with postgres pgsql "${EPREFIX}/usr")
321 + $(use_enable posix posix)
322 + $(use_with spell pspell "${EPREFIX}/usr")
323 + $(use_with recode recode "${EPREFIX}/usr")
324 + $(use_enable simplexml simplexml)
325 + $(use_enable sharedmem shmop)
326 + $(use_with snmp snmp "${EPREFIX}/usr")
327 + $(use_enable soap soap)
328 + $(use_enable sockets sockets)
329 + $(use_with sqlite sqlite3 "${EPREFIX}/usr")
330 + $(use_enable sysvipc sysvmsg)
331 + $(use_enable sysvipc sysvsem)
332 + $(use_enable sysvipc sysvshm)
333 + $(use_with tidy tidy "${EPREFIX}/usr")
334 + $(use_enable tokenizer tokenizer)
335 + $(use_enable wddx wddx)
336 + $(use_enable xml xml)
337 + $(use_enable xmlreader xmlreader)
338 + $(use_enable xmlwriter xmlwriter)
339 + $(use_with xmlrpc xmlrpc)
340 + $(use_with xslt xsl "${EPREFIX}/usr")
341 + $(use_enable zip zip)
342 + $(use_with zlib zlib "${EPREFIX}/usr")
343 + $(use_enable debug debug)
344 + )
345 +
346 + # DBA support
347 + if use cdb || use berkdb || use flatfile || use gdbm || use inifile \
348 + || use qdbm ; then
349 + our_conf+=( "--enable-dba${shared}" )
350 + fi
351 +
352 + # DBA drivers support
353 + our_conf+=(
354 + $(use_with cdb cdb)
355 + $(use_with berkdb db4 "${EPREFIX}/usr")
356 + $(use_enable flatfile flatfile)
357 + $(use_with gdbm gdbm "${EPREFIX}/usr")
358 + $(use_enable inifile inifile)
359 + $(use_with qdbm qdbm "${EPREFIX}/usr")
360 + )
361 +
362 + # Support for the GD graphics library
363 + our_conf+=(
364 + $(use_with truetype freetype-dir "${EPREFIX}/usr")
365 + $(use_enable cjk gd-jis-conv)
366 + $(use_with gd jpeg-dir "${EPREFIX}/usr")
367 + $(use_with gd png-dir "${EPREFIX}/usr")
368 + $(use_with xpm xpm-dir "${EPREFIX}/usr")
369 + )
370 + if use webp; then
371 + our_conf+=( --with-webp-dir="${EPREFIX}/usr" )
372 + fi
373 + # enable gd last, so configure can pick up the previous settings
374 + our_conf+=( $(use_with gd gd) )
375 +
376 + # IMAP support
377 + if use imap ; then
378 + our_conf+=(
379 + $(use_with imap imap "${EPREFIX}/usr")
380 + $(use_with ssl imap-ssl "${EPREFIX}/usr")
381 + )
382 + fi
383 +
384 + # Interbase/firebird support
385 + our_conf+=( $(use_with firebird interbase "${EPREFIX}/usr") )
386 +
387 + # LDAP support
388 + if use ldap ; then
389 + our_conf+=(
390 + $(use_with ldap ldap "${EPREFIX}/usr")
391 + $(use_with ldap-sasl ldap-sasl "${EPREFIX}/usr")
392 + )
393 + fi
394 +
395 + # MySQL support
396 + local mysqllib="mysqlnd"
397 + local mysqlilib="mysqlnd"
398 +
399 + our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") )
400 +
401 + local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock"
402 + if use mysql || use mysqli ; then
403 + our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") )
404 + fi
405 +
406 + # ODBC support
407 + our_conf+=(
408 + $(use_with odbc unixODBC "${EPREFIX}/usr")
409 + $(use_with iodbc iodbc "${EPREFIX}/usr")
410 + )
411 +
412 + # Oracle support
413 + our_conf+=( $(use_with oci8-instant-client oci8) )
414 +
415 + # PDO support
416 + if use pdo ; then
417 + our_conf+=(
418 + $(use_with mssql pdo-dblib "${EPREFIX}/usr")
419 + $(use_with mysql pdo-mysql "${mysqllib}")
420 + $(use_with postgres pdo-pgsql)
421 + $(use_with sqlite pdo-sqlite "${EPREFIX}/usr")
422 + $(use_with firebird pdo-firebird "${EPREFIX}/usr")
423 + $(use_with odbc pdo-odbc "unixODBC,${EPREFIX}/usr")
424 + $(use_with oci8-instant-client pdo-oci)
425 + )
426 + fi
427 +
428 + # readline/libedit support
429 + our_conf+=(
430 + $(use_with readline readline "${EPREFIX}/usr")
431 + $(use_with libedit libedit "${EPREFIX}/usr")
432 + )
433 +
434 + # Session support
435 + if use session ; then
436 + our_conf+=( $(use_with session-mm mm "${EPREFIX}/usr") )
437 + else
438 + our_conf+=( $(use_enable session session) )
439 + fi
440 +
441 + # Use pic for shared modules such as apache2's mod_php
442 + our_conf+=( --with-pic )
443 +
444 + # we use the system copy of pcre
445 + # --with-pcre-regex affects ext/pcre
446 + # --with-pcre-dir affects ext/filter and ext/zip
447 + our_conf+=(
448 + --with-pcre-regex="${EPREFIX}/usr"
449 + --with-pcre-dir="${EPREFIX}/usr"
450 + )
451 +
452 + # Catch CFLAGS problems
453 + # Fixes bug #14067.
454 + # Changed order to run it in reverse for bug #32022 and #12021.
455 + replace-cpu-flags "k6*" "i586"
456 +
457 + # Cache the ./configure test results between SAPIs.
458 + our_conf+=( --cache-file="${T}/config.cache" )
459 +
460 + # Support user-passed configuration parameters
461 + our_conf+=( ${EXTRA_ECONF:-} )
462 +
463 + # Support the Apache2 extras, they must be set globally for all
464 + # SAPIs to work correctly, especially for external PHP extensions
465 +
466 + mkdir -p "${WORKDIR}/sapis-build" || die
467 + for one_sapi in $SAPIS ; do
468 + use "${one_sapi}" || continue
469 + php_set_ini_dir "${one_sapi}"
470 +
471 + # The BUILD_DIR variable is used to determine where to output
472 + # the files that autotools creates. This was all originally
473 + # based on the autotools-utils eclass.
474 + BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}"
475 + cp -a "${S}" "${BUILD_DIR}" || die
476 + cd "${BUILD_DIR}" || die
477 +
478 + local sapi_conf=(
479 + --with-config-file-path="${PHP_INI_DIR}"
480 + --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}"
481 + )
482 +
483 + for sapi in $SAPIS ; do
484 + case "$sapi" in
485 + cli|cgi|embed|fpm|phpdbg)
486 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
487 + sapi_conf+=( "--enable-${sapi}" )
488 + if [[ "fpm" == "${sapi}" ]] ; then
489 + sapi_conf+=(
490 + $(use_with acl fpm-acl)
491 + $(use_with systemd fpm-systemd)
492 + )
493 + fi
494 + else
495 + sapi_conf+=( "--disable-${sapi}" )
496 + fi
497 + ;;
498 +
499 + apache2)
500 + if [[ "${one_sapi}" == "${sapi}" ]] ; then
501 + sapi_conf+=( --with-apxs2="${EPREFIX}/usr/bin/apxs" )
502 + else
503 + sapi_conf+=( --without-apxs2 )
504 + fi
505 + ;;
506 + esac
507 + done
508 +
509 + # Construct the $myeconfargs array by concatenating $our_conf
510 + # (the common args) and $sapi_conf (the SAPI-specific args).
511 + local myeconfargs=( "${our_conf[@]}" )
512 + myeconfargs+=( "${sapi_conf[@]}" )
513 +
514 + pushd "${BUILD_DIR}" > /dev/null || die
515 + econf "${myeconfargs[@]}"
516 + popd > /dev/null || die
517 + done
518 +}
519 +
520 +src_compile() {
521 + # snmp seems to run during src_compile, too (bug #324739)
522 + addpredict /usr/share/snmp/mibs/.index #nowarn
523 + addpredict /var/lib/net-snmp/mib_indexes #nowarn
524 +
525 + for sapi in ${SAPIS} ; do
526 + if use "${sapi}"; then
527 + cd "${WORKDIR}/sapis-build/$sapi" || \
528 + die "Failed to change dir to ${WORKDIR}/sapis-build/$1"
529 + emake
530 + fi
531 + done
532 +}
533 +
534 +src_install() {
535 + # see bug #324739 for what happens when we don't have that
536 + addpredict /usr/share/snmp/mibs/.index #nowarn
537 +
538 + # grab the first SAPI that got built and install common files from there
539 + local first_sapi=""
540 + for sapi in $SAPIS ; do
541 + if use $sapi ; then
542 + first_sapi=$sapi
543 + break
544 + fi
545 + done
546 +
547 + # Makefile forgets to create this before trying to write to it...
548 + dodir "${PHP_DESTDIR#${EPREFIX}}/bin"
549 +
550 + # Install php environment (without any sapis)
551 + cd "${WORKDIR}/sapis-build/$first_sapi" || die
552 + emake INSTALL_ROOT="${D}" \
553 + install-build install-headers install-programs
554 +
555 + local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)"
556 +
557 + # Create the directory where we'll put version-specific php scripts
558 + keepdir "/usr/share/php${PHP_MV}"
559 +
560 + local sapi="", file=""
561 + local sapi_list=""
562 +
563 + for sapi in ${SAPIS}; do
564 + if use "${sapi}" ; then
565 + einfo "Installing SAPI: ${sapi}"
566 + cd "${WORKDIR}/sapis-build/${sapi}" || die
567 +
568 + if [[ "${sapi}" == "apache2" ]] ; then
569 + # We're specifically not using emake install-sapi as libtool
570 + # may cause unnecessary relink failures (see bug #351266)
571 + insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/"
572 + newins ".libs/libphp${PHP_MV}$(get_libname)" \
573 + "libphp${PHP_MV}$(get_libname)"
574 + keepdir "/usr/$(get_libdir)/apache2/modules"
575 + else
576 + # needed each time, php_install_ini would reset it
577 + local dest="${PHP_DESTDIR#${EPREFIX}}"
578 + into "${dest}"
579 + case "$sapi" in
580 + cli)
581 + source="sapi/cli/php"
582 + ;;
583 + cgi)
584 + source="sapi/cgi/php-cgi"
585 + ;;
586 + fpm)
587 + source="sapi/fpm/php-fpm"
588 + ;;
589 + embed)
590 + source="libs/libphp${PHP_MV}$(get_libname)"
591 + ;;
592 + phpdbg)
593 + source="sapi/phpdbg/phpdbg"
594 + ;;
595 + *)
596 + die "unhandled sapi in src_install"
597 + ;;
598 + esac
599 +
600 + if [[ "${source}" == *"$(get_libname)" ]]; then
601 + dolib.so "${source}"
602 + else
603 + dobin "${source}"
604 + local name="$(basename ${source})"
605 + dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}"
606 + fi
607 + fi
608 +
609 + php_install_ini "${sapi}"
610 +
611 + # construct correct SAPI string for php-config
612 + # thanks to ferringb for the bash voodoo
613 + if [[ "${sapi}" == "apache2" ]]; then
614 + sapi_list="${sapi_list:+${sapi_list} }apache2handler"
615 + else
616 + sapi_list="${sapi_list:+${sapi_list} }${sapi}"
617 + fi
618 + fi
619 + done
620 +
621 + # Installing opcache module
622 + if use opcache ; then
623 + into "${PHP_DESTDIR#${EPREFIX}}"
624 + dolib.so "modules/opcache$(get_libname)"
625 + fi
626 +
627 + # Install env.d files
628 + newenvd "${FILESDIR}/20php5-envd" "20php${SLOT}"
629 + sed -e "s|/lib/|/$(get_libdir)/|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
630 + sed -e "s|php5|php${SLOT}|g" -i "${ED}/etc/env.d/20php${SLOT}" || die
631 +
632 + # set php-config variable correctly (bug #278439)
633 + sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \
634 + "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config" || die
635 +
636 + if use fpm ; then
637 + if use systemd; then
638 + systemd_newunit "${FILESDIR}/php-fpm_at.service" \
639 + "php-fpm@${SLOT}.service"
640 + else
641 + systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" \
642 + "php-fpm@${SLOT}.service"
643 + fi
644 + fi
645 +}
646 +
647 +src_test() {
648 + echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
649 + PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php"
650 + if [[ ! -x "${PHP_BIN}" ]] ; then
651 + ewarn "Test phase requires USE=cli, skipping"
652 + return
653 + else
654 + export TEST_PHP_EXECUTABLE="${PHP_BIN}"
655 + fi
656 +
657 + if [[ -x "${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi" ]] ; then
658 + export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi"
659 + fi
660 +
661 + if [[ -x "${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg" ]] ; then
662 + export TEST_PHPDBG_EXECUTABLE="${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg"
663 + fi
664 +
665 + REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d \
666 + "session.save_path=${T}" \
667 + "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d \
668 + "session.save_path=${T}"
669 +
670 + for name in ${EXPECTED_TEST_FAILURES}; do
671 + mv "${name}.out" "${name}.out.orig" 2>/dev/null || die
672 + done
673 +
674 + local failed="$(find -name '*.out')"
675 + if [[ ${failed} != "" ]] ; then
676 + ewarn "The following test cases failed unexpectedly:"
677 + for name in ${failed}; do
678 + ewarn " ${name/.out/}"
679 + done
680 + else
681 + einfo "No unexpected test failures, all fine"
682 + fi
683 +
684 + if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then
685 + local passed=""
686 + for name in ${EXPECTED_TEST_FAILURES}; do
687 + [[ -f "${name}.diff" ]] && continue
688 + passed="${passed} ${name}"
689 + done
690 + if [[ ${passed} != "" ]] ; then
691 + einfo "The following test cases passed unexpectedly:"
692 + for name in ${passed}; do
693 + ewarn " ${passed}"
694 + done
695 + else
696 + einfo "None of the known-to-fail tests passed, all fine"
697 + fi
698 + fi
699 +}
700 +
701 +pkg_postinst() {
702 + # Output some general info to the user
703 + if use apache2 ; then
704 + elog
705 + elog "To enable PHP in apache, you will need to add \"-D PHP\" to"
706 + elog "your apache2 command. OpenRC users can append that string to"
707 + elog "APACHE2_OPTS in /etc/conf.d/apache2."
708 + elog
709 + elog "The apache module configuration file 70_mod_php.conf is"
710 + elog "provided (and maintained) by eselect-php."
711 + elog
712 + fi
713 +
714 + # Create the symlinks for php
715 + for m in ${SAPIS}; do
716 + [[ ${m} == 'embed' ]] && continue;
717 + if use $m ; then
718 + local ci=$(eselect php show $m)
719 + if [[ -z $ci ]]; then
720 + eselect php set $m php${SLOT} || die
721 + einfo "Switched ${m} to use php:${SLOT}"
722 + einfo
723 + elif [[ $ci != "php${SLOT}" ]] ; then
724 + elog "To switch $m to use php:${SLOT}, run"
725 + elog " eselect php set $m php${SLOT}"
726 + elog
727 + fi
728 + fi
729 + done
730 +
731 + # Remove dead symlinks for SAPIs that were just disabled. For
732 + # example, if the user has the cgi SAPI enabled, then he has an
733 + # eselect-php symlink for it. If he later reinstalls PHP with
734 + # USE="-cgi", that symlink will break. This call to eselect is
735 + # supposed to remove that dead link per bug 572436.
736 + eselect php cleanup || die
737 +
738 + if ! has "php${SLOT/./-}" ${PHP_TARGETS}; then
739 + elog "To build extensions for this version of PHP, you will need to"
740 + elog "add php${SLOT/./-} to your PHP_TARGETS USE_EXPAND variable."
741 + elog
742 + fi
743 +
744 + # Warn about the removal of PHP_INI_VERSION if the user has it set.
745 + if [[ -n "${PHP_INI_VERSION}" ]]; then
746 + ewarn 'The PHP_INI_VERSION variable has been phased out. You may'
747 + ewarn 'remove it from your configuration at your convenience. See'
748 + ewarn
749 + ewarn ' https://bugs.gentoo.org/611214'
750 + ewarn
751 + ewarn 'for more information.'
752 + fi
753 +
754 + elog "For details on how version slotting works, please see"
755 + elog "the wiki:"
756 + elog
757 + elog " https://wiki.gentoo.org/wiki/PHP"
758 + elog
759 +}
760 +
761 +pkg_postrm() {
762 + # This serves two purposes. First, if we have just removed the last
763 + # installed version of PHP, then this will remove any dead symlinks
764 + # belonging to eselect-php. Second, if a user upgrades slots from
765 + # (say) 5.6 to 7.0 and depcleans the old slot, then this will update
766 + # his existing symlinks to point to the new 7.0 installation. The
767 + # latter is bug 432962.
768 + #
769 + # Note: the eselect-php package may not be installed at this point,
770 + # so we can't die() if this command fails.
771 + eselect php cleanup
772 +}