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