projects/guix·blob perlssl · refs

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