projects/guix·blob mpd-fix-groups · refs

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