git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #91511 from Ma27/php-darwin

php7{2,3}: fix darwin build

commit7cf88f71140a857c671c951d1a316405d5f247f7 authorElis Hirwing <elis@hirwing.se> dateFri 26 Jun 2020, 21:31 (6 years ago) parentc5acc7faf064a0
3 files changed+61−3
pkgs/development/interpreters/php/default.nix+7−3 pkgs/development/interpreters/php/zlib-darwin-tests.patch+44 pkgs/top-level/php-packages.nix+10
pkgs/development/interpreters/php/default.nix+7−3
@@ -8,7 +8,7 @@ let
88 { callPackage, lib, stdenv, nixosTests, config, fetchurl, makeWrapper
99 , symlinkJoin, writeText, autoconf, automake, bison, flex, libtool
1010 , pkgconfig, re2c, apacheHttpd, libargon2, libxml2, pcre, pcre2
11− , systemd, valgrind
11+ , systemd, valgrind, xcbuild
1212
1313 , version
1414 , sha256
@@ -143,7 +143,8 @@ let
143143
144144 enableParallelBuilding = true;
145145
146− nativeBuildInputs = [ autoconf automake bison flex libtool pkgconfig re2c ];
146+ nativeBuildInputs = [ autoconf automake bison flex libtool pkgconfig re2c ]
147+ ++ lib.optional stdenv.isDarwin xcbuild;
147148
148149 buildInputs =
149150 # PCRE extension
@@ -177,7 +178,10 @@ let
177178 ++ lib.optional (!cliSupport) "--disable-cli"
178179 ++ lib.optional fpmSupport "--enable-fpm"
179180 ++ lib.optional pearSupport [ "--with-pear=$(out)/lib/php/pear" "--enable-xml" "--with-libxml" ]
180− ++ lib.optional (pearSupport && (lib.versionOlder version "7.4")) "--enable-libxml"
181+ ++ lib.optionals (pearSupport && (lib.versionOlder version "7.4")) [
182+ "--enable-libxml"
183+ "--with-libxml-dir=${libxml2.dev}"
184+ ]
181185 ++ lib.optional pharSupport "--enable-phar"
182186 ++ lib.optional phpdbgSupport "--enable-phpdbg"
183187
pkgs/development/interpreters/php/zlib-darwin-tests.patchnew file+44
@@ -0,0 +1,44 @@
1+diff --git a/ext/zlib/tests/bug55544.phpt b/ext/zlib/tests/bug55544.phpt
2+index a0d22f4fcebf4846da6781f424f87821626de5ea..e650fe6909f555d04834f4c08f7fd0d354b783e2 100644
3+--- a/ext/zlib/tests/bug55544.phpt
4++++ b/ext/zlib/tests/bug55544.phpt
5+@@ -6,6 +6,9 @@ extension_loaded("zlib") or die("skip");
6+ if (substr(PHP_OS, 0, 3) == 'WIN') {
7+ die("skip not for windows");
8+ }
9++if (PHP_OS == "Darwin") {
10++ die("skip not for darwin");
11++}
12+ ?>
13+ --INI--
14+ output_handler=ob_gzhandler
15+diff --git a/ext/zlib/tests/gzencode_variation1.phpt b/ext/zlib/tests/gzencode_variation1.phpt
16+index c966b2cbc5b7..2f953168fa22 100644
17+--- a/ext/zlib/tests/gzencode_variation1.phpt
18++++ b/ext/zlib/tests/gzencode_variation1.phpt
19+@@ -10,6 +10,10 @@ if( substr(PHP_OS, 0, 3) == "WIN" ) {
20+ if (!extension_loaded("zlib")) {
21+ print "skip - ZLIB extension not loaded";
22+ }
23++
24++if (PHP_OS == "Darwin") {
25++ print "skip - OS is encoded in headers, tested header is non Darwin";
26++}
27+ ?>
28+ --FILE--
29+ <?php
30+diff --git a/ext/zlib/tests/gzencode_variation2.phpt b/ext/zlib/tests/gzencode_variation2.phpt
31+index 94ac42a5f1cd..9160cf519751 100644
32+--- a/ext/zlib/tests/gzencode_variation2.phpt
33++++ b/ext/zlib/tests/gzencode_variation2.phpt
34+@@ -10,6 +10,10 @@ if( substr(PHP_OS, 0, 3) == "WIN" ) {
35+ if (!extension_loaded("zlib")) {
36+ print "skip - ZLIB extension not loaded";
37+ }
38++
39++if (PHP_OS == "Darwin") {
40++ print "skip - OS is encoded in headers, tested header is non Darwin";
41++}
42+ ?>
43+ --FILE--
44+ <?php
pkgs/top-level/php-packages.nix+10
@@ -947,6 +947,12 @@ in
947947 enable = lib.versionOlder php.version "7.4"; }
948948 { name = "gettext";
949949 buildInputs = [ gettext ];
950+ patches = lib.optionals (lib.versionOlder php.version "7.4") [
951+ (fetchpatch {
952+ url = "https://github.com/php/php-src/commit/632b6e7aac207194adc3d0b41615bfb610757f41.patch";
953+ sha256 = "0xn3ivhc4p070vbk5yx0mzj2n7p04drz3f98i77amr51w0vzv046";
954+ })
955+ ];
950956 postPhpize = ''substituteInPlace configure --replace 'as_fn_error $? "Cannot locate header file libintl.h" "$LINENO" 5' ':' '';
951957 configureFlags = "--with-gettext=${gettext}"; }
952958 { name = "gmp";
@@ -1163,6 +1169,10 @@ in
11631169 doCheck = false; }
11641170 { name = "zlib";
11651171 buildInputs = [ zlib ];
1172+ patches = lib.optionals (lib.versionOlder php.version "7.4") [
1173+ # Derived from https://github.com/php/php-src/commit/f16b012116d6c015632741a3caada5b30ef8a699
1174+ ../development/interpreters/php/zlib-darwin-tests.patch
1175+ ];
11661176 configureFlags = [ "--with-zlib" ]
11671177 ++ lib.optional (lib.versionOlder php.version "7.4") [ "--with-zlib-dir=${zlib.dev}" ]; }
11681178 ];