Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php: add libxml 2.11.6 for PHP <= 8.0 #390

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 73 additions & 0 deletions pkgs/libxml2/2.11.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
stdenv,
lib,
fetchurl,
pkg-config,
autoreconfHook,
findXMLCatalogs,
libiconv,
icuSupport ? false,
icu,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "libxml2";
version = "2.11.6";

outputs = [
"bin"
"dev"
"out"
];
outputMan = "bin";

src = fetchurl {
url = "mirror://gnome/sources/libxml2/${lib.versions.majorMinor finalAttrs.version}/libxml2-${finalAttrs.version}.tar.xz";
hash = "sha256-yQ7udQZ2Srvge7YWuC2kUlKWCYFa7+9CPWbvCA6wwwA=";
};

strictDeps = true;

nativeBuildInputs = [
pkg-config
autoreconfHook
];

propagatedBuildInputs = [
findXMLCatalogs
] ++ lib.optionals stdenv.isDarwin [ libiconv ] ++ lib.optionals icuSupport [ icu ];

configureFlags = [
"--exec-prefix=${placeholder "dev"}"
(lib.withFeature icuSupport "icu")
"--without-python"
];

enableParallelBuilding = true;

doCheck = (stdenv.hostPlatform == stdenv.buildPlatform) && stdenv.hostPlatform.libc != "musl";
preCheck = lib.optional stdenv.isDarwin ''
export DYLD_LIBRARY_PATH="$PWD/.libs:$DYLD_LIBRARY_PATH"
'';

preConfigure = lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") ''
MACOSX_DEPLOYMENT_TARGET=10.16
'';

postFixup = ''
moveToOutput bin/xml2-config "$dev"
moveToOutput lib/xml2Conf.sh "$dev"
'';

meta = with lib; {
homepage = "https://gitlab.gnome.org/GNOME/libxml2";
description = "XML parsing library for C";
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [
eelco
jtojnar
];
pkgConfigModules = [ "libxml-2.0" ];
};
})
36 changes: 25 additions & 11 deletions pkgs/package-overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -298,17 +298,31 @@ in
else
prev.extensions.igbinary;

imap =
if lib.versionOlder prev.php.version "8.1" && pkgs.stdenv.cc.isClang then
prev.extensions.imap.overrideAttrs (attrs: {
patches = (attrs.patches or [ ]) ++ [
(pkgs.fetchpatch {
url = "https://github.com/php/php-src/commit/f9cbeaa0338520f6c4a4b17555f558634b0dd955.patch";
hash = "sha256-Gzxsh99e0HIrDz6r+9XWUw1BQLKWuRm8RQq9p0KxBVs=";
})
];
})
else prev.extensions.imap;
imap = prev.extensions.imap.overrideAttrs (attrs: {
patches =
if lib.versionOlder prev.php.version "8.1" && pkgs.stdenv.cc.isClang then
(
(attrs.patches or [ ])
++ [
(pkgs.fetchpatch {
url = "https://github.com/php/php-src/commit/f9cbeaa0338520f6c4a4b17555f558634b0dd955.patch";
hash = "sha256-Gzxsh99e0HIrDz6r+9XWUw1BQLKWuRm8RQq9p0KxBVs=";
})
]
)
else
(attrs.patches or [ ]);

postPatch =
if lib.versionOlder prev.php.version "8.1" then
attrs.postPatch or ""
+ ''
rm ext/imap/tests/imap_mutf7_to_utf8.phpt
rm ext/imap/tests/imap_utf8_to_mutf7_basic.phpt
''
else
(attrs.postPatch or "");
});

inotify =
if lib.versionOlder prev.php.version "7.0" then
Expand Down
10 changes: 7 additions & 3 deletions pkgs/phps.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@ let
packageOverrides = import ./package-overrides.nix prev;

libxml2_12 = prev.callPackage ./libxml2/2.12.nix { };
libxml2_11 = prev.callPackage ./libxml2/2.11.nix { };

_mkArgs =
args:

let
libxml2 =
if prev.lib.versionAtLeast args.version "8.1"
then prev.libxml2
else libxml2_12;
if prev.lib.versionAtLeast args.version "8.1" then
prev.libxml2
else if prev.lib.versionAtLeast args.version "5.6" then
libxml2_11
else
libxml2_12;

# Use a consistent libxml2 version.
libxslt = prev.libxslt.override { inherit libxml2; };
Expand Down
Loading