source: dotfiles/guix/.guix-packages/php.scm@ 1e08614

Last change on this file since 1e08614 was 1e08614, checked in by Mikhail Kirillov <w96k@…>, on Apr 19, 2022 at 10:06:42 PM

Add guix packages

  • Property mode set to 100644
File size: 20.2 KB
Line 
1(define-module (php)
2 #:use-module (gnu packages php)
3 #:use-module (gnu packages)
4 #:use-module (gnu packages algebra)
5 #:use-module (gnu packages aspell)
6 #:use-module (gnu packages base)
7 #:use-module (gnu packages bison)
8 #:use-module (gnu packages compression)
9 #:use-module (gnu packages crypto)
10 #:use-module (gnu packages curl)
11 #:use-module (gnu packages cyrus-sasl)
12 #:use-module (gnu packages databases)
13 #:use-module (gnu packages dbm)
14 #:use-module (gnu packages fontutils)
15 #:use-module (gnu packages gd)
16 #:use-module (gnu packages gettext)
17 #:use-module (gnu packages gnupg)
18 #:use-module (gnu packages icu4c)
19 #:use-module (gnu packages image)
20 #:use-module (gnu packages linux)
21 #:use-module (gnu packages multiprecision)
22 #:use-module (gnu packages openldap)
23 #:use-module (gnu packages pcre)
24 #:use-module (gnu packages pkg-config)
25 #:use-module (gnu packages readline)
26 #:use-module (gnu packages sqlite)
27 #:use-module (gnu packages textutils)
28 #:use-module (gnu packages tls)
29 #:use-module (gnu packages web)
30 #:use-module (gnu packages xml)
31 #:use-module (gnu packages xorg)
32 #:use-module (guix packages)
33 #:use-module (guix download)
34 #:use-module (guix build-system gnu)
35 #:use-module (guix utils)
36 #:use-module ((guix licenses) #:prefix license:))
37
38(define-public php-ampq
39 (package
40 (name "php-ampq")
41 (version "7.4.26")
42 (home-page "https://secure.php.net/")
43 (source (origin
44 (method url-fetch)
45 (uri (string-append home-page "distributions/"
46 "php-" version ".tar.xz"))
47 (sha256
48 (base32
49 "1y0f1xgfi8cks6npdhrycg8r9g3q0pikqgf5h4xafpy8znmb61g3"))
50 (patches
51 (search-patches "php-bug-74093-test.patch"
52 "php-openssl_x509_checkpurpose_basic.patch"))
53 (modules '((guix build utils)))
54 (snippet
55 '(with-directory-excursion "ext"
56 (for-each delete-file-recursively
57 ;; Some of the bundled libraries have no proper upstream.
58 ;; Ideally we'd extract these out as separate packages:
59 ;;"mbstring/libmbfl"
60 ;;"date/lib"
61 ;;"bcmath/libbcmath"
62 ;;"fileinfo/libmagic" ; a patched version of libmagic
63 '("gd/libgd"
64 "pcre/pcre2lib"
65 "xmlrpc/libxmlrpc"))))))
66 (build-system gnu-build-system)
67 (arguments
68 `(#:configure-flags
69 (let-syntax ((with (syntax-rules ()
70 ((_ option input)
71 (string-append option "="
72 (assoc-ref %build-inputs input))))))
73 (list (with "--with-bz2" "bzip2")
74 (with "--with-curl" "curl")
75 (with "--with-gdbm" "gdbm")
76 (with "--with-gettext" "libc") ; libintl.h
77 (with "--with-gmp" "gmp")
78 (with "--with-ldap" "openldap")
79 (with "--with-ldap-sasl" "cyrus-sasl")
80 (with "--with-pdo-pgsql" "postgresql")
81 (with "--with-pdo-sqlite" "sqlite")
82 (with "--with-pgsql" "postgresql")
83 ;; PHP’s Pspell extension, while retaining its current name,
84 ;; now uses the Aspell library.
85 (with "--with-pspell" "aspell")
86 (with "--with-readline" "readline")
87 (with "--with-sodium" "libsodium")
88 (with "--with-sqlite3" "sqlite")
89 (with "--with-tidy" "tidy")
90 (with "--with-xsl" "libxslt")
91 (with "--with-zlib-dir" "zlib")
92 ;; We could add "--with-snmp", but it requires netsnmp that
93 ;; we don't have a package for. It is used to build the snmp
94 ;; extension of php.
95 "--with-external-pcre"
96 "--with-external-gd"
97 "--with-ampq"
98 "--with-iconv"
99 "--with-openssl"
100 "--with-mysqli" ; Required for, e.g. wordpress
101 "--with-pdo-mysql"
102 "--with-zip"
103 "--with-zlib"
104 "--enable-bcmath" ; Required for, e.g. Zabbix frontend
105 "--enable-calendar"
106 "--enable-debug"
107 "--enable-dba=shared"
108 "--enable-exif"
109 "--enable-flatfile"
110 "--enable-fpm"
111 "--enable-ftp"
112 "--enable-gd"
113 "--enable-inifile"
114 "--enable-intl"
115 "--enable-mbstring"
116 "--enable-pcntl"
117 "--enable-sockets"))
118 #:phases
119 (modify-phases %standard-phases
120 (add-after 'unpack 'do-not-record-build-flags
121 (lambda _
122 ;; Prevent configure flags from being stored and causing
123 ;; unnecessary runtime dependencies.
124 (substitute* "scripts/php-config.in"
125 (("@CONFIGURE_OPTIONS@") "")
126 (("@PHP_LDFLAGS@") ""))
127 ;; This file has ISO-8859-1 encoding.
128 (with-fluids ((%default-port-encoding "ISO-8859-1"))
129 (substitute* "main/build-defs.h.in"
130 (("@CONFIGURE_COMMAND@") "(omitted)")))))
131 (add-before 'build 'patch-/bin/sh
132 (lambda _
133 (substitute* '("run-tests.php" "ext/standard/proc_open.c")
134 (("/bin/sh") (which "sh")))))
135 (add-before 'check 'prepare-tests
136 (lambda _
137 ;; Some of these files have ISO-8859-1 encoding, whereas others
138 ;; use ASCII, so we can't use a "catch-all" find-files here.
139 (with-fluids ((%default-port-encoding "ISO-8859-1"))
140 (substitute* '("ext/mbstring/tests/mb_send_mail02.phpt"
141 "ext/mbstring/tests/mb_send_mail04.phpt"
142 "ext/mbstring/tests/mb_send_mail05.phpt"
143 "ext/mbstring/tests/mb_send_mail06.phpt")
144 (("/bin/cat") (which "cat"))))
145 (substitute* '("ext/mbstring/tests/mb_send_mail01.phpt"
146 "ext/mbstring/tests/mb_send_mail03.phpt"
147 "ext/mbstring/tests/bug52681.phpt"
148 "ext/standard/tests/general_functions/bug34794.phpt"
149 "ext/standard/tests/general_functions/bug44667.phpt"
150 "ext/standard/tests/general_functions/proc_open.phpt")
151 (("/bin/cat") (which "cat")))
152
153 ;; The encoding of this file is not recognized, so we simply drop it.
154 (delete-file "ext/mbstring/tests/mb_send_mail07.phpt")
155
156 (substitute* "ext/standard/tests/streams/bug60602.phpt"
157 (("'ls'") (string-append "'" (which "ls") "'")))
158
159 ,@(if (string-prefix? "arm" (or (%current-system)
160 (%current-target-system)))
161 ;; Drop tests known to fail on armhf.
162 '((for-each delete-file
163 (list
164 "ext/calendar/tests/unixtojd_error1.phpt"
165 ;; arm can be a lot slower, so a time-related test fails
166 "ext/fileinfo/tests/cve-2014-3538-nojit.phpt"
167 "ext/pcntl/tests/pcntl_unshare_01.phpt"
168 "ext/pcre/tests/bug76514.phpt"
169 "ext/pcre/tests/preg_match_error3.phpt"
170 "ext/pcre/tests/cache_limit.phpt"
171 "ext/sockets/tests/socket_getopt.phpt"
172 "ext/sockets/tests/socket_sendrecvmsg_error.phpt"
173 "ext/standard/tests/general_functions/var_export-locale.phpt"
174 "ext/standard/tests/general_functions/var_export_basic1.phpt"
175 "ext/intl/tests/timezone_getErrorCodeMessage_basic.phpt"
176 "ext/intl/tests/timezone_getOffset_error.phpt"
177 "sapi/cli/tests/cli_process_title_unix.phpt"
178 "sapi/cli/tests/upload_2G.phpt"
179 "Zend/tests/concat_003.phpt")))
180 '())
181
182 ,@(if (target-ppc64le?)
183 ;; Drop tests known to fail on powerpc64le.
184 '((for-each delete-file
185 (list
186 ;; phpdbg watchpoints don't work.
187 ;; Bug tracked upstream at:
188 ;; https://bugs.php.net/bug.php?id=81408
189 "sapi/phpdbg/tests/watch_001.phpt"
190 "sapi/phpdbg/tests/watch_003.phpt"
191 "sapi/phpdbg/tests/watch_004.phpt"
192 "sapi/phpdbg/tests/watch_005.phpt"
193 "sapi/phpdbg/tests/watch_006.phpt")))
194 '())
195
196 ;; Drop tests that are known to fail.
197 (for-each delete-file
198 '("ext/posix/tests/posix_getgrgid.phpt" ; Requires /etc/group.
199 "ext/posix/tests/posix_getgrnam_basic.phpt" ; Requires /etc/group.
200 "ext/sockets/tests/bug63000.phpt" ; Fails to detect OS.
201 "ext/sockets/tests/socket_shutdown.phpt" ; Requires DNS.
202 "ext/sockets/tests/socket_send.phpt" ; Likewise.
203 "ext/sockets/tests/mcast_ipv4_recv.phpt" ; Requires multicast.
204 ;; These needs /etc/services.
205 "ext/standard/tests/general_functions/getservbyname_basic.phpt"
206 "ext/standard/tests/general_functions/getservbyport_basic.phpt"
207 "ext/standard/tests/general_functions/getservbyport_variation1.phpt"
208 ;; And /etc/protocols.
209 "ext/standard/tests/network/getprotobyname_basic.phpt"
210 "ext/standard/tests/network/getprotobynumber_basic.phpt"
211 ;; And exotic locales.
212 "ext/standard/tests/strings/setlocale_basic1.phpt"
213 "ext/standard/tests/strings/setlocale_basic2.phpt"
214 "ext/standard/tests/strings/setlocale_basic3.phpt"
215 "ext/standard/tests/strings/setlocale_variation1.phpt"
216 ;; This failing test is skipped on PHP's Travis CI as it is
217 ;; supposedly inaccurate.
218 "ext/standard/tests/file/disk_free_space_basic.phpt"
219 ;; The following test erroneously expect the link
220 ;; count of a sub-directory to increase compared to
221 ;; its parent.
222 "ext/standard/tests/file/lstat_stat_variation8.phpt"
223 ;; This tests whether microseconds ‘differ enough’ and
224 ;; fails inconsistently on ‘fast’ machines.
225 "ext/date/tests/bug73837.phpt"
226
227 ;; XXX: These gd tests fails. Likely because our version
228 ;; is different from the (patched) bundled one.
229 ;; Here, gd quits immediately after "fatal libpng error"; while the
230 ;; test expects it to additionally return a "setjmp" error and warning.
231 "ext/gd/tests/bug39780_extern.phpt"
232 "ext/gd/tests/libgd00086_extern.phpt"
233 ;; Extra newline in gd-png output.
234 "ext/gd/tests/bug45799.phpt"
235 ;; Test expects generic "gd warning" but gets the actual function name.
236 "ext/gd/tests/createfromwbmp2_extern.phpt"
237 ;; This bug should have been fixed in gd 2.2.2.
238 ;; Is it a regression?
239 "ext/gd/tests/bug65148.phpt"
240 ;; This bug should have been fixed in the gd 2.2
241 ;; series. Perhaps a regression introduced by gd
242 ;; 2.3.0?
243 "ext/gd/tests/bug66590.phpt"
244 ;; This bug should have been fixed in the php-5.5
245 ;; series. Perhaps a regression introduced by gd
246 ;; 2.3.0?
247 "ext/gd/tests/bug70102.phpt"
248 ;; This bug should have been fixed in the php-5.6
249 ;; series. Perhaps a regression introduced by gd
250 ;; 2.3.0?
251 "ext/gd/tests/bug73869.phpt"
252 ;; Some WebP related tests fail.
253 "ext/gd/tests/webp_basic.phpt"
254 "ext/gd/tests/imagecreatefromstring_webp.phpt"
255 ;; Expected error message, but from the wrong function
256 "ext/gd/tests/bug77269.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 ;; Whitespace difference, probably caused by a very
262 ;; long store path
263 "ext/gd/tests/bug77479.phpt"
264 ;; Expected invalid XBM but got EOF before image was
265 ;; complete. It's a warning in both cases and test
266 ;; result is the same.
267 "ext/gd/tests/bug77973.phpt"
268 ;; Test expects uninitialized value to be false, but
269 ;; instead gets "resource(5) of type (gd)".
270 "ext/gd/tests/bug79067.phpt"
271 ;; The following test fails with "The image size
272 ;; differs: expected 114x115, got 117x117".
273 "ext/gd/tests/bug79068.phpt"
274
275 ;; XXX: These iconv tests have the expected outcome,
276 ;; but with different error messages.
277 ;; Expects "illegal character", instead gets "unknown error (84)".
278 "ext/iconv/tests/bug52211.phpt"
279 "ext/iconv/tests/bug60494.phpt"
280 ;; Expects "wrong charset", gets unknown error (22).
281 "ext/iconv/tests/iconv_strlen_error2.phpt"
282 "ext/iconv/tests/iconv_substr_error2.phpt"
283 ;; Expects conversion error, gets "error condition Termsig=11".
284 "ext/iconv/tests/iconv_strpos_error2.phpt"
285 "ext/iconv/tests/iconv_strrpos_error2.phpt"
286 ;; Expects "invalid multibyte sequence" but got
287 ;; "unknown error".
288 "ext/iconv/tests/bug76249.phpt"
289
290 ;; XXX: These test failures appear legitimate, needs investigation.
291 ;; open_basedir() restriction failure.
292 "ext/curl/tests/bug61948-unix.phpt"
293 ;; Expects a false boolean, gets empty array from glob().
294 "ext/standard/tests/file/bug41655_1.phpt"
295 "ext/standard/tests/file/glob_variation5.phpt"
296 ;; The test expects an Array, but instead get the contents(?).
297 "ext/gd/tests/bug43073.phpt"
298 ;; imagettftext() returns wrong coordinates.
299 "ext/gd/tests/bug48732-mb.phpt"
300 "ext/gd/tests/bug48732.phpt"
301 ;; Similarly for imageftbbox().
302 "ext/gd/tests/bug48801-mb.phpt"
303 "ext/gd/tests/bug48801.phpt"
304 ;; Different expected output from imagecolorallocate().
305 "ext/gd/tests/bug53504.phpt"
306 ;; Wrong image size after scaling an image.
307 "ext/gd/tests/bug73272.phpt"
308 ;; Expects iconv to detect illegal characters, instead gets
309 ;; "unknown error (84)" and heap corruption(!).
310 "ext/iconv/tests/bug48147.phpt"
311 ;; Expects illegal character ".", gets "=?utf-8?Q?."
312 "ext/iconv/tests/bug51250.phpt"
313 ;; iconv throws "buffer length exceeded" on some string checks.
314 "ext/iconv/tests/iconv_mime_encode.phpt"
315 ;; file_get_contents(): iconv stream filter
316 ;; ("ISO-8859-1"=>"UTF-8") unknown error.
317 "ext/standard/tests/file/bug43008.phpt"
318 ;; Table data not created in sqlite(?).
319 "ext/pdo_sqlite/tests/bug_42589.phpt"
320 ;; Expects an Array with 3 preg_matches; gets 0.
321 "ext/pcre/tests/bug79846.phpt"
322 ;; Expects an empty Array; gets one with " " in it.
323 "ext/pcre/tests/bug80118.phpt"
324 ;; Renicing a process fails in the build environment.
325 "ext/standard/tests/general_functions/proc_nice_basic.phpt"
326 ;; Can fail on fast machines?
327 "Zend/tests/bug74093.phpt"))
328
329 ;; Accomodate two extra openssl errors flanking the expected one:
330 ;; random number generator:RAND_{load,write}_file:Cannot open file
331 ;; This is due to an invalid $HOME, but changing it in the test
332 ;; still prints the first one & changing it globally is overkill.
333 (substitute* "ext/openssl/tests/bug80747.phpt"
334 ((".*error:%s:key size too small.*" match)
335 (string-append "%s\n" match "%s\n")))
336
337 ;; Skip tests requiring network access.
338 (setenv "SKIP_ONLINE_TESTS" "1")
339 ;; Without this variable, 'make test' passes regardless of failures.
340 (setenv "REPORT_EXIT_STATUS" "1")
341 ;; Skip tests requiring I/O facilities that are unavailable in the
342 ;; build environment
343 (setenv "SKIP_IO_CAPTURE_TESTS" "1"))))
344 #:test-target "test"))
345 (inputs
346 `(("aspell" ,aspell)
347 ("bzip2" ,bzip2)
348 ("curl" ,curl)
349 ("cyrus-sasl" ,cyrus-sasl)
350 ("gd" ,gd)
351 ("gdbm" ,gdbm)
352 ("gmp" ,gmp)
353 ("gnutls" ,gnutls)
354 ("icu4c" ,icu4c)
355 ("libgcrypt" ,libgcrypt)
356 ("libpng" ,libpng)
357 ("libsodium" ,libsodium)
358 ("libxml2" ,libxml2)
359 ("libxslt" ,libxslt)
360 ("libx11" ,libx11)
361 ("libzip" ,libzip)
362 ("oniguruma" ,oniguruma)
363 ("openldap" ,openldap)
364 ("openssl" ,openssl)
365 ("pcre" ,pcre2)
366 ("postgresql" ,postgresql)
367 ("readline" ,readline)
368 ("sqlite" ,sqlite)
369 ("tidy" ,tidy)
370 ("zlib" ,zlib)))
371 (native-inputs
372 `(("pkg-config" ,pkg-config)
373 ("bison" ,bison)
374 ("gettext" ,gettext-minimal)
375 ("procps" ,procps))) ; for tests
376 (synopsis "PHP programming language")
377 (description
378 "PHP (PHP Hypertext Processor) is a server-side (CGI) scripting
379language designed primarily for web development but is also used as
380a general-purpose programming language. PHP code may be embedded into
381HTML code, or it can be used in combination with various web template
382systems, web content management systems and web frameworks." )
383 (license (list
384 (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
Note: See TracBrowser for help on using the repository browser.