projects/guix·blob version-0.12.0 · refs

334 lines · 16.3 KiB

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