projects/guix·blob librewolf-updates · refs

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