Commit | Line | Data |
---|---|---|
1845c2a4 JL |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2016 Julien Lepiller <julien@lepiller.eu> | |
3 | ;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com> | |
4 | ;;; | |
5 | ;;; This file is part of GNU Guix. | |
6 | ;;; | |
7 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
8 | ;;; under the terms of the GNU General Public License as published by | |
9 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
10 | ;;; your option) any later version. | |
11 | ;;; | |
12 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
13 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | ;;; GNU General Public License for more details. | |
16 | ;;; | |
17 | ;;; You should have received a copy of the GNU General Public License | |
18 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
19 | ||
20 | (define-module (gnu packages php) | |
21 | #:use-module (gnu packages) | |
22 | #:use-module (gnu packages algebra) | |
23 | #:use-module (gnu packages aspell) | |
24 | #:use-module (gnu packages base) | |
25 | #:use-module (gnu packages bison) | |
26 | #:use-module (gnu packages compression) | |
27 | #:use-module (gnu packages curl) | |
28 | #:use-module (gnu packages cyrus-sasl) | |
29 | #:use-module (gnu packages databases) | |
30 | #:use-module (gnu packages fontutils) | |
31 | #:use-module (gnu packages gd) | |
32 | #:use-module (gnu packages gettext) | |
33 | #:use-module (gnu packages glib) | |
34 | #:use-module (gnu packages gnupg) | |
35 | #:use-module (gnu packages image) | |
36 | #:use-module (gnu packages linux) | |
37 | #:use-module (gnu packages multiprecision) | |
38 | #:use-module (gnu packages openldap) | |
39 | #:use-module (gnu packages pcre) | |
40 | #:use-module (gnu packages pkg-config) | |
41 | #:use-module (gnu packages readline) | |
42 | #:use-module (gnu packages textutils) | |
43 | #:use-module (gnu packages tls) | |
44 | #:use-module (gnu packages web) | |
45 | #:use-module (gnu packages xml) | |
46 | #:use-module (gnu packages xorg) | |
47 | #:use-module (gnu packages zip) | |
48 | #:use-module (guix packages) | |
49 | #:use-module (guix download) | |
50 | #:use-module (guix build-system gnu) | |
51 | #:use-module ((guix licenses) #:prefix license:)) | |
52 | ||
1845c2a4 JL |
53 | (define-public php |
54 | (package | |
55 | (name "php") | |
60a50806 | 56 | (version "7.1.2") |
1845c2a4 JL |
57 | (home-page "https://secure.php.net/") |
58 | (source (origin | |
59 | (method url-fetch) | |
60 | (uri (string-append home-page "distributions/" | |
61 | name "-" version ".tar.xz")) | |
62 | (sha256 | |
63 | (base32 | |
60a50806 | 64 | "0wg9ng230w724rpwsrhcg4pw41xm1xhz0zx76haanyymkz1s05fq")) |
1845c2a4 JL |
65 | (modules '((guix build utils))) |
66 | (snippet | |
67 | '(with-directory-excursion "ext" | |
68 | (for-each delete-file-recursively | |
69 | ;; Some of the bundled libraries have no proper upstream. | |
70 | ;; Ideally we'd extract these out as separate packages: | |
71 | ;;"mbstring/libmbfl" | |
72 | ;;"date/lib" | |
73 | ;;"bcmath/libbcmath" | |
74 | ;;"fileinfo/libmagic" ; This is a patched version of libmagic. | |
75 | '("gd/libgd" | |
76 | "mbstring/oniguruma" | |
77 | "pcre/pcrelib" | |
78 | "sqlite3/libsqlite" | |
79 | "xmlrpc/libxmlrpc" | |
80 | "zip/lib")))))) | |
81 | (build-system gnu-build-system) | |
82 | (arguments | |
83 | '(#:configure-flags | |
84 | (let-syntax ((with (syntax-rules () | |
85 | ((_ option input) | |
86 | (string-append option "=" | |
87 | (assoc-ref %build-inputs input)))))) | |
88 | (list (with "--with-bz2" "bzip2") | |
89 | (with "--with-curl" "curl") | |
90 | (with "--with-freetype-dir" "freetype") | |
91 | (with "--with-gd" "gd") | |
92 | (with "--with-gdbm" "gdbm") | |
93 | (with "--with-gettext" "glibc") ; libintl.h | |
94 | (with "--with-gmp" "gmp") | |
95 | (with "--with-jpeg-dir" "libjpeg") | |
96 | (with "--with-ldap" "openldap") | |
97 | (with "--with-ldap-sasl" "cyrus-sasl") | |
98 | (with "--with-libzip" "zip") | |
99 | (with "--with-libxml-dir" "libxml2") | |
100 | (with "--with-onig" "oniguruma") | |
101 | (with "--with-pcre-dir" "pcre") | |
102 | (with "--with-pcre-regex" "pcre") | |
103 | (with "--with-pdo-pgsql" "postgresql") | |
104 | (with "--with-pdo-sqlite" "sqlite") | |
105 | (with "--with-pgsql" "postgresql") | |
106 | (with "--with-png-dir" "libpng") | |
107 | ;; PHP’s Pspell extension, while retaining its current name, | |
108 | ;; now uses the Aspell library. | |
109 | (with "--with-pspell" "aspell") | |
110 | (with "--with-readline" "readline") | |
111 | (with "--with-sqlite3" "sqlite") | |
112 | (with "--with-tidy" "tidy") | |
113 | (with "--with-webp-dir" "libwebp") | |
114 | (with "--with-xpm-dir" "libxpm") | |
115 | (with "--with-xsl" "libxslt") | |
116 | (with "--with-zlib-dir" "zlib") | |
117 | ;; We could add "--with-snmp", but it requires netsnmp that | |
118 | ;; we don't have a package for. It is used to build the snmp | |
119 | ;; extension of php. | |
120 | "--with-iconv" | |
121 | "--with-openssl" | |
122 | "--with-pdo-mysql" | |
123 | "--with-zlib" | |
124 | "--enable-calendar" | |
125 | "--enable-dba=shared" | |
126 | "--enable-exif" | |
127 | "--enable-flatfile" | |
128 | "--enable-fpm" | |
129 | "--enable-ftp" | |
130 | "--enable-inifile" | |
131 | "--enable-mbstring" | |
132 | "--enable-pcntl" | |
133 | "--enable-sockets" | |
134 | "--enable-threads")) | |
135 | #:phases | |
136 | (modify-phases %standard-phases | |
137 | (add-after 'unpack 'do-not-record-build-flags | |
138 | (lambda _ | |
139 | ;; Prevent configure flags from being stored and causing | |
140 | ;; unnecessary runtime dependencies. | |
141 | (substitute* "scripts/php-config.in" | |
142 | (("@CONFIGURE_OPTIONS@") "") | |
143 | (("@PHP_LDFLAGS@") "")) | |
144 | ;; This file has ISO-8859-1 encoding. | |
145 | (with-fluids ((%default-port-encoding "ISO-8859-1")) | |
146 | (substitute* "main/build-defs.h.in" | |
147 | (("@CONFIGURE_COMMAND@") "(omitted)"))) | |
148 | #t)) | |
149 | (add-before 'build 'patch-/bin/sh | |
150 | (lambda _ | |
151 | (substitute* '("run-tests.php" "ext/standard/proc_open.c") | |
152 | (("/bin/sh") (which "sh"))) | |
153 | #t)) | |
154 | (add-before 'check 'prepare-tests | |
155 | (lambda _ | |
156 | ;; Some of these files have ISO-8859-1 encoding, whereas others | |
157 | ;; use ASCII, so we can't use a "catch-all" find-files here. | |
158 | (with-fluids ((%default-port-encoding "ISO-8859-1")) | |
159 | (substitute* '("ext/mbstring/tests/mb_send_mail02.phpt" | |
160 | "ext/mbstring/tests/mb_send_mail04.phpt" | |
161 | "ext/mbstring/tests/mb_send_mail05.phpt" | |
162 | "ext/mbstring/tests/mb_send_mail06.phpt") | |
163 | (("/bin/cat") (which "cat")))) | |
164 | (substitute* '("ext/mbstring/tests/mb_send_mail01.phpt" | |
165 | "ext/mbstring/tests/mb_send_mail03.phpt" | |
166 | "ext/mbstring/tests/bug52861.phpt" | |
167 | "ext/standard/tests/general_functions/bug34794.phpt" | |
168 | "ext/standard/tests/general_functions/bug44667.phpt" | |
169 | "ext/standard/tests/general_functions/proc_open.phpt") | |
170 | (("/bin/cat") (which "cat"))) | |
60a50806 JL |
171 | |
172 | ;; These tests fail because they include a file whose modification | |
173 | ;; time is 0. Touch them to make the test pass. The issue is reported | |
174 | ;; upstream as #74137. | |
175 | (utime "sapi/phpdbg/tests/include.inc" 1 1) | |
176 | (utime "sapi/phpdbg/tests/phpdbg_get_executable_stream_wrapper.inc" 1 1) | |
177 | ||
1845c2a4 JL |
178 | ;; The encoding of this file is not recognized, so we simply drop it. |
179 | (delete-file "ext/mbstring/tests/mb_send_mail07.phpt") | |
180 | ||
181 | (substitute* "ext/standard/tests/streams/bug60602.phpt" | |
182 | (("'ls'") (string-append "'" (which "ls") "'"))) | |
183 | ||
184 | ;; Drop tests that are known to fail. | |
185 | (for-each delete-file | |
186 | '("ext/posix/tests/posix_getgrgid.phpt" ; Requires /etc/group. | |
187 | "ext/sockets/tests/bug63000.phpt" ; Fails to detect OS. | |
188 | "ext/sockets/tests/socket_shutdown.phpt" ; Requires DNS. | |
189 | "ext/sockets/tests/socket_send.phpt" ; Likewise. | |
190 | "ext/sockets/tests/mcast_ipv4_recv.phpt" ; Requires multicast. | |
191 | ;; These needs /etc/services. | |
192 | "ext/standard/tests/general_functions/getservbyname_basic.phpt" | |
193 | "ext/standard/tests/general_functions/getservbyport_basic.phpt" | |
194 | "ext/standard/tests/general_functions/getservbyport_variation1.phpt" | |
195 | ;; And /etc/protocols. | |
196 | "ext/standard/tests/network/getprotobyname_basic.phpt" | |
197 | "ext/standard/tests/network/getprotobynumber_basic.phpt" | |
198 | ;; And exotic locales. | |
199 | "ext/standard/tests/strings/setlocale_basic1.phpt" | |
200 | "ext/standard/tests/strings/setlocale_basic2.phpt" | |
201 | "ext/standard/tests/strings/setlocale_basic3.phpt" | |
202 | "ext/standard/tests/strings/setlocale_variation1.phpt" | |
203 | ||
204 | ;; XXX: These gd tests fails. Likely because our version | |
205 | ;; is different from the (patched) bundled one. | |
206 | ;; Here, gd quits immediately after "fatal libpng error"; while the | |
207 | ;; test expects it to additionally return a "setjmp" error and warning. | |
208 | "ext/gd/tests/bug39780_extern.phpt" | |
209 | "ext/gd/tests/libgd00086_extern.phpt" | |
210 | ;; Extra newline in gd-png output. | |
211 | "ext/gd/tests/bug45799.phpt" | |
212 | ;; Different error message than expected from imagecrop(). | |
213 | "ext/gd/tests/bug66356.phpt" | |
214 | ;; Similarly for imagecreatefromgd2(). | |
215 | "ext/gd/tests/bug72339.phpt" | |
216 | ;; Call to undefined function imageantialias(). They are | |
217 | ;; supposed to fail anyway. | |
218 | "ext/gd/tests/bug72482.phpt" | |
219 | "ext/gd/tests/bug72482_2.phpt" | |
220 | "ext/gd/tests/bug73213.phpt" | |
221 | ;; Test expects generic "gd warning" but gets the actual function name. | |
222 | "ext/gd/tests/createfromwbmp2_extern.phpt" | |
223 | ;; TODO: Enable these when libgd is built with xpm support. | |
224 | "ext/gd/tests/xpm2gd.phpt" | |
225 | "ext/gd/tests/xpm2jpg.phpt" | |
226 | "ext/gd/tests/xpm2png.phpt" | |
227 | ||
228 | ;; XXX: These iconv tests have the expected outcome, | |
229 | ;; but with different error messages. | |
230 | ;; Expects "illegal character", instead gets "unknown error (84)". | |
231 | "ext/iconv/tests/bug52211.phpt" | |
232 | ;; Expects "wrong charset", gets unknown error (22). | |
233 | "ext/iconv/tests/iconv_mime_decode_variation3.phpt" | |
234 | "ext/iconv/tests/iconv_strlen_error2.phpt" | |
235 | "ext/iconv/tests/iconv_strlen_variation2.phpt" | |
236 | "ext/iconv/tests/iconv_substr_error2.phpt" | |
237 | ;; Expects conversion error, gets "error condition Termsig=11". | |
238 | "ext/iconv/tests/iconv_strpos_error2.phpt" | |
239 | "ext/iconv/tests/iconv_strrpos_error2.phpt" | |
240 | ;; Similar, but iterating over multiple values. | |
241 | ;; iconv breaks the loop after the first error with Termsig=11. | |
242 | "ext/iconv/tests/iconv_strpos_variation4.phpt" | |
243 | "ext/iconv/tests/iconv_strrpos_variation3.phpt" | |
244 | ||
245 | ;; XXX: These test failures appear legitimate, needs investigation. | |
246 | ;; open_basedir() restriction failure. | |
247 | "ext/curl/tests/bug61948.phpt" | |
248 | ;; Expects a false boolean, gets empty array from glob(). | |
249 | "ext/standard/tests/file/bug41655_1.phpt" | |
250 | "ext/standard/tests/file/glob_variation5.phpt" | |
251 | ;; Test output is correct, but in wrong order. | |
252 | "ext/standard/tests/streams/proc_open_bug64438.phpt" | |
253 | ;; The test expects an Array, but instead get the contents(?). | |
254 | "ext/gd/tests/bug43073.phpt" | |
255 | ;; imagettftext() returns wrong coordinates. | |
60a50806 | 256 | "ext/gd/tests/bug48732-mb.phpt" |
1845c2a4 JL |
257 | "ext/gd/tests/bug48732.phpt" |
258 | ;; Similarly for imageftbbox(). | |
60a50806 | 259 | "ext/gd/tests/bug48801-mb.phpt" |
1845c2a4 JL |
260 | "ext/gd/tests/bug48801.phpt" |
261 | ;; Different expected output from imagecolorallocate(). | |
262 | "ext/gd/tests/bug53504.phpt" | |
263 | ;; Wrong image size after scaling an image. | |
264 | "ext/gd/tests/bug73272.phpt" | |
265 | ;; Expects iconv to detect illegal characters, instead gets | |
266 | ;; "unknown error (84)" and heap corruption(!). | |
267 | "ext/iconv/tests/bug48147.phpt" | |
268 | ;; Expects illegal character ".", gets "=?utf-8?Q?." | |
269 | "ext/iconv/tests/bug51250.phpt" | |
270 | ;; @iconv() does not return expected output. | |
271 | "ext/iconv/tests/iconv003.phpt" | |
272 | ;; iconv throws "buffer length exceeded" on some string checks. | |
273 | "ext/iconv/tests/iconv_mime_encode.phpt" | |
274 | ;; file_get_contents(): iconv stream filter | |
275 | ;; ("ISO-8859-1"=>"UTF-8") unknown error. | |
276 | "ext/standard/tests/file/bug43008.phpt" | |
277 | ;; Table data not created in sqlite(?). | |
278 | "ext/pdo_sqlite/tests/bug_42589.phpt")) | |
279 | ||
280 | ;; Skip tests requiring network access. | |
281 | (setenv "SKIP_ONLINE_TESTS" "1") | |
282 | ;; Without this variable, 'make test' passes regardless of failures. | |
283 | (setenv "REPORT_EXIT_STATUS" "1") | |
284 | #t))) | |
285 | #:test-target "test")) | |
286 | (inputs | |
287 | `(("aspell" ,aspell) | |
288 | ("bzip2" ,bzip2) | |
289 | ("curl" ,curl) | |
290 | ("cyrus-sasl" ,cyrus-sasl) | |
291 | ("freetype" ,freetype) | |
60a50806 | 292 | ("gd" ,gd) |
1845c2a4 JL |
293 | ("gdbm" ,gdbm) |
294 | ("glibc" ,glibc) | |
295 | ("gmp" ,gmp) | |
60a50806 | 296 | ("gnutls" ,gnutls) |
1845c2a4 JL |
297 | ("libgcrypt" ,libgcrypt) |
298 | ("libjpeg" ,libjpeg) | |
299 | ("libpng" ,libpng) | |
300 | ("libwebp" ,libwebp) | |
301 | ("libxml2" ,libxml2) | |
302 | ("libxpm" ,libxpm) | |
303 | ("libxslt" ,libxslt) | |
304 | ("libx11" ,libx11) | |
305 | ("oniguruma" ,oniguruma) | |
306 | ("openldap" ,openldap) | |
307 | ("openssl" ,openssl) | |
308 | ("pcre" ,pcre) | |
309 | ("postgresql" ,postgresql) | |
310 | ("readline" ,readline) | |
3ad8cb41 | 311 | ("sqlite" ,sqlite) |
1845c2a4 JL |
312 | ("tidy" ,tidy) |
313 | ("zip" ,zip) | |
314 | ("zlib" ,zlib))) | |
315 | (native-inputs | |
316 | `(("pkg-config" ,pkg-config) | |
317 | ("bison" ,bison) | |
318 | ("intltool" ,intltool) | |
319 | ("procps" ,procps))) ; For tests. | |
320 | (synopsis "PHP programming language") | |
321 | (description | |
322 | "PHP (PHP Hypertext Processor) is a server-side (CGI) scripting | |
323 | language designed primarily for web development but is also used as | |
324 | a general-purpose programming language. PHP code may be embedded into | |
325 | HTML code, or it can be used in combination with various web template | |
326 | systems, web content management systems and web frameworks." ) | |
327 | (license (list | |
328 | (license:non-copyleft "file://LICENSE") ; The PHP license. | |
329 | (license:non-copyleft "file://Zend/LICENSE") ; The Zend license. | |
330 | license:lgpl2.1 ; ext/mbstring/libmbfl | |
331 | license:lgpl2.1+ ; ext/bcmath/libbcmath | |
332 | license:bsd-2 ; ext/fileinfo/libmagic | |
333 | license:expat)))) ; ext/date/lib |