Gentoo Archives: gentoo-commits

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