Skip to content

Commit

Permalink
fix: add libxml 2.11.6 for builds under PHP 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Jan 13, 2025
1 parent df13e72 commit a1ff542
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 3 deletions.
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" ];
};
})
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 "8.0" then
libxml2_11
else
libxml2_12;

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

0 comments on commit a1ff542

Please sign in to comment.