Skip to content

Commit

Permalink
restore parts that were removed erroneously
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Sep 7, 2023
1 parent a7a250f commit 69168c3
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 69 deletions.
2 changes: 1 addition & 1 deletion pkgs/package-overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ in
rm ext/dom/tests/bug43364.phpt
'')

(lib.optionalString (lib.versionOlder prev.php.version "8.1" && lib.versionAtLeast prev.php.version "7.1") ''
(lib.optionalString (lib.versionOlder prev.php.version "8.4" && lib.versionAtLeast prev.php.version "7.1") ''
# Removing tests failing with libxml2 (2.11.4) > 2.10.4
rm ext/dom/tests/DOMDocument_loadXML_error2.phpt
rm ext/dom/tests/DOMDocument_load_error2.phpt
Expand Down
67 changes: 0 additions & 67 deletions pkgs/php/php-master.nix

This file was deleted.

97 changes: 96 additions & 1 deletion pkgs/phps.nix
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,56 @@ let

generic = "${nixpkgs}/pkgs/development/interpreters/php/generic.nix";
mkPhp = args: prev.callPackage generic (_mkArgs args);

base-master = prev.callPackage generic (_mkArgs {
version =
let
configureFile = "${php-src}/configure.ac";

extractVersionFromConfigureAc =
configureText:

let
match = builtins.match ".*AC_INIT\\(\\[PHP],\\[([^]-]+)(-dev)?].*" configureText;
in
if match != null
then builtins.head match
else null;

extractVersionFromConfigureAcPre74 =
configureText:

let
match = builtins.match ".*PHP_MAJOR_VERSION=([0-9]+)\nPHP_MINOR_VERSION=([0-9]+)\nPHP_RELEASE_VERSION=([0-9]+)\n.*" configureText;
in
if match != null
then prev.lib.concatMapStringsSep "." builtins.toString match
else null;

version =
let
configureText = builtins.readFile configureFile;
version = extractVersionFromConfigureAc configureText;
versionPre74 = extractVersionFromConfigureAcPre74 configureText;

versionCandidates = prev.lib.optionals (builtins.pathExists configureFile) [
version
versionPre74
];
in
prev.lib.findFirst (version: version != null) "0.0.0+unknown" versionCandidates;
in
"${version}.pre+date=${php-src.lastModifiedDate}";
hash = null;

phpAttrsOverrides = attrs: {
src = php-src;
configureFlags = attrs.configureFlags ++ [
# install-pear-nozlib.phar (normally shipped in tarball) would need to be downloaded.
"--without-pear"
];
};
});
in
{
php56 = import ./php/5.6.nix { inherit prev mkPhp; };
Expand Down Expand Up @@ -165,5 +215,50 @@ in
inherit packageOverrides;
};

php-master = import ./php/php-master.nix { inherit prev mkPhp; };
php-master = base-master.withExtensions ( { all, ... }:
with all; [
bcmath
calendar
curl
ctype
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
iconv
imap
intl
ldap
mbstring
mysqli
mysqlnd
opcache
openssl
pcntl
pdo
pdo_mysql
pdo_odbc
pdo_pgsql
pdo_sqlite
pgsql
posix
readline
session
simplexml
sockets
soap
sodium
sysvsem
sqlite3
tokenizer
xmlreader
xmlwriter
zip
zlib
]
);
}

0 comments on commit 69168c3

Please sign in to comment.