projects/guix·blob libreoffice · refs

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