Skip to content

Commit

Permalink
flake.lock: Update
Browse files Browse the repository at this point in the history
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/1e3deb3d8a86a870d925760db1a5adecc64d329d' (2024-06-27)
  → 'github:NixOS/nixpkgs/79ed718bf5fa685c44ed4607c314527ff832e53f' (2024-08-26)

Upgrades libxml2 to 2.13, which includes some breaking changes.
Since fixing them in older PHP versions would require extensive patching,
let’s just pin the EOL PHP versions to a vendored libxml2 2.12.
And because we just use it for PHP, we pare the libxml2 package down a bit
(e.g. no Python or static support).
  • Loading branch information
jtojnar committed Aug 26, 2024
1 parent de42b22 commit 521034f
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 8 deletions.
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.12.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.12.9";

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-WZEttTarVqOZZInqApl2jHvP/lcWnwI15/liqR9INZA=";
};

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" ];
};
})
20 changes: 15 additions & 5 deletions pkgs/phps.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,27 @@ prev:
let
packageOverrides = import ./package-overrides.nix prev;

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

_mkArgs =
args:

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

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

pcre2 =
if prev.lib.versionAtLeast args.version "7.3"
then prev.pcre2
else prev.pcre;
in
{
inherit packageOverrides pcre2;
inherit packageOverrides libxml2 pcre2;

phpAttrsOverrides =
attrs:
Expand Down Expand Up @@ -58,7 +68,7 @@ let
"--enable-hash"

"--enable-libxml"
"--with-libxml-dir=${prev.libxml2.dev}"
"--with-libxml-dir=${libxml2.dev}"
]
++ prev.lib.optionals (prev.lib.versions.majorMinor args.version == "7.3") [
# Force use of pkg-config.
Expand Down Expand Up @@ -98,7 +108,7 @@ let
+ prev.lib.optionalString (prev.lib.versionAtLeast args.version "7.3" && prev.lib.versionOlder args.version "7.4") " -Wno-int-conversion";
};

# For passing pcre2 to php-packages.nix.
# For passing libxml2 and pcre2 to php-packages.nix.
callPackage =
cpFn:
cpArgs:
Expand All @@ -108,7 +118,7 @@ let

# Only pass these attributes if the package function actually expects them.
prev.lib.filterAttrs (key: _v: builtins.hasAttr key prevArgs) {
inherit pcre2;
inherit libxml2 libxslt pcre2;

# For passing pcre2 to stuff called with callPackage in php-packages.nix.
pkgs =
Expand All @@ -117,7 +127,7 @@ let
prev.lib.makeScope
prev.newScope
(self: {
inherit pcre2;
inherit libxml2 libxslt pcre2;
})
);
}
Expand Down

0 comments on commit 521034f

Please sign in to comment.