projects/guix·blob python-team · refs

416 lines · 18.4 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016-2020 Julien Lepiller <[email protected]>
3;;; Copyright © 2016 Marius Bakke <[email protected]>
4;;; Copyright © 2018, 2020, 2021 Tobias Geerinckx-Rice <[email protected]>
5;;; Copyright © 2018 Ricardo Wurmus <[email protected]>
6;;; Copyright © 2019 Oleg Pykhalov <[email protected]>
7;;; Copyright © 2020, 2025 Maxim Cournoyer <[email protected]>
8;;; Copyright © 2021, 2023 Efraim Flashner <[email protected]>
9;;; Copyright © 2023 Timo Wilken <[email protected]>
10;;; Copyright © 2025, 2026 Ashish SHUKLA <[email protected]>
11;;;
12;;; This file is part of GNU Guix.
13;;;
14;;; GNU Guix is free software; you can redistribute it and/or modify it
15;;; under the terms of the GNU General Public License as published by
16;;; the Free Software Foundation; either version 3 of the License, or (at
17;;; your option) any later version.
18;;;
19;;; GNU Guix is distributed in the hope that it will be useful, but
20;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22;;; GNU General Public License for more details.
23;;;
24;;; You should have received a copy of the GNU General Public License
25;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27(define-module (gnu packages php)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages algebra)
30 #:use-module (gnu packages aspell)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages bison)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages crypto)
36 #:use-module (gnu packages curl)
37 #:use-module (gnu packages cyrus-sasl)
38 #:use-module (gnu packages databases)
39 #:use-module (gnu packages dbm)
40 #:use-module (gnu packages fontutils)
41 #:use-module (gnu packages gd)
42 #:use-module (gnu packages gettext)
43 #:use-module (gnu packages gnupg)
44 #:use-module (gnu packages icu4c)
45 #:use-module (gnu packages image)
46 #:use-module (gnu packages linux)
47 #:use-module (gnu packages multiprecision)
48 #:use-module (gnu packages openldap)
49 #:use-module (gnu packages pcre)
50 #:use-module (gnu packages pkg-config)
51 #:use-module (gnu packages readline)
52 #:use-module (gnu packages regex)
53 #:use-module (gnu packages sqlite)
54 #:use-module (gnu packages tls)
55 #:use-module (gnu packages web)
56 #:use-module (gnu packages xml)
57 #:use-module (gnu packages xorg)
58 #:use-module (guix packages)
59 #:use-module (guix download)
60 #:use-module (guix gexp)
61 #:use-module (guix build-system gnu)
62 #:use-module (guix utils)
63 #:use-module ((guix licenses) #:prefix license:))
64
65;; current PHP version
66;; actively supported until: 31 Dec 2027
67;; security support until: 31 Dec 2029
68(define-public php-8.5
69 (package
70 (name "php")
71 (version "8.5.11")
72 (home-page "https://www.php.net/")
73 (source
74 (origin
75 (method url-fetch)
76 (uri (string-append home-page "distributions/" "php-" version ".tar.xz"))
77 (sha256
78 (base32 "0q03h3mvwah8fbzf7m6rlvv1a2kmw7xxi521ix66yccciv07bgnr"))
79 (modules '((guix build utils)))
80 (snippet
81 '(with-directory-excursion "ext"
82 (for-each delete-file-recursively
83 ;; Some of the bundled libraries have no proper upstream.
84 ;; Ideally we'd extract these out as separate packages:
85 ;; "mbstring/libmbfl"
86 ;; "date/lib"
87 ;; "bcmath/libbcmath"
88 ;; "fileinfo/libmagic" ; a patched version of libmagic
89 '("gd/libgd" "pcre/pcre2lib"))))))
90 (build-system gnu-build-system)
91 (arguments
92 (list
93 #:modules
94 `((ice-9 textual-ports)
95 ,@%default-gnu-imported-modules)
96 #:configure-flags
97 #~(let-syntax ((with (syntax-rules ()
98 ((_ option input)
99 (string-append
100 option "="
101 (assoc-ref %build-inputs input))))))
102 (list (with "--with-bz2" "bzip2")
103 (with "--with-curl" "curl")
104 (with "--with-gdbm" "gdbm")
105 (with "--with-gettext" "libc") ;libintl.h
106 (with "--with-gmp" "gmp")
107 (with "--with-ldap" "openldap")
108 (with "--with-ldap-sasl" "cyrus-sasl")
109 (with "--with-pdo-pgsql" "postgresql")
110 (with "--with-pdo-sqlite" "sqlite")
111 (with "--with-pgsql" "postgresql")
112 ;; PHP’s Pspell extension, while retaining its current name,
113 ;; now uses the Aspell library.
114 (with "--with-pspell" "aspell")
115 (with "--with-readline" "readline")
116 (with "--with-sodium" "libsodium")
117 (with "--with-sqlite3" "sqlite")
118 (with "--with-tidy" "tidy-html")
119 (with "--with-xsl" "libxslt")
120 (with "--with-zlib-dir" "zlib")
121 ;; We could add "--with-snmp", but it requires netsnmp that
122 ;; we don't have a package for. It is used to build the snmp
123 ;; extension of php.
124 "--with-external-pcre"
125 "--with-external-gd"
126 "--with-iconv"
127 "--with-openssl"
128 "--with-mysqli" ;Required for, e.g. wordpress
129 "--with-pdo-mysql"
130 "--with-zip"
131 "--with-zlib"
132 "--enable-bcmath" ;Required for, e.g. Zabbix frontend
133 "--enable-calendar"
134 "--enable-dba=shared"
135 "--enable-exif"
136 "--enable-flatfile"
137 "--enable-fpm"
138 "--enable-ftp"
139 "--enable-gd"
140 "--enable-inifile"
141 "--enable-intl"
142 "--enable-mbstring"
143 "--enable-pcntl"
144 "--enable-sockets"
145 "--enable-sysvsem" ;Required for, e.g. Nextcloud
146 "--enable-embed" ;Required for embed SAPI
147 "--enable-zts"
148 "--disable-zend-signals"
149 "--enable-zend-max-execution-timers"))
150 #:phases
151 #~(modify-phases %standard-phases
152 (add-after 'unpack 'do-not-record-build-flags
153 (lambda _
154 ;; Prevent configure flags from being stored and causing
155 ;; unnecessary runtime dependencies.
156 (substitute* "scripts/php-config.in"
157 (("@CONFIGURE_OPTIONS@")
158 "")
159 (("@PHP_LDFLAGS@")
160 ""))
161 ;; This file has ISO-8859-1 encoding.
162 (with-fluids ((%default-port-encoding "ISO-8859-1"))
163 (substitute* "main/build-defs.h.in"
164 (("@CONFIGURE_COMMAND@")
165 "(omitted)")))))
166 (add-before 'build 'patch-/bin/sh
167 (lambda _
168 (substitute* '("run-tests.php"
169 "ext/standard/proc_open.c")
170 (("/bin/sh")
171 (which "sh")))))
172 (add-before 'check 'prepare-tests
173 (lambda* (#:key parallel-tests? #:allow-other-keys)
174 ;; Some of these files have ISO-8859-1 encoding, whereas others
175 ;; use ASCII, so we can't use a "catch-all" find-files here.
176 (with-fluids ((%default-port-encoding "ISO-8859-1"))
177 (substitute* '("ext/mbstring/tests/mb_send_mail02.phpt"
178 "ext/mbstring/tests/mb_send_mail04.phpt"
179 "ext/mbstring/tests/mb_send_mail05.phpt"
180 "ext/mbstring/tests/mb_send_mail06.phpt")
181 (("/bin/cat")
182 (which "cat"))))
183 (substitute* '("ext/mbstring/tests/mb_send_mail01.phpt"
184 "ext/mbstring/tests/mb_send_mail03.phpt"
185 "ext/mbstring/tests/bug52681.phpt"
186 "ext/standard/tests/general_functions/bug34794.phpt"
187 "ext/standard/tests/general_functions/bug44667.phpt"
188 "ext/standard/tests/general_functions/proc_open.phpt")
189 (("/bin/cat")
190 (which "cat")))
191
192 ;; The encoding of this file is not recognized, so we simply drop it.
193 (delete-file "ext/mbstring/tests/mb_send_mail07.phpt")
194
195 (substitute* "ext/standard/tests/streams/bug60602.phpt"
196 (("'ls'")
197 (string-append "'"
198 (which "ls") "'")))
199
200 ;; Drop tests known to fail on different architectures:
201 (for-each
202 delete-file
203 #$(cond
204 ((target-arm32?)
205 '(list
206 "ext/calendar/tests/unixtojd_error1.phpt"
207 "ext/opcache/tests/preload_006.phpt"
208 "ext/opcache/tests/preload_011.phpt"
209 ;; arm can be a lot slower, so a time-related test fails
210 "ext/fileinfo/tests/cve-2014-3538-nojit.phpt"
211 "ext/pcntl/tests/pcntl_unshare_01.phpt"
212 "ext/pcre/tests/bug76514.phpt"
213 "ext/pcre/tests/preg_match_error3.phpt"
214 "ext/pcre/tests/cache_limit.phpt"
215 "ext/sockets/tests/socket_getopt.phpt"
216 "ext/sockets/tests/socket_sendrecvmsg_error.phpt"
217 "ext/standard/tests/general_functions/var_export-locale.phpt"
218 "ext/standard/tests/general_functions/var_export_basic1.phpt"
219 "ext/intl/tests/timezone_getErrorCodeMessage_basic.phpt"
220 "ext/intl/tests/timezone_getOffset_error.phpt"
221 "sapi/cli/tests/cli_process_title_unix.phpt"
222 "Zend/tests/concat_003.phpt"))
223 ((target-x86-32?)
224 '(list "ext/dba/tests/dba_gdbm.phpt"))
225 ((target-ppc32?)
226 '(list "sapi/phpdbg/tests/watch_001.phpt"
227 "sapi/phpdbg/tests/watch_003.phpt"
228 "sapi/phpdbg/tests/watch_004.phpt"))
229 ((target-ppc64le?)
230 '(list
231 ;; phpdbg watchpoints don't work.
232 ;; Bug tracked upstream at:
233 ;; https://bugs.php.net/bug.php?id=81408
234 "sapi/phpdbg/tests/watch_001.phpt"
235 "sapi/phpdbg/tests/watch_003.phpt"
236 "sapi/phpdbg/tests/watch_004.phpt"
237 "sapi/phpdbg/tests/watch_005.phpt"
238 "sapi/phpdbg/tests/watch_006.phpt"))
239 (else ''())))
240
241 ;; Drop tests that are known to fail.
242 (for-each
243 delete-file
244 '("ext/posix/tests/posix_getgrgid.phpt" ;Requires /etc/group.
245 "ext/posix/tests/posix_getgrnam_basic.phpt" ;Requires /etc/group.
246 "ext/sockets/tests/bug63000.phpt" ;Fails to detect OS.
247 "ext/sockets/tests/socket_tcp_congestion.phpt" ;Needs kernel support
248 ;; These need exotic locales.
249 "ext/standard/tests/strings/setlocale_basic1.phpt"
250 "ext/standard/tests/strings/setlocale_basic2.phpt"
251 "ext/standard/tests/strings/setlocale_basic3.phpt"
252 "ext/standard/tests/strings/setlocale_variation1.phpt"
253
254 ;; This test fails for unknown reason (see:
255 ;; <https://github.com/php/php-src/issues/19996>).
256 "ext/gd/tests/gh16559.phpt"
257
258 ;; Some WebP related tests fail.
259 "ext/gd/tests/webp_basic.phpt"
260 "ext/gd/tests/imagecreatefromstring_webp.phpt"
261 ;; TODO: Enable these when libgd is built with xpm support.
262 "ext/gd/tests/xpm2gd.phpt"
263 "ext/gd/tests/xpm2jpg.phpt"
264 "ext/gd/tests/xpm2png.phpt"
265 ;; AVIF support disabled
266 "ext/gd/tests/avif_decode_encode.phpt"
267 ;; Typo in expected outputs
268 "ext/gd/tests/bug72339.phpt"
269 ;; AVIF support disabled
270 "ext/gd/tests/imagecreatefromstring_avif.phpt"
271
272 ;; These tests fail due to issues in upstream gd
273 ;; 2.3.3 around BICUBIC interpolation. See
274 ;; https://github.com/libgd/libgd/issues/847
275 "ext/gd/tests/bug79676.phpt"
276 "ext/gd/tests/imageinterpolation_basic.phpt"
277 "ext/gd/tests/imagescale_preserve_ratio.phpt"
278
279 ;; XXX: These test failures appear legitimate, needs investigation.
280 ;; open_basedir() restriction failure.
281 "ext/curl/tests/curl_setopt_ssl.phpt"
282
283 ;; Fail because there is no "root" in the build container's
284 ;; /etc/passwd
285 "sapi/fpm/tests/bug68591-conf-test-group.phpt"
286 "sapi/fpm/tests/bug68591-conf-test-listen-group.phpt"
287 "sapi/fpm/tests/bug68591-conf-test-listen-owner.phpt"
288
289 ;; The test expects an Array, but instead get the contents(?).
290 "ext/gd/tests/bug43073.phpt"
291 ;; imagettftext() returns wrong coordinates.
292 "ext/gd/tests/bug48732-mb.phpt"
293 "ext/gd/tests/bug48732.phpt"
294 ;; Similarly for imageftbbox().
295 "ext/gd/tests/bug48801-mb.phpt"
296 "ext/gd/tests/bug48801.phpt"
297 ;; Different expected output from imagecolorallocate().
298 "ext/gd/tests/bug53504.phpt"
299 ;; This test sometimes exit with Termsig=11 (see:
300 ;; <https://github.com/php/php-src/issues/19996>).
301 "ext/gd/tests/bug65148.phpt"
302 ;; Wrong image size after scaling an image.
303 "ext/gd/tests/bug73272.phpt"
304 ;; PCRE with/without JIT gives different result
305 "ext/pcre/tests/gh11374.phpt"
306 "ext/pcre/tests/gh11956.phpt"
307 ;; reported bug only seems to affect windows
308 "ext/standard/tests/directory/bug74589_utf8.phpt"
309 ;; This test is flaky, appears racy when the test suite runs
310 ;; in parallel (see:
311 ;; <https://github.com/php/php-src/issues/19998>).
312 "ext/standard/tests/file/bug46347.phpt"
313 ;; this test seems to be unreliable/flaky
314 "sapi/cli/tests/php_cli_server_pdeathsig.phpt"
315 ;; This test fails on most architectures.
316 "sapi/cli/tests/upload_2G.phpt"))
317
318 ;; Accommodate two extra openssl errors flanking the expected one:
319 ;; random number generator:RAND_{load,write}_file:Cannot open file
320 ;; This is due to an invalid $HOME, but changing it in the test
321 ;; still prints the first one & changing it globally is overkill.
322 (substitute* "ext/openssl/tests/bug80747.phpt"
323 ((".*error:%s:key size too small.*" match)
324 (string-append "%s\n" match "%s\n")))
325
326 ;; Skip tests requiring network access.
327 (setenv "SKIP_ONLINE_TESTS" "1")
328 ;; Without this variable, 'make test' passes regardless of failures.
329 (setenv "REPORT_EXIT_STATUS" "1")
330 ;; Skip tests requiring I/O facilities that are unavailable in the
331 ;; build environment
332 (setenv "SKIP_IO_CAPTURE_TESTS" "1")
333 ;; Run tests in parallel.
334 (setenv "TEST_PHP_ARGS"
335 (format #f "-j~a" (if parallel-tests?
336 (parallel-job-count)
337 1))))))
338 #:test-target "test"))
339 (inputs
340 (list aspell
341 bzip2
342 curl
343 cyrus-sasl
344 fontconfig
345 freetype
346 gd
347 gdbm
348 gmp
349 gnutls
350 icu4c
351 libgcrypt
352 libjpeg-turbo
353 libpng
354 libpng
355 libsodium
356 libx11
357 libxml2
358 libxslt
359 libzip
360 oniguruma
361 openldap
362 openssl
363 pcre2
364 postgresql
365 readline
366 sqlite
367 tidy-html
368 zlib))
369 (native-inputs
370 (list autoconf ;to save the test report
371 bison
372 gettext-minimal
373 pkg-config
374 procps)) ;for tests
375 (synopsis "PHP programming language")
376 (description
377 "PHP (PHP Hypertext Processor) is a server-side (CGI) scripting
378language designed primarily for web development but is also used as
379a general-purpose programming language. PHP code may be embedded into
380HTML code, or it can be used in combination with various web template
381systems, web content management systems and web frameworks.")
382 (license (list (license:non-copyleft "file://LICENSE") ;The PHP license.
383 (license:non-copyleft "file://Zend/LICENSE") ;The Zend license.
384 license:lgpl2.1 ;ext/mbstring/libmbfl
385 license:lgpl2.1+ ;ext/bcmath/libbcmath
386 license:bsd-2 ;ext/fileinfo/libmagic
387 license:expat)))) ; ext/date/lib
388
389;; php should always point to the latest php version
390(define-public php php-8.5)
391
392;; older supported php version
393;; actively supported until: 31 Dec 2026
394;; security support until: 31 Dec 2028
395(define-public php-8.4
396 (package
397 (inherit php-8.5)
398 (home-page "https://www.php.net/")
399 (version "8.4.26")
400 (source
401 (origin
402 (method url-fetch)
403 (uri (string-append home-page "distributions/" "php-" version ".tar.xz"))
404 (sha256
405 (base32 "1wb90ns46i4s8hax5kjdwxqw4l0v9z748lh0lpa4xm1ahr9xx8ij"))
406 (modules '((guix build utils)))
407 (snippet
408 '(with-directory-excursion "ext"
409 (for-each delete-file-recursively
410 ;; Some of the bundled libraries have no proper upstream.
411 ;; Ideally we'd extract these out as separate packages:
412 ;; "mbstring/libmbfl"
413 ;; "date/lib"
414 ;; "bcmath/libbcmath"
415 ;; "fileinfo/libmagic" ; a patched version of libmagic
416 '("gd/libgd" "pcre/pcre2lib"))))))))