diff --git a/flake.lock b/flake.lock index f18d7df0..3b51c7b3 100644 --- a/flake.lock +++ b/flake.lock @@ -18,11 +18,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1719468428, - "narHash": "sha256-vN5xJAZ4UGREEglh3lfbbkIj+MPEYMuqewMn4atZFaQ=", + "lastModified": 1724657323, + "narHash": "sha256-LxemfQkxQ74IaXo2BJdFVjGou9/Vvw2Mj0qO3uakwUM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1e3deb3d8a86a870d925760db1a5adecc64d329d", + "rev": "e75de2f317616a27adec8ef2821d93bf3749fcd0", "type": "github" }, "original": { diff --git a/pkgs/libxml2/2.12.nix b/pkgs/libxml2/2.12.nix new file mode 100644 index 00000000..eed62982 --- /dev/null +++ b/pkgs/libxml2/2.12.nix @@ -0,0 +1,71 @@ +{ 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" ]; + }; +}) diff --git a/pkgs/phps.nix b/pkgs/phps.nix index 36739d53..49f6c27d 100644 --- a/pkgs/phps.nix +++ b/pkgs/phps.nix @@ -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: @@ -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. @@ -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: @@ -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 = @@ -117,7 +127,7 @@ let prev.lib.makeScope prev.newScope (self: { - inherit pcre2; + inherit libxml2 libxslt pcre2; }) ); }