2022-02-20 14:26:51 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchurl
|
|
|
|
, zlib
|
2022-02-20 15:27:19 +00:00
|
|
|
, pkg-config
|
|
|
|
, autoreconfHook
|
2022-02-20 14:26:51 +00:00
|
|
|
, xz
|
|
|
|
, libintl
|
|
|
|
, python
|
|
|
|
, gettext
|
|
|
|
, ncurses
|
|
|
|
, findXMLCatalogs
|
2021-09-14 18:03:44 +00:00
|
|
|
, libiconv
|
2020-12-20 06:11:26 +00:00
|
|
|
, pythonSupport ? enableShared && stdenv.buildPlatform == stdenv.hostPlatform
|
2022-02-20 14:26:51 +00:00
|
|
|
, icuSupport ? false
|
2022-02-20 15:32:14 +00:00
|
|
|
, icu
|
2021-08-07 12:00:00 +00:00
|
|
|
, enableShared ? stdenv.hostPlatform.libc != "msvcrt" && !stdenv.hostPlatform.isStatic
|
2021-02-18 13:11:19 +00:00
|
|
|
, enableStatic ? !enableShared
|
2022-02-20 14:31:43 +00:00
|
|
|
, gnome
|
2017-02-11 04:48:28 +00:00
|
|
|
}:
|
2013-11-11 21:30:34 +00:00
|
|
|
|
2019-06-15 18:32:23 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "libxml2";
|
2022-02-20 14:35:53 +00:00
|
|
|
version = "2.9.13";
|
2006-10-12 15:43:01 +00:00
|
|
|
|
2022-02-20 14:26:51 +00:00
|
|
|
outputs = [ "bin" "dev" "out" "man" "doc" ]
|
|
|
|
++ lib.optional pythonSupport "py"
|
|
|
|
++ lib.optional (enableStatic && enableShared) "static";
|
|
|
|
|
2006-10-12 15:43:01 +00:00
|
|
|
src = fetchurl {
|
2022-02-20 14:31:43 +00:00
|
|
|
url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
|
2022-02-20 14:35:53 +00:00
|
|
|
sha256 = "J2EwYC0S/khOzANEfuXnWdBGVVj7yda9FE43RTBuvw4=";
|
2006-10-12 15:43:01 +00:00
|
|
|
};
|
2022-02-20 14:26:51 +00:00
|
|
|
|
2019-11-01 00:00:56 +00:00
|
|
|
patches = [
|
|
|
|
# Upstream bugs:
|
|
|
|
# https://bugzilla.gnome.org/show_bug.cgi?id=789714
|
|
|
|
# https://gitlab.gnome.org/GNOME/libxml2/issues/64
|
|
|
|
# Patch from https://bugzilla.opensuse.org/show_bug.cgi?id=1065270 ,
|
|
|
|
# but only the UTF-8 part.
|
|
|
|
# Can also be mitigated by fixing malformed XML inputs, such as in
|
|
|
|
# https://gitlab.gnome.org/GNOME/gnumeric/merge_requests/3 .
|
|
|
|
# Other discussion:
|
|
|
|
# https://github.com/itstool/itstool/issues/22
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/63174
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/72342
|
|
|
|
./utf8-xmlErrorFuncHandler.patch
|
|
|
|
];
|
2006-10-12 15:43:01 +00:00
|
|
|
|
2021-08-11 12:00:00 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2022-02-20 15:27:19 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
autoreconfHook
|
|
|
|
];
|
|
|
|
|
2022-02-20 14:26:51 +00:00
|
|
|
buildInputs = lib.optionals pythonSupport [
|
|
|
|
python
|
|
|
|
] ++ lib.optionals (pythonSupport && python?isPy2 && python.isPy2) [
|
|
|
|
gettext
|
|
|
|
] ++ lib.optionals (pythonSupport && python?isPy3 && python.isPy3) [
|
|
|
|
ncurses
|
|
|
|
] ++ lib.optionals (stdenv.isDarwin && pythonSupport && python?isPy2 && python.isPy2) [
|
|
|
|
libintl
|
|
|
|
] ++ lib.optionals stdenv.isFreeBSD [
|
2015-06-01 19:38:03 +00:00
|
|
|
# Libxml2 has an optional dependency on liblzma. However, on impure
|
|
|
|
# platforms, it may end up using that from /usr/lib, and thus lack a
|
|
|
|
# RUNPATH for that, leading to undefined references for its users.
|
2022-02-20 14:26:51 +00:00
|
|
|
xz
|
|
|
|
];
|
2015-06-01 19:38:03 +00:00
|
|
|
|
2022-02-20 14:26:51 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
zlib
|
|
|
|
findXMLCatalogs
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
libiconv
|
|
|
|
] ++ lib.optionals icuSupport [
|
|
|
|
icu
|
|
|
|
];
|
2009-02-03 16:14:23 +00:00
|
|
|
|
2018-07-25 00:13:43 +00:00
|
|
|
configureFlags = [
|
2022-02-20 16:36:34 +00:00
|
|
|
"--exec-prefix=${placeholder "dev"}"
|
2018-07-25 00:13:43 +00:00
|
|
|
(lib.enableFeature enableStatic "static")
|
|
|
|
(lib.enableFeature enableShared "shared")
|
|
|
|
(lib.withFeature icuSupport "icu")
|
|
|
|
(lib.withFeatureAs pythonSupport "python" python)
|
|
|
|
];
|
2006-10-12 15:43:01 +00:00
|
|
|
|
2022-02-20 14:26:51 +00:00
|
|
|
installFlags = lib.optionals pythonSupport [
|
2022-02-20 15:32:14 +00:00
|
|
|
"pythondir=\"${placeholder "py"}/${python.sitePackages}\""
|
2022-02-20 14:26:51 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
doCheck =
|
|
|
|
(stdenv.hostPlatform == stdenv.buildPlatform) &&
|
|
|
|
!stdenv.isDarwin &&
|
|
|
|
stdenv.hostPlatform.libc != "musl";
|
|
|
|
|
2021-02-18 13:11:19 +00:00
|
|
|
preConfigure = lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") ''
|
|
|
|
MACOSX_DEPLOYMENT_TARGET=10.16
|
|
|
|
'';
|
|
|
|
|
2022-02-20 15:32:14 +00:00
|
|
|
preInstall = lib.optionalString pythonSupport ''
|
2022-02-20 14:35:53 +00:00
|
|
|
substituteInPlace python/libxml2mod.la --replace "$dev/${python.sitePackages}" "$py/${python.sitePackages}"
|
2022-02-20 15:32:14 +00:00
|
|
|
'';
|
2015-10-05 11:23:01 +00:00
|
|
|
|
|
|
|
postFixup = ''
|
2015-12-02 09:03:23 +00:00
|
|
|
moveToOutput bin/xml2-config "$dev"
|
|
|
|
moveToOutput lib/xml2Conf.sh "$dev"
|
|
|
|
moveToOutput share/man/man1 "$bin"
|
2018-11-10 19:47:09 +00:00
|
|
|
'' + lib.optionalString (enableStatic && enableShared) ''
|
2018-06-22 15:44:05 +00:00
|
|
|
moveToOutput lib/libxml2.a "$static"
|
2015-10-05 11:23:01 +00:00
|
|
|
'';
|
|
|
|
|
2022-02-20 14:26:51 +00:00
|
|
|
passthru = {
|
|
|
|
inherit version;
|
|
|
|
pythonSupport = pythonSupport;
|
2022-02-20 14:31:43 +00:00
|
|
|
|
|
|
|
updateScript = gnome.updateScript {
|
|
|
|
packageName = pname;
|
|
|
|
versionPolicy = "none";
|
|
|
|
};
|
2022-02-20 14:26:51 +00:00
|
|
|
};
|
2015-10-05 11:23:01 +00:00
|
|
|
|
2022-02-20 14:26:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "http://xmlsoft.org/";
|
2022-02-20 14:26:51 +00:00
|
|
|
description = "XML parsing library for C";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.all;
|
2022-02-20 14:38:00 +00:00
|
|
|
maintainers = with maintainers; [ eelco jtojnar ];
|
2009-02-03 16:14:23 +00:00
|
|
|
};
|
2015-10-05 11:23:01 +00:00
|
|
|
}
|