Skip to content

Commit 1a3af48

Browse files
committed
wip: try to fix it
1 parent 55c8f33 commit 1a3af48

File tree

2 files changed

+96
-51
lines changed

2 files changed

+96
-51
lines changed

pkgs/package-overrides.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ in
147147
rm ext/dom/tests/bug43364.phpt
148148
'')
149149

150-
(lib.optionalString (lib.versionOlder prev.php.version "8.1" && lib.versionAtLeast prev.php.version "7.1") ''
150+
(lib.optionalString (lib.versionOlder prev.php.version "8.4" && lib.versionAtLeast prev.php.version "7.1") ''
151151
# Removing tests failing with libxml2 (2.11.4) > 2.10.4
152152
rm ext/dom/tests/DOMDocument_loadXML_error2.phpt
153153
rm ext/dom/tests/DOMDocument_load_error2.phpt

pkgs/phps.nix

Lines changed: 95 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,56 @@ let
137137

138138
generic = "${nixpkgs}/pkgs/development/interpreters/php/generic.nix";
139139
mkPhp = args: prev.callPackage generic (_mkArgs args);
140+
141+
base-master = prev.callPackage generic (_mkArgs {
142+
version =
143+
let
144+
configureFile = "${php-src}/configure.ac";
145+
146+
extractVersionFromConfigureAc =
147+
configureText:
148+
149+
let
150+
match = builtins.match ".*AC_INIT\\(\\[PHP],\\[([^]-]+)(-dev)?].*" configureText;
151+
in
152+
if match != null
153+
then builtins.head match
154+
else null;
155+
156+
extractVersionFromConfigureAcPre74 =
157+
configureText:
158+
159+
let
160+
match = builtins.match ".*PHP_MAJOR_VERSION=([0-9]+)\nPHP_MINOR_VERSION=([0-9]+)\nPHP_RELEASE_VERSION=([0-9]+)\n.*" configureText;
161+
in
162+
if match != null
163+
then prev.lib.concatMapStringsSep "." builtins.toString match
164+
else null;
165+
166+
version =
167+
let
168+
configureText = builtins.readFile configureFile;
169+
version = extractVersionFromConfigureAc configureText;
170+
versionPre74 = extractVersionFromConfigureAcPre74 configureText;
171+
172+
versionCandidates = prev.lib.optionals (builtins.pathExists configureFile) [
173+
version
174+
versionPre74
175+
];
176+
in
177+
prev.lib.findFirst (version: version != null) "0.0.0+unknown" versionCandidates;
178+
in
179+
"${version}.pre+date=${php-src.lastModifiedDate}";
180+
hash = null;
181+
182+
phpAttrsOverrides = attrs: {
183+
src = php-src;
184+
configureFlags = attrs.configureFlags ++ [
185+
# install-pear-nozlib.phar (normally shipped in tarball) would need to be downloaded.
186+
"--without-pear"
187+
];
188+
};
189+
});
140190
in
141191
{
142192
php56 = import ./php/5.6.nix { inherit prev mkPhp; };
@@ -165,55 +215,50 @@ in
165215
inherit packageOverrides;
166216
};
167217

168-
php-master = base-master.withExtensions (
169-
{ all, ... }:
170-
171-
with all; (
172-
[
173-
bcmath
174-
calendar
175-
curl
176-
ctype
177-
dom
178-
exif
179-
fileinfo
180-
filter
181-
ftp
182-
gd
183-
gettext
184-
gmp
185-
iconv
186-
intl
187-
ldap
188-
mbstring
189-
mysqli
190-
mysqlnd
191-
opcache
192-
openssl
193-
pcntl
194-
pdo
195-
pdo_mysql
196-
pdo_odbc
197-
pdo_pgsql
198-
pdo_sqlite
199-
pgsql
200-
posix
201-
readline
202-
session
203-
simplexml
204-
sockets
205-
soap
206-
sodium
207-
sqlite3
208-
tokenizer
209-
xmlreader
210-
xmlwriter
211-
zip
212-
zlib
213-
]
214-
++ prev.lib.optionals (!prev.stdenv.isDarwin) [
215-
imap
216-
]
217-
)
218+
php-master = base-master.withExtensions ( { all, ... }:
219+
with all; [
220+
bcmath
221+
calendar
222+
curl
223+
ctype
224+
dom
225+
exif
226+
fileinfo
227+
filter
228+
ftp
229+
gd
230+
gettext
231+
gmp
232+
iconv
233+
imap
234+
intl
235+
ldap
236+
mbstring
237+
mysqli
238+
mysqlnd
239+
opcache
240+
openssl
241+
pcntl
242+
pdo
243+
pdo_mysql
244+
pdo_odbc
245+
pdo_pgsql
246+
pdo_sqlite
247+
pgsql
248+
posix
249+
readline
250+
session
251+
simplexml
252+
sockets
253+
soap
254+
sodium
255+
sysvsem
256+
sqlite3
257+
tokenizer
258+
xmlreader
259+
xmlwriter
260+
zip
261+
zlib
262+
]
218263
);
219264
}

0 commit comments

Comments
 (0)