1 |
commit: 95c0ba4995b7c9d11f5525da518fa082def059c9 |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 6 18:25:45 2019 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 6 18:26:00 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=95c0ba49 |
7 |
|
8 |
dev-lang/php: bump to v7.3.2 |
9 |
|
10 |
- Fix iptcembed [bug 77546] |
11 |
|
12 |
Bug: https://bugs.php.net/bug.php?id=77546 |
13 |
Package-Manager: Portage-2.3.59, Repoman-2.3.12 |
14 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
15 |
|
16 |
dev-lang/php/Manifest | 1 + |
17 |
.../files/php-7.3.2-fix-iptcembed-bug77546.patch | 127 ++++ |
18 |
dev-lang/php/php-7.3.2.ebuild | 749 +++++++++++++++++++++ |
19 |
3 files changed, 877 insertions(+) |
20 |
|
21 |
diff --git a/dev-lang/php/Manifest b/dev-lang/php/Manifest |
22 |
index 0197e3ec413..892bc832a35 100644 |
23 |
--- a/dev-lang/php/Manifest |
24 |
+++ b/dev-lang/php/Manifest |
25 |
@@ -5,3 +5,4 @@ DIST php-7.0.33.tar.xz 12033040 BLAKE2B cb7a4eb3ba8ede93ae8e85b6a11664f33654f7e9 |
26 |
DIST php-7.1.26.tar.xz 12206956 BLAKE2B af78f764349a05905d7db22260c8a6415a2755b29e0dd01225160235b3b38ea76c8910d79c69798aa2de3fc6d4d41e45ab951161b54e62753111f81ac9d85bc2 SHA512 3c80dce2d5dcbf6f253ca4ca4e4ce01fdd3a3d31a6e6045f539fefadc1ea3c391d4d4995600a4ff758ab0361e0ec2244e2eaa6591ecb3e9b8e8a9c44f67a5b32 |
27 |
DIST php-7.2.14.tar.xz 12156460 BLAKE2B 88727241ca3fd68238ce50dcb4c12868f8e6df54213b04dba7650c5f98c3f18a3d02e0a191c0ebd13d85c83cc686fef60135f69ca7cc3e425bd5d7f80035fdd7 SHA512 13f2c97b730e3e872bd24bcc004c6cff5e2cc633c37a4eb60b8b5d1d4454bc5985f7d52943448d61cf4a227c64be770edc5eadd2c9612b297d71c0840b4b1259 |
28 |
DIST php-7.3.1.tar.xz 11944376 BLAKE2B 55b3192774c08b1e4c6621e16176a1e352ff6ba5540794a5d769b6416929723638f1409f2f8224c7fe3db99c9b020fa51db7b78d50eaa00e790308562a0a5334 SHA512 0663d90537fe3901cad00ba1056782050b8a61e8edb49f01851add4992df21d23aee3e9468e32b76b7f53ffd513f1ba10c9513c549e247d796416ed176355348 |
29 |
+DIST php-7.3.2.tar.xz 11966760 BLAKE2B bb913e754e86ebbbef641d0516eb1fff7dfd7d7fe54776d4de0312175cdbc292694addd60e8ad863726796d482517e9312d83754eb70201de1a8a21e892cd87e SHA512 e49eaf1f0811098910beddc407d5047e09a0f528baf4b62f2a42e8faba9d3d7a0ae82a0fd7a5bec265e22ef1bcf0cdcc4e9f0a521258412405923800798cba66 |
30 |
|
31 |
diff --git a/dev-lang/php/files/php-7.3.2-fix-iptcembed-bug77546.patch b/dev-lang/php/files/php-7.3.2-fix-iptcembed-bug77546.patch |
32 |
new file mode 100644 |
33 |
index 00000000000..e157d250f2f |
34 |
--- /dev/null |
35 |
+++ b/dev-lang/php/files/php-7.3.2-fix-iptcembed-bug77546.patch |
36 |
@@ -0,0 +1,127 @@ |
37 |
+https://git.php.net/?p=php-src.git;a=commit;h=f27f9022660d28c13c6209f4679768dcbd961b43 |
38 |
+ |
39 |
+--- a/ext/standard/iptc.c |
40 |
++++ b/ext/standard/iptc.c |
41 |
+@@ -273,7 +273,7 @@ PHP_FUNCTION(iptcembed) |
42 |
+ iptcdata_len++; /* make the length even */ |
43 |
+ } |
44 |
+ |
45 |
+- psheader[ 2 ] = (char) (iptcdata_len+28)>>8; |
46 |
++ psheader[ 2 ] = (char) ((iptcdata_len+28)>>8); |
47 |
+ psheader[ 3 ] = (iptcdata_len+28)&0xff; |
48 |
+ |
49 |
+ for (inx = 0; inx < 28; inx++) { |
50 |
+--- /dev/null |
51 |
++++ b/ext/standard/tests/image/iptcembed_002.phpt |
52 |
+@@ -0,0 +1,110 @@ |
53 |
++--TEST-- |
54 |
++iptcembed() valid jpg stream |
55 |
++--FILE-- |
56 |
++<?php |
57 |
++/* |
58 |
++# source code to generate base64 use behind as $base64_1x1_jpeg |
59 |
++# we don't want to be gd library dependant for this test |
60 |
++$file="1x1.jpg"; |
61 |
++$ret=imagejpeg(imagecreatetruecolor(1, 1), $file, 100); |
62 |
++echo md5(file_get_contents($file)).PHP_EOL; |
63 |
++echo base64_encode(file_get_contents($file)).PHP_EOL; |
64 |
++unlink($file); |
65 |
++*/ |
66 |
++ |
67 |
++/* |
68 |
++test description : |
69 |
++1) create local file 1x1 jpeg (without iptc) (use base64 content to create file) |
70 |
++2) generate iptcdata string with function iptc_make_tag describe behind |
71 |
++3) use iptcembed php function with our 1x1 jpeg file and our iptcdata string |
72 |
++4) write local file2 with iptcembed return content |
73 |
++5) various check on file2 to verify that's a valid jpeg file with our tags |
74 |
++*/ |
75 |
++ |
76 |
++ |
77 |
++#iptc_make_tag function from http://php.net/iptcembed |
78 |
++function iptc_make_tag($rec, $data, $value) |
79 |
++ { |
80 |
++ $length = strlen($value); |
81 |
++ $retval = chr(0x1C) . chr($rec) . chr($data); |
82 |
++ if($length < 0x8000) { $retval .= chr($length >> 8) . chr($length & 0xFF); } |
83 |
++ else { $retval .= chr(0x80) . chr(0x04) . chr(($length >> 24) & 0xFF) . chr(($length >> 16) & 0xFF) . chr(($length >> 8) & 0xFF) . chr($length & 0xFF); } |
84 |
++ return $retval . $value; |
85 |
++ } |
86 |
++ |
87 |
++ |
88 |
++$file="1x1.jpg"; |
89 |
++$file2="1x1_with_iptc_tags.jpg"; |
90 |
++$base64_1x1_jpeg="/9j/4AAQSkZJRgABAQEAYABgAAD//gA8Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcgSlBFRyB2ODApLCBxdWFsaXR5ID0gMTAwCv/bAEMAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/bAEMBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAQMBEQACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/AP8AP/oA/9k="; |
91 |
++#write file |
92 |
++$fd=fopen($file,"wb"); |
93 |
++if ($fd) { fputs($fd,base64_decode($base64_1x1_jpeg)); fclose($fd); } |
94 |
++else { echo "error cant write $file".PHP_EOL;exit(1); } |
95 |
++#check file md5 |
96 |
++$md5=md5_file($file); |
97 |
++if ($md5!="07dd8594450e8c18ab8a79d7cb4573c7") { echo "md5 error".PHP_EOL;exit(1); } |
98 |
++#check jpeg properties |
99 |
++list($width, $height, $type, $attr) = getimagesize($file,$info); |
100 |
++if ($width!=1) { echo "width error".PHP_EOL;exit(1); } |
101 |
++if ($height!=1) { echo "height error".PHP_EOL;exit(1); } |
102 |
++if ($type!=2) { echo "type error".PHP_EOL;exit(1); } |
103 |
++if (!isset($info["APP0"])) { echo "APP0 error".PHP_EOL;exit(1); } |
104 |
++ |
105 |
++#our iptc tags |
106 |
++$tags=array(); |
107 |
++$tags["2#105"]= "Tauren"; |
108 |
++$tags["2#120"]= "Tauren with Trunk"; |
109 |
++$tags["2#110"]= "Copyright 2004-2016, Blizzard"; |
110 |
++$tags["2#025"]= "Tauren, Chaman, Blizzard"; |
111 |
++$tags["2#090"]= "Thunder Bluffs"; |
112 |
++#feed iptc string for iptcembed |
113 |
++$iptc=''; |
114 |
++foreach ($tags as $tag => $string) { $rec=$tag[0]; $tag = substr($tag, 2); $iptc .= iptc_make_tag($rec, $tag, $string); } |
115 |
++#check iptc string md5 |
116 |
++if (md5(base64_encode($iptc))!="7056c4b3060f92a4f9e5b7d0caa61859") { echo "iptc md5 error".PHP_EOL;exit(1); } |
117 |
++ |
118 |
++#use iptcembed to get jpeg stream content with iptc tags |
119 |
++$content = iptcembed($iptc, $file,0); |
120 |
++ |
121 |
++#write new image with iptc tags |
122 |
++if ($content === false) {echo "iptcembed error".PHP_EOL;exit(1); } |
123 |
++$fd=fopen($file2,"wb"); |
124 |
++if ($fd) { fputs($fd,$content); fclose($fd); } |
125 |
++else { echo "error cant write $file2".PHP_EOL;exit(1); } |
126 |
++ |
127 |
++ |
128 |
++#check jpeg properties for new image with iptc tags |
129 |
++echo "new generated image with itpc tags : $file2".PHP_EOL; |
130 |
++$ret = getimagesize($file2,$info); |
131 |
++if ($ret===false) { echo "getimagesize error".PHP_EOL;exit(1); } |
132 |
++list($width, $height, $type, $attr) = $ret; |
133 |
++if ($width!=1) { echo "width error".PHP_EOL;exit(1); } |
134 |
++if ($height!=1) { echo "height error".PHP_EOL;exit(1); } |
135 |
++if ($type!=2) { echo "type error".PHP_EOL;exit(1); } |
136 |
++if (!isset($info["APP0"])) { echo "APP0 error".PHP_EOL;exit(1); } |
137 |
++if (!isset($info["APP13"])) { echo "APP13 error".PHP_EOL;exit(1); } |
138 |
++ |
139 |
++$error=0; |
140 |
++$iptc_data_from_created_image = iptcparse($info['APP13']); |
141 |
++foreach ($tags as $tag => $string) { |
142 |
++ #check if tag exists |
143 |
++ if (!isset($iptc_data_from_created_image[$tag])) { |
144 |
++ echo "error iptc tag $tag not found".PHP_EOL; |
145 |
++ $error++; |
146 |
++ } else { |
147 |
++ #check value |
148 |
++ if ($iptc_data_from_created_image[$tag][0]!=$string) { |
149 |
++ echo "error tag $tag : bad value ($string != ".$iptc_data_from_created_image[$tag][0].")".PHP_EOL; |
150 |
++ $error++; |
151 |
++ } |
152 |
++ } |
153 |
++} |
154 |
++#clean before exit |
155 |
++@unlink($file); |
156 |
++@unlink($file2); |
157 |
++if ($error==0) { echo "OK".PHP_EOL;exit(0);} |
158 |
++echo "something wrong: $error errors".PHP_EOL; |
159 |
++?> |
160 |
++--EXPECT-- |
161 |
++new generated image with itpc tags : 1x1_with_iptc_tags.jpg |
162 |
++OK |
163 |
+-- |
164 |
|
165 |
diff --git a/dev-lang/php/php-7.3.2.ebuild b/dev-lang/php/php-7.3.2.ebuild |
166 |
new file mode 100644 |
167 |
index 00000000000..1b24d9164c0 |
168 |
--- /dev/null |
169 |
+++ b/dev-lang/php/php-7.3.2.ebuild |
170 |
@@ -0,0 +1,749 @@ |
171 |
+# Copyright 1999-2019 Gentoo Authors |
172 |
+# Distributed under the terms of the GNU General Public License v2 |
173 |
+ |
174 |
+EAPI=6 |
175 |
+ |
176 |
+inherit flag-o-matic eapi7-ver systemd autotools |
177 |
+ |
178 |
+MY_PV=${PV/_rc/RC} |
179 |
+DESCRIPTION="The PHP language runtime engine" |
180 |
+HOMEPAGE="https://secure.php.net/" |
181 |
+SRC_URI="https://secure.php.net/distributions/${P}.tar.xz" |
182 |
+ |
183 |
+LICENSE="PHP-3.01 |
184 |
+ BSD |
185 |
+ Zend-2.0 |
186 |
+ bcmath? ( LGPL-2.1+ ) |
187 |
+ fpm? ( BSD-2 ) |
188 |
+ gd? ( gd ) |
189 |
+ unicode? ( BSD-2 LGPL-2.1 )" |
190 |
+ |
191 |
+SLOT="$(ver_cut 1-2)" |
192 |
+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" |
193 |
+ |
194 |
+S="${WORKDIR}/${PN}-${MY_PV}" |
195 |
+ |
196 |
+# We can build the following SAPIs in the given order |
197 |
+SAPIS="embed cli cgi fpm apache2 phpdbg" |
198 |
+ |
199 |
+# SAPIs and SAPI-specific USE flags (cli SAPI is default on): |
200 |
+IUSE="${IUSE} |
201 |
+ ${SAPIS/cli/+cli} |
202 |
+ threads" |
203 |
+ |
204 |
+IUSE="${IUSE} acl argon2 bcmath berkdb bzip2 calendar cdb cjk |
205 |
+ coverage +ctype curl debug |
206 |
+ enchant exif +fileinfo +filter firebird |
207 |
+ flatfile ftp gd gdbm gmp +hash +iconv imap inifile |
208 |
+ intl iodbc ipv6 +json kerberos ldap ldap-sasl libedit libressl lmdb |
209 |
+ mhash mssql mysql mysqli nls |
210 |
+ oci8-instant-client odbc +opcache pcntl pdo +phar +posix postgres qdbm |
211 |
+ readline recode selinux +session session-mm sharedmem |
212 |
+ +simplexml snmp soap sockets sodium spell sqlite ssl |
213 |
+ sysvipc systemd test tidy +tokenizer tokyocabinet truetype unicode wddx webp |
214 |
+ +xml xmlreader xmlwriter xmlrpc xpm xslt zip zip-encryption zlib" |
215 |
+ |
216 |
+# The supported (that is, autodetected) versions of BDB are listed in |
217 |
+# the ./configure script. Other versions *work*, but we need to stick to |
218 |
+# the ones that can be detected to avoid a repeat of bug #564824. |
219 |
+COMMON_DEPEND=" |
220 |
+ >=app-eselect/eselect-php-0.9.1[apache2?,fpm?] |
221 |
+ >=dev-libs/libpcre2-10.30[unicode] |
222 |
+ fpm? ( acl? ( sys-apps/acl ) ) |
223 |
+ apache2? ( || ( >=www-servers/apache-2.4[apache2_modules_unixd,threads=] |
224 |
+ <www-servers/apache-2.4[threads=] ) ) |
225 |
+ argon2? ( app-crypt/argon2:= ) |
226 |
+ berkdb? ( || ( sys-libs/db:5.3 |
227 |
+ sys-libs/db:5.1 |
228 |
+ sys-libs/db:4.8 |
229 |
+ sys-libs/db:4.7 |
230 |
+ sys-libs/db:4.6 |
231 |
+ sys-libs/db:4.5 ) ) |
232 |
+ bzip2? ( app-arch/bzip2:0= ) |
233 |
+ cdb? ( || ( dev-db/cdb dev-db/tinycdb ) ) |
234 |
+ coverage? ( dev-util/lcov ) |
235 |
+ curl? ( >=net-misc/curl-7.10.5 ) |
236 |
+ enchant? ( <app-text/enchant-2.0:0 ) |
237 |
+ firebird? ( dev-db/firebird ) |
238 |
+ gd? ( virtual/jpeg:0 media-libs/libpng:0= >=sys-libs/zlib-1.2.0.4 ) |
239 |
+ gdbm? ( >=sys-libs/gdbm-1.8.0:0= ) |
240 |
+ gmp? ( dev-libs/gmp:0= ) |
241 |
+ iconv? ( virtual/libiconv ) |
242 |
+ imap? ( virtual/imap-c-client[kerberos=,ssl=] ) |
243 |
+ intl? ( dev-libs/icu:= ) |
244 |
+ iodbc? ( dev-db/libiodbc ) |
245 |
+ kerberos? ( virtual/krb5 ) |
246 |
+ ldap? ( >=net-nds/openldap-1.2.11 ) |
247 |
+ ldap-sasl? ( dev-libs/cyrus-sasl >=net-nds/openldap-1.2.11 ) |
248 |
+ libedit? ( || ( sys-freebsd/freebsd-lib dev-libs/libedit ) ) |
249 |
+ lmdb? ( dev-db/lmdb:= ) |
250 |
+ mssql? ( dev-db/freetds[mssql] ) |
251 |
+ nls? ( sys-devel/gettext ) |
252 |
+ oci8-instant-client? ( dev-db/oracle-instantclient-basic ) |
253 |
+ odbc? ( >=dev-db/unixODBC-1.8.13 ) |
254 |
+ postgres? ( dev-db/postgresql:* ) |
255 |
+ qdbm? ( dev-db/qdbm ) |
256 |
+ readline? ( sys-libs/readline:0= ) |
257 |
+ recode? ( app-text/recode ) |
258 |
+ session-mm? ( dev-libs/mm ) |
259 |
+ simplexml? ( >=dev-libs/libxml2-2.6.8 ) |
260 |
+ snmp? ( >=net-analyzer/net-snmp-5.2 ) |
261 |
+ soap? ( >=dev-libs/libxml2-2.6.8 ) |
262 |
+ sodium? ( dev-libs/libsodium:= ) |
263 |
+ spell? ( >=app-text/aspell-0.50 ) |
264 |
+ sqlite? ( >=dev-db/sqlite-3.7.6.3 ) |
265 |
+ ssl? ( |
266 |
+ !libressl? ( >=dev-libs/openssl-1.0.1:0= ) |
267 |
+ libressl? ( dev-libs/libressl:0= ) |
268 |
+ ) |
269 |
+ tidy? ( || ( app-text/tidy-html5 app-text/htmltidy ) ) |
270 |
+ tokyocabinet? ( dev-db/tokyocabinet ) |
271 |
+ truetype? ( =media-libs/freetype-2* ) |
272 |
+ unicode? ( dev-libs/oniguruma:= ) |
273 |
+ wddx? ( >=dev-libs/libxml2-2.6.8 ) |
274 |
+ webp? ( media-libs/libwebp:0= ) |
275 |
+ xml? ( >=dev-libs/libxml2-2.6.8 ) |
276 |
+ xmlrpc? ( >=dev-libs/libxml2-2.6.8 virtual/libiconv ) |
277 |
+ xmlreader? ( >=dev-libs/libxml2-2.6.8 ) |
278 |
+ xmlwriter? ( >=dev-libs/libxml2-2.6.8 ) |
279 |
+ xpm? ( x11-libs/libXpm ) |
280 |
+ xslt? ( dev-libs/libxslt >=dev-libs/libxml2-2.6.8 ) |
281 |
+ zip? ( >=sys-libs/zlib-1.2.0.4:0= ) |
282 |
+ zip-encryption? ( >=dev-libs/libzip-1.2.0:= ) |
283 |
+ zlib? ( >=sys-libs/zlib-1.2.0.4:0= ) |
284 |
+" |
285 |
+ |
286 |
+RDEPEND="${COMMON_DEPEND} |
287 |
+ virtual/mta |
288 |
+ fpm? ( |
289 |
+ selinux? ( sec-policy/selinux-phpfpm ) |
290 |
+ systemd? ( sys-apps/systemd ) )" |
291 |
+ |
292 |
+# Bison isn't actually needed when building from a release tarball |
293 |
+# However, the configure script will warn if it's absent or if you |
294 |
+# have an incompatible version installed. See bug 593278. |
295 |
+DEPEND="${COMMON_DEPEND} |
296 |
+ app-arch/xz-utils |
297 |
+ >=sys-devel/bison-3.0.1" |
298 |
+ |
299 |
+# Without USE=readline or libedit, the interactive "php -a" CLI will hang. |
300 |
+REQUIRED_USE=" |
301 |
+ || ( cli cgi fpm apache2 embed phpdbg ) |
302 |
+ cli? ( ^^ ( readline libedit ) ) |
303 |
+ truetype? ( gd zlib ) |
304 |
+ webp? ( gd zlib ) |
305 |
+ cjk? ( gd zlib ) |
306 |
+ exif? ( gd zlib ) |
307 |
+ xpm? ( gd zlib ) |
308 |
+ gd? ( zlib ) |
309 |
+ simplexml? ( xml ) |
310 |
+ soap? ( xml ) |
311 |
+ wddx? ( xml ) |
312 |
+ xmlrpc? ( || ( xml iconv ) ) |
313 |
+ xmlreader? ( xml ) |
314 |
+ xslt? ( xml ) |
315 |
+ ldap-sasl? ( ldap ) |
316 |
+ mhash? ( hash ) |
317 |
+ phar? ( hash ) |
318 |
+ qdbm? ( !gdbm ) |
319 |
+ readline? ( !libedit ) |
320 |
+ recode? ( !imap !mysqli !mysql ) |
321 |
+ session-mm? ( session !threads ) |
322 |
+ mysql? ( || ( mysqli pdo ) ) |
323 |
+ zip-encryption? ( zip ) |
324 |
+" |
325 |
+PATCHES=( |
326 |
+ "${FILESDIR}/php-freetype-2.9.1.patch" |
327 |
+ "${FILESDIR}/php-7.3.2-fix-iptcembed-bug77546.patch" |
328 |
+) |
329 |
+ |
330 |
+PHP_MV="$(ver_cut 1)" |
331 |
+ |
332 |
+php_install_ini() { |
333 |
+ local phpsapi="${1}" |
334 |
+ |
335 |
+ # work out where we are installing the ini file |
336 |
+ php_set_ini_dir "${phpsapi}" |
337 |
+ |
338 |
+ # Always install the production INI file, bug 611214. |
339 |
+ local phpinisrc="php.ini-production-${phpsapi}" |
340 |
+ cp php.ini-production "${phpinisrc}" || die |
341 |
+ |
342 |
+ # default to /tmp for save_path, bug #282768 |
343 |
+ sed -e 's|^;session.save_path .*$|session.save_path = "'"${EPREFIX}"'/tmp"|g' -i "${phpinisrc}" || die |
344 |
+ |
345 |
+ # Set the extension dir |
346 |
+ sed -e "s|^extension_dir .*$|extension_dir = ${extension_dir}|g" \ |
347 |
+ -i "${phpinisrc}" || die |
348 |
+ |
349 |
+ # Set the include path to point to where we want to find PEAR packages |
350 |
+ sed -e 's|^;include_path = ".:/php/includes".*|include_path = ".:'"${EPREFIX}"'/usr/share/php'${PHP_MV}':'"${EPREFIX}"'/usr/share/php"|' -i "${phpinisrc}" || die |
351 |
+ |
352 |
+ dodir "${PHP_INI_DIR#${EPREFIX}}" |
353 |
+ insinto "${PHP_INI_DIR#${EPREFIX}}" |
354 |
+ newins "${phpinisrc}" php.ini |
355 |
+ |
356 |
+ elog "Installing php.ini for ${phpsapi} into ${PHP_INI_DIR#${EPREFIX}}" |
357 |
+ elog |
358 |
+ |
359 |
+ dodir "${PHP_EXT_INI_DIR#${EPREFIX}}" |
360 |
+ dodir "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}" |
361 |
+ |
362 |
+ if use opcache; then |
363 |
+ elog "Adding opcache to $PHP_EXT_INI_DIR" |
364 |
+ echo "zend_extension=${PHP_DESTDIR}/$(get_libdir)/opcache.so" >> \ |
365 |
+ "${D}/${PHP_EXT_INI_DIR}"/opcache.ini |
366 |
+ dosym "${PHP_EXT_INI_DIR#${EPREFIX}}/opcache.ini" \ |
367 |
+ "${PHP_EXT_INI_DIR_ACTIVE#${EPREFIX}}/opcache.ini" |
368 |
+ fi |
369 |
+ |
370 |
+ # SAPI-specific handling |
371 |
+ if [[ "${sapi}" == "fpm" ]] ; then |
372 |
+ einfo "Installing FPM config files php-fpm.conf and www.conf" |
373 |
+ insinto "${PHP_INI_DIR#${EPREFIX}}" |
374 |
+ doins sapi/fpm/php-fpm.conf |
375 |
+ insinto "${PHP_INI_DIR#${EPREFIX}}/fpm.d" |
376 |
+ doins sapi/fpm/www.conf |
377 |
+ fi |
378 |
+ |
379 |
+ dodoc php.ini-{development,production} |
380 |
+} |
381 |
+ |
382 |
+php_set_ini_dir() { |
383 |
+ PHP_INI_DIR="${EPREFIX}/etc/php/${1}-php${SLOT}" |
384 |
+ PHP_EXT_INI_DIR="${PHP_INI_DIR}/ext" |
385 |
+ PHP_EXT_INI_DIR_ACTIVE="${PHP_INI_DIR}/ext-active" |
386 |
+} |
387 |
+ |
388 |
+src_prepare() { |
389 |
+ default |
390 |
+ |
391 |
+ # In php-7.x, the FPM pool configuration files have been split off |
392 |
+ # of the main config. By default the pool config files go in |
393 |
+ # e.g. /etc/php-fpm.d, which isn't slotted. So here we move the |
394 |
+ # include directory to a subdirectory "fpm.d" of $PHP_INI_DIR. Later |
395 |
+ # we'll install the pool configuration file "www.conf" there. |
396 |
+ php_set_ini_dir fpm |
397 |
+ sed -i "s~^include=.*$~include=${PHP_INI_DIR}/fpm.d/*.conf~" \ |
398 |
+ sapi/fpm/php-fpm.conf.in \ |
399 |
+ || die 'failed to move the include directory in php-fpm.conf' |
400 |
+ |
401 |
+ # Bug 669566 - necessary so that build tools are updated for commands like pecl |
402 |
+ # Force rebuilding aclocal.m4 |
403 |
+ rm -f aclocal.m4 || die "failed to remove aclocal.m4 in src_prepare" |
404 |
+ eautoreconf |
405 |
+} |
406 |
+ |
407 |
+src_configure() { |
408 |
+ addpredict /usr/share/snmp/mibs/.index #nowarn |
409 |
+ addpredict /var/lib/net-snmp/mib_indexes #nowarn |
410 |
+ |
411 |
+ PHP_DESTDIR="${EPREFIX}/usr/$(get_libdir)/php${SLOT}" |
412 |
+ |
413 |
+ # The php-fpm config file wants localstatedir to be ${EPREFIX}/var |
414 |
+ # and not the Gentoo default ${EPREFIX}/var/lib. See bug 572002. |
415 |
+ local our_conf=( |
416 |
+ --prefix="${PHP_DESTDIR}" |
417 |
+ --mandir="${PHP_DESTDIR}/man" |
418 |
+ --infodir="${PHP_DESTDIR}/info" |
419 |
+ --libdir="${PHP_DESTDIR}/lib" |
420 |
+ --with-libdir="$(get_libdir)" |
421 |
+ --localstatedir="${EPREFIX}/var" |
422 |
+ --without-pear |
423 |
+ $(use_enable threads maintainer-zts) |
424 |
+ ) |
425 |
+ |
426 |
+ our_conf+=( |
427 |
+ $(use_with argon2 password-argon2 "${EPREFIX}/usr") |
428 |
+ $(use_enable bcmath bcmath) |
429 |
+ $(use_with bzip2 bz2 "${EPREFIX}/usr") |
430 |
+ $(use_enable calendar calendar) |
431 |
+ $(use_enable coverage gcov) |
432 |
+ $(use_enable ctype ctype) |
433 |
+ $(use_with curl curl "${EPREFIX}/usr") |
434 |
+ $(use_enable xml dom) |
435 |
+ $(use_with enchant enchant "${EPREFIX}/usr") |
436 |
+ $(use_enable exif exif) |
437 |
+ $(use_enable fileinfo fileinfo) |
438 |
+ $(use_enable filter filter) |
439 |
+ $(use_enable ftp ftp) |
440 |
+ $(use_with nls gettext "${EPREFIX}/usr") |
441 |
+ $(use_with gmp gmp "${EPREFIX}/usr") |
442 |
+ $(use_enable hash hash) |
443 |
+ $(use_with mhash mhash "${EPREFIX}/usr") |
444 |
+ $(use_with iconv iconv \ |
445 |
+ $(use elibc_glibc || use elibc_musl || use elibc_FreeBSD || echo "${EPREFIX}/usr")) |
446 |
+ $(use_enable intl intl) |
447 |
+ $(use_enable ipv6 ipv6) |
448 |
+ $(use_enable json json) |
449 |
+ $(use_with kerberos kerberos "${EPREFIX}/usr") |
450 |
+ $(use_enable xml libxml) |
451 |
+ $(use_with xml libxml-dir "${EPREFIX}/usr") |
452 |
+ $(use_enable unicode mbstring) |
453 |
+ $(use_with unicode onig "${EPREFIX}/usr") |
454 |
+ $(use_with ssl openssl "${EPREFIX}/usr") |
455 |
+ $(use_with ssl openssl-dir "${EPREFIX}/usr") |
456 |
+ $(use_enable pcntl pcntl) |
457 |
+ $(use_enable phar phar) |
458 |
+ $(use_enable pdo pdo) |
459 |
+ $(use_enable opcache opcache) |
460 |
+ $(use_with postgres pgsql "${EPREFIX}/usr") |
461 |
+ $(use_enable posix posix) |
462 |
+ $(use_with spell pspell "${EPREFIX}/usr") |
463 |
+ $(use_with recode recode "${EPREFIX}/usr") |
464 |
+ $(use_enable simplexml simplexml) |
465 |
+ $(use_enable sharedmem shmop) |
466 |
+ $(use_with snmp snmp "${EPREFIX}/usr") |
467 |
+ $(use_enable soap soap) |
468 |
+ $(use_enable sockets sockets) |
469 |
+ $(use_with sodium sodium "${EPREFIX}/usr") |
470 |
+ $(use_with sqlite sqlite3 "${EPREFIX}/usr") |
471 |
+ $(use_enable sysvipc sysvmsg) |
472 |
+ $(use_enable sysvipc sysvsem) |
473 |
+ $(use_enable sysvipc sysvshm) |
474 |
+ $(use_with tidy tidy "${EPREFIX}/usr") |
475 |
+ $(use_enable tokenizer tokenizer) |
476 |
+ $(use_enable wddx wddx) |
477 |
+ $(use_enable xml xml) |
478 |
+ $(use_enable xmlreader xmlreader) |
479 |
+ $(use_enable xmlwriter xmlwriter) |
480 |
+ $(use_with xmlrpc xmlrpc) |
481 |
+ $(use_with xslt xsl "${EPREFIX}/usr") |
482 |
+ $(use_enable zip zip) |
483 |
+ $(use_with zip-encryption libzip "${EPREFIX}/usr") |
484 |
+ $(use_with zlib zlib "${EPREFIX}/usr") |
485 |
+ $(use_enable debug debug) |
486 |
+ ) |
487 |
+ |
488 |
+ # DBA support |
489 |
+ if use cdb || use berkdb || use flatfile || use gdbm || use inifile \ |
490 |
+ || use qdbm || use lmdb || use tokyocabinet ; then |
491 |
+ our_conf+=( "--enable-dba${shared}" ) |
492 |
+ fi |
493 |
+ |
494 |
+ # DBA drivers support |
495 |
+ our_conf+=( |
496 |
+ $(use_with cdb cdb) |
497 |
+ $(use_with berkdb db4 "${EPREFIX}/usr") |
498 |
+ $(use_enable flatfile flatfile) |
499 |
+ $(use_with gdbm gdbm "${EPREFIX}/usr") |
500 |
+ $(use_enable inifile inifile) |
501 |
+ $(use_with qdbm qdbm "${EPREFIX}/usr") |
502 |
+ $(use_with lmdb lmdb "${EPREFIX}/usr") |
503 |
+ ) |
504 |
+ |
505 |
+ # Support for the GD graphics library |
506 |
+ our_conf+=( |
507 |
+ $(use_with truetype freetype-dir "${EPREFIX}/usr") |
508 |
+ $(use_enable cjk gd-jis-conv) |
509 |
+ $(use_with gd jpeg-dir "${EPREFIX}/usr") |
510 |
+ $(use_with gd png-dir "${EPREFIX}/usr") |
511 |
+ $(use_with xpm xpm-dir "${EPREFIX}/usr") |
512 |
+ ) |
513 |
+ if use webp; then |
514 |
+ our_conf+=( --with-webp-dir="${EPREFIX}/usr" ) |
515 |
+ fi |
516 |
+ # enable gd last, so configure can pick up the previous settings |
517 |
+ our_conf+=( $(use_with gd gd) ) |
518 |
+ |
519 |
+ # IMAP support |
520 |
+ if use imap ; then |
521 |
+ our_conf+=( |
522 |
+ $(use_with imap imap "${EPREFIX}/usr") |
523 |
+ $(use_with ssl imap-ssl "${EPREFIX}/usr") |
524 |
+ ) |
525 |
+ fi |
526 |
+ |
527 |
+ # Interbase/firebird support |
528 |
+ our_conf+=( $(use_with firebird interbase "${EPREFIX}/usr") ) |
529 |
+ |
530 |
+ # LDAP support |
531 |
+ if use ldap ; then |
532 |
+ our_conf+=( |
533 |
+ $(use_with ldap ldap "${EPREFIX}/usr") |
534 |
+ $(use_with ldap-sasl ldap-sasl "${EPREFIX}/usr") |
535 |
+ ) |
536 |
+ fi |
537 |
+ |
538 |
+ # MySQL support |
539 |
+ local mysqllib="mysqlnd" |
540 |
+ local mysqlilib="mysqlnd" |
541 |
+ |
542 |
+ our_conf+=( $(use_with mysqli mysqli "${mysqlilib}") ) |
543 |
+ |
544 |
+ local mysqlsock="${EPREFIX}/var/run/mysqld/mysqld.sock" |
545 |
+ if use mysql || use mysqli ; then |
546 |
+ our_conf+=( $(use_with mysql mysql-sock "${mysqlsock}") ) |
547 |
+ fi |
548 |
+ |
549 |
+ # ODBC support |
550 |
+ our_conf+=( |
551 |
+ $(use_with odbc unixODBC "${EPREFIX}/usr") |
552 |
+ $(use_with iodbc iodbc "${EPREFIX}/usr") |
553 |
+ ) |
554 |
+ |
555 |
+ # Oracle support |
556 |
+ our_conf+=( $(use_with oci8-instant-client oci8) ) |
557 |
+ |
558 |
+ # PDO support |
559 |
+ if use pdo ; then |
560 |
+ our_conf+=( |
561 |
+ $(use_with mssql pdo-dblib "${EPREFIX}/usr") |
562 |
+ $(use_with mysql pdo-mysql "${mysqllib}") |
563 |
+ $(use_with postgres pdo-pgsql) |
564 |
+ $(use_with sqlite pdo-sqlite "${EPREFIX}/usr") |
565 |
+ $(use_with firebird pdo-firebird "${EPREFIX}/usr") |
566 |
+ $(use_with odbc pdo-odbc "unixODBC,${EPREFIX}/usr") |
567 |
+ $(use_with oci8-instant-client pdo-oci) |
568 |
+ ) |
569 |
+ fi |
570 |
+ |
571 |
+ # readline/libedit support |
572 |
+ our_conf+=( |
573 |
+ $(use_with readline readline "${EPREFIX}/usr") |
574 |
+ $(use_with libedit libedit "${EPREFIX}/usr") |
575 |
+ ) |
576 |
+ |
577 |
+ # Session support |
578 |
+ if use session ; then |
579 |
+ our_conf+=( $(use_with session-mm mm "${EPREFIX}/usr") ) |
580 |
+ else |
581 |
+ our_conf+=( $(use_enable session session) ) |
582 |
+ fi |
583 |
+ |
584 |
+ # Use pic for shared modules such as apache2's mod_php |
585 |
+ our_conf+=( --with-pic ) |
586 |
+ |
587 |
+ # we use the system copy of pcre |
588 |
+ # --with-pcre-regex affects ext/pcre |
589 |
+ # --with-pcre-dir affects ext/filter and ext/zip |
590 |
+ # --with-pcre-valgrind cannot be enabled with system pcre |
591 |
+ # Many arches don't support pcre-jit |
592 |
+ our_conf+=( |
593 |
+ --with-pcre-regex="${EPREFIX}/usr" |
594 |
+ --with-pcre-dir="${EPREFIX}/usr" |
595 |
+ --without-pcre-valgrind |
596 |
+ --without-pcre-jit |
597 |
+ ) |
598 |
+ |
599 |
+ # Catch CFLAGS problems |
600 |
+ # Fixes bug #14067. |
601 |
+ # Changed order to run it in reverse for bug #32022 and #12021. |
602 |
+ replace-cpu-flags "k6*" "i586" |
603 |
+ |
604 |
+ # Cache the ./configure test results between SAPIs. |
605 |
+ our_conf+=( --cache-file="${T}/config.cache" ) |
606 |
+ |
607 |
+ # Support user-passed configuration parameters |
608 |
+ our_conf+=( ${EXTRA_ECONF:-} ) |
609 |
+ |
610 |
+ # Support the Apache2 extras, they must be set globally for all |
611 |
+ # SAPIs to work correctly, especially for external PHP extensions |
612 |
+ |
613 |
+ mkdir -p "${WORKDIR}/sapis-build" || die |
614 |
+ for one_sapi in $SAPIS ; do |
615 |
+ use "${one_sapi}" || continue |
616 |
+ php_set_ini_dir "${one_sapi}" |
617 |
+ |
618 |
+ # The BUILD_DIR variable is used to determine where to output |
619 |
+ # the files that autotools creates. This was all originally |
620 |
+ # based on the autotools-utils eclass. |
621 |
+ BUILD_DIR="${WORKDIR}/sapis-build/${one_sapi}" |
622 |
+ cp -a "${S}" "${BUILD_DIR}" || die |
623 |
+ cd "${BUILD_DIR}" || die |
624 |
+ |
625 |
+ local sapi_conf=( |
626 |
+ --with-config-file-path="${PHP_INI_DIR}" |
627 |
+ --with-config-file-scan-dir="${PHP_EXT_INI_DIR_ACTIVE}" |
628 |
+ ) |
629 |
+ |
630 |
+ for sapi in $SAPIS ; do |
631 |
+ case "$sapi" in |
632 |
+ cli|cgi|embed|fpm|phpdbg) |
633 |
+ if [[ "${one_sapi}" == "${sapi}" ]] ; then |
634 |
+ sapi_conf+=( "--enable-${sapi}" ) |
635 |
+ if [[ "fpm" == "${sapi}" ]] ; then |
636 |
+ sapi_conf+=( |
637 |
+ $(use_with acl fpm-acl) |
638 |
+ $(use_with systemd fpm-systemd) |
639 |
+ ) |
640 |
+ fi |
641 |
+ else |
642 |
+ sapi_conf+=( "--disable-${sapi}" ) |
643 |
+ fi |
644 |
+ ;; |
645 |
+ |
646 |
+ apache2) |
647 |
+ if [[ "${one_sapi}" == "${sapi}" ]] ; then |
648 |
+ sapi_conf+=( --with-apxs2="${EPREFIX}/usr/bin/apxs" ) |
649 |
+ else |
650 |
+ sapi_conf+=( --without-apxs2 ) |
651 |
+ fi |
652 |
+ ;; |
653 |
+ esac |
654 |
+ done |
655 |
+ |
656 |
+ # Construct the $myeconfargs array by concatenating $our_conf |
657 |
+ # (the common args) and $sapi_conf (the SAPI-specific args). |
658 |
+ local myeconfargs=( "${our_conf[@]}" ) |
659 |
+ myeconfargs+=( "${sapi_conf[@]}" ) |
660 |
+ |
661 |
+ pushd "${BUILD_DIR}" > /dev/null || die |
662 |
+ econf "${myeconfargs[@]}" |
663 |
+ popd > /dev/null || die |
664 |
+ done |
665 |
+} |
666 |
+ |
667 |
+src_compile() { |
668 |
+ # snmp seems to run during src_compile, too (bug #324739) |
669 |
+ addpredict /usr/share/snmp/mibs/.index #nowarn |
670 |
+ addpredict /var/lib/net-snmp/mib_indexes #nowarn |
671 |
+ |
672 |
+ for sapi in ${SAPIS} ; do |
673 |
+ if use "${sapi}"; then |
674 |
+ cd "${WORKDIR}/sapis-build/$sapi" || \ |
675 |
+ die "Failed to change dir to ${WORKDIR}/sapis-build/$1" |
676 |
+ emake |
677 |
+ fi |
678 |
+ done |
679 |
+} |
680 |
+ |
681 |
+src_install() { |
682 |
+ # see bug #324739 for what happens when we don't have that |
683 |
+ addpredict /usr/share/snmp/mibs/.index #nowarn |
684 |
+ |
685 |
+ # grab the first SAPI that got built and install common files from there |
686 |
+ local first_sapi="" |
687 |
+ for sapi in $SAPIS ; do |
688 |
+ if use $sapi ; then |
689 |
+ first_sapi=$sapi |
690 |
+ break |
691 |
+ fi |
692 |
+ done |
693 |
+ |
694 |
+ # Makefile forgets to create this before trying to write to it... |
695 |
+ dodir "${PHP_DESTDIR#${EPREFIX}}/bin" |
696 |
+ |
697 |
+ # Install php environment (without any sapis) |
698 |
+ cd "${WORKDIR}/sapis-build/$first_sapi" || die |
699 |
+ emake INSTALL_ROOT="${D}" \ |
700 |
+ install-build install-headers install-programs |
701 |
+ |
702 |
+ local extension_dir="$("${ED}/${PHP_DESTDIR#${EPREFIX}}/bin/php-config" --extension-dir)" |
703 |
+ |
704 |
+ # Create the directory where we'll put version-specific php scripts |
705 |
+ keepdir "/usr/share/php${PHP_MV}" |
706 |
+ |
707 |
+ local sapi="", file="" |
708 |
+ local sapi_list="" |
709 |
+ |
710 |
+ for sapi in ${SAPIS}; do |
711 |
+ if use "${sapi}" ; then |
712 |
+ einfo "Installing SAPI: ${sapi}" |
713 |
+ cd "${WORKDIR}/sapis-build/${sapi}" || die |
714 |
+ |
715 |
+ if [[ "${sapi}" == "apache2" ]] ; then |
716 |
+ # We're specifically not using emake install-sapi as libtool |
717 |
+ # may cause unnecessary relink failures (see bug #351266) |
718 |
+ insinto "${PHP_DESTDIR#${EPREFIX}}/apache2/" |
719 |
+ newins ".libs/libphp${PHP_MV}$(get_libname)" \ |
720 |
+ "libphp${PHP_MV}$(get_libname)" |
721 |
+ keepdir "/usr/$(get_libdir)/apache2/modules" |
722 |
+ else |
723 |
+ # needed each time, php_install_ini would reset it |
724 |
+ local dest="${PHP_DESTDIR#${EPREFIX}}" |
725 |
+ into "${dest}" |
726 |
+ case "$sapi" in |
727 |
+ cli) |
728 |
+ source="sapi/cli/php" |
729 |
+ ;; |
730 |
+ cgi) |
731 |
+ source="sapi/cgi/php-cgi" |
732 |
+ ;; |
733 |
+ fpm) |
734 |
+ source="sapi/fpm/php-fpm" |
735 |
+ ;; |
736 |
+ embed) |
737 |
+ source="libs/libphp${PHP_MV}$(get_libname)" |
738 |
+ ;; |
739 |
+ phpdbg) |
740 |
+ source="sapi/phpdbg/phpdbg" |
741 |
+ ;; |
742 |
+ *) |
743 |
+ die "unhandled sapi in src_install" |
744 |
+ ;; |
745 |
+ esac |
746 |
+ |
747 |
+ if [[ "${source}" == *"$(get_libname)" ]]; then |
748 |
+ dolib.so "${source}" |
749 |
+ else |
750 |
+ dobin "${source}" |
751 |
+ local name="$(basename ${source})" |
752 |
+ dosym "${dest}/bin/${name}" "/usr/bin/${name}${SLOT}" |
753 |
+ fi |
754 |
+ fi |
755 |
+ |
756 |
+ php_install_ini "${sapi}" |
757 |
+ |
758 |
+ # construct correct SAPI string for php-config |
759 |
+ # thanks to ferringb for the bash voodoo |
760 |
+ if [[ "${sapi}" == "apache2" ]]; then |
761 |
+ sapi_list="${sapi_list:+${sapi_list} }apache2handler" |
762 |
+ else |
763 |
+ sapi_list="${sapi_list:+${sapi_list} }${sapi}" |
764 |
+ fi |
765 |
+ fi |
766 |
+ done |
767 |
+ |
768 |
+ # Installing opcache module |
769 |
+ if use opcache ; then |
770 |
+ into "${PHP_DESTDIR#${EPREFIX}}" |
771 |
+ dolib.so "modules/opcache$(get_libname)" |
772 |
+ fi |
773 |
+ |
774 |
+ # Install env.d files |
775 |
+ newenvd "${FILESDIR}/20php5-envd" "20php${SLOT}" |
776 |
+ sed -e "s|/lib/|/$(get_libdir)/|g" -i "${ED}/etc/env.d/20php${SLOT}" || die |
777 |
+ sed -e "s|php5|php${SLOT}|g" -i "${ED}/etc/env.d/20php${SLOT}" || die |
778 |
+ |
779 |
+ # set php-config variable correctly (bug #278439) |
780 |
+ sed -e "s:^\(php_sapis=\)\".*\"$:\1\"${sapi_list}\":" -i \ |
781 |
+ "${ED}/usr/$(get_libdir)/php${SLOT}/bin/php-config" || die |
782 |
+ |
783 |
+ if use fpm ; then |
784 |
+ if use systemd; then |
785 |
+ systemd_newunit "${FILESDIR}/php-fpm_at.service" \ |
786 |
+ "php-fpm@${SLOT}.service" |
787 |
+ else |
788 |
+ systemd_newunit "${FILESDIR}/php-fpm_at-simple.service" \ |
789 |
+ "php-fpm@${SLOT}.service" |
790 |
+ fi |
791 |
+ fi |
792 |
+} |
793 |
+ |
794 |
+src_test() { |
795 |
+ echo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
796 |
+ PHP_BIN="${WORKDIR}/sapis-build/cli/sapi/cli/php" |
797 |
+ if [[ ! -x "${PHP_BIN}" ]] ; then |
798 |
+ ewarn "Test phase requires USE=cli, skipping" |
799 |
+ return |
800 |
+ else |
801 |
+ export TEST_PHP_EXECUTABLE="${PHP_BIN}" |
802 |
+ fi |
803 |
+ |
804 |
+ if [[ -x "${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi" ]] ; then |
805 |
+ export TEST_PHP_CGI_EXECUTABLE="${WORKDIR}/sapis-build/cgi/sapi/cgi/php-cgi" |
806 |
+ fi |
807 |
+ |
808 |
+ if [[ -x "${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg" ]] ; then |
809 |
+ export TEST_PHPDBG_EXECUTABLE="${WORKDIR}/sapis-build/phpdbg/sapi/phpdbg/phpdbg" |
810 |
+ fi |
811 |
+ |
812 |
+ REPORT_EXIT_STATUS=1 "${TEST_PHP_EXECUTABLE}" -n -d \ |
813 |
+ "session.save_path=${T}" \ |
814 |
+ "${WORKDIR}/sapis-build/cli/run-tests.php" -n -q -d \ |
815 |
+ "session.save_path=${T}" |
816 |
+ |
817 |
+ for name in ${EXPECTED_TEST_FAILURES}; do |
818 |
+ mv "${name}.out" "${name}.out.orig" 2>/dev/null || die |
819 |
+ done |
820 |
+ |
821 |
+ local failed="$(find -name '*.out')" |
822 |
+ if [[ ${failed} != "" ]] ; then |
823 |
+ ewarn "The following test cases failed unexpectedly:" |
824 |
+ for name in ${failed}; do |
825 |
+ ewarn " ${name/.out/}" |
826 |
+ done |
827 |
+ else |
828 |
+ einfo "No unexpected test failures, all fine" |
829 |
+ fi |
830 |
+ |
831 |
+ if [[ ${PHP_SHOW_UNEXPECTED_TEST_PASS} == "1" ]] ; then |
832 |
+ local passed="" |
833 |
+ for name in ${EXPECTED_TEST_FAILURES}; do |
834 |
+ [[ -f "${name}.diff" ]] && continue |
835 |
+ passed="${passed} ${name}" |
836 |
+ done |
837 |
+ if [[ ${passed} != "" ]] ; then |
838 |
+ einfo "The following test cases passed unexpectedly:" |
839 |
+ for name in ${passed}; do |
840 |
+ ewarn " ${passed}" |
841 |
+ done |
842 |
+ else |
843 |
+ einfo "None of the known-to-fail tests passed, all fine" |
844 |
+ fi |
845 |
+ fi |
846 |
+} |
847 |
+ |
848 |
+pkg_postinst() { |
849 |
+ # Output some general info to the user |
850 |
+ if use apache2 ; then |
851 |
+ elog |
852 |
+ elog "To enable PHP in apache, you will need to add \"-D PHP\" to" |
853 |
+ elog "your apache2 command. OpenRC users can append that string to" |
854 |
+ elog "APACHE2_OPTS in /etc/conf.d/apache2." |
855 |
+ elog |
856 |
+ elog "The apache module configuration file 70_mod_php.conf is" |
857 |
+ elog "provided (and maintained) by eselect-php." |
858 |
+ elog |
859 |
+ fi |
860 |
+ |
861 |
+ # Create the symlinks for php |
862 |
+ for m in ${SAPIS}; do |
863 |
+ [[ ${m} == 'embed' ]] && continue; |
864 |
+ if use $m ; then |
865 |
+ local ci=$(eselect php show $m) |
866 |
+ if [[ -z $ci ]]; then |
867 |
+ eselect php set $m php${SLOT} || die |
868 |
+ einfo "Switched ${m} to use php:${SLOT}" |
869 |
+ einfo |
870 |
+ elif [[ $ci != "php${SLOT}" ]] ; then |
871 |
+ elog "To switch $m to use php:${SLOT}, run" |
872 |
+ elog " eselect php set $m php${SLOT}" |
873 |
+ elog |
874 |
+ fi |
875 |
+ fi |
876 |
+ done |
877 |
+ |
878 |
+ # Remove dead symlinks for SAPIs that were just disabled. For |
879 |
+ # example, if the user has the cgi SAPI enabled, then he has an |
880 |
+ # eselect-php symlink for it. If he later reinstalls PHP with |
881 |
+ # USE="-cgi", that symlink will break. This call to eselect is |
882 |
+ # supposed to remove that dead link per bug 572436. |
883 |
+ eselect php cleanup || die |
884 |
+ |
885 |
+ if ! has "php${SLOT/./-}" ${PHP_TARGETS}; then |
886 |
+ elog "To build extensions for this version of PHP, you will need to" |
887 |
+ elog "add php${SLOT/./-} to your PHP_TARGETS USE_EXPAND variable." |
888 |
+ elog |
889 |
+ fi |
890 |
+ |
891 |
+ # Warn about the removal of PHP_INI_VERSION if the user has it set. |
892 |
+ if [[ -n "${PHP_INI_VERSION}" ]]; then |
893 |
+ ewarn 'The PHP_INI_VERSION variable has been phased out. You may' |
894 |
+ ewarn 'remove it from your configuration at your convenience. See' |
895 |
+ ewarn |
896 |
+ ewarn ' https://bugs.gentoo.org/611214' |
897 |
+ ewarn |
898 |
+ ewarn 'for more information.' |
899 |
+ fi |
900 |
+ |
901 |
+ elog "For details on how version slotting works, please see" |
902 |
+ elog "the wiki:" |
903 |
+ elog |
904 |
+ elog " https://wiki.gentoo.org/wiki/PHP" |
905 |
+ elog |
906 |
+} |
907 |
+ |
908 |
+pkg_postrm() { |
909 |
+ # This serves two purposes. First, if we have just removed the last |
910 |
+ # installed version of PHP, then this will remove any dead symlinks |
911 |
+ # belonging to eselect-php. Second, if a user upgrades slots from |
912 |
+ # (say) 5.6 to 7.0 and depcleans the old slot, then this will update |
913 |
+ # his existing symlinks to point to the new 7.0 installation. The |
914 |
+ # latter is bug 432962. |
915 |
+ # |
916 |
+ # Note: the eselect-php package may not be installed at this point, |
917 |
+ # so we can't die() if this command fails. |
918 |
+ eselect php cleanup |
919 |
+} |