Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchurl,
5 pkg-config,
6 autoreconfHook,
7 libxml2,
8 findXMLCatalogs,
9 gettext,
10 python3,
11 ncurses,
12 libgcrypt,
13 cryptoSupport ? false,
14 pythonSupport ? libxml2.pythonSupport,
15 gnome,
16}:
17
18stdenv.mkDerivation (finalAttrs: {
19 pname = "libxslt";
20 version = "1.1.43";
21
22 outputs = [
23 "bin"
24 "dev"
25 "out"
26 "doc"
27 "devdoc"
28 ]
29 ++ lib.optional pythonSupport "py";
30 outputMan = "bin";
31
32 src = fetchurl {
33 url = "mirror://gnome/sources/libxslt/${lib.versions.majorMinor finalAttrs.version}/libxslt-${finalAttrs.version}.tar.xz";
34 hash = "sha256-Wj1rODylr8I1sXERjpD1/2qifp/qMwMGUjGm1APwGDo=";
35 };
36
37 patches = [
38 # Fix use-after-free with key data stored cross-RVT
39 # https://gitlab.gnome.org/GNOME/libxslt/-/issues/144
40 # Source: https://gitlab.gnome.org/GNOME/libxslt/-/merge_requests/77
41 ./77-Use-a-dedicated-node-type-to-maintain-the-list-of-cached-rv-ts.patch
42
43 # Fix type confusion in xmlNode.psvi between stylesheet and source nodes
44 # https://gitlab.gnome.org/GNOME/libxslt/-/issues/139
45 # Fix heap-use-after-free in xmlFreeID caused by `atype` corruption
46 # https://gitlab.gnome.org/GNOME/libxslt/-/issues/140
47 #
48 # Depends on unmerged libxml2 patch that breaks ABI.
49 #
50 # Source: https://github.com/chromium/chromium/blob/4fb4ae8ce3daa399c3d8ca67f2dfb9deffcc7007/third_party/libxslt/chromium/new-unified-atype-extra.patch
51 ./new-unified-atype-extra.patch
52 ];
53
54 strictDeps = true;
55
56 nativeBuildInputs = [
57 pkg-config
58 autoreconfHook
59 ];
60
61 buildInputs = [
62 libxml2.dev
63 ]
64 ++ lib.optionals stdenv.hostPlatform.isDarwin [
65 gettext
66 ]
67 ++ lib.optionals pythonSupport [
68 libxml2.py
69 python3
70 ncurses
71 ]
72 ++ lib.optionals cryptoSupport [
73 libgcrypt
74 ];
75
76 propagatedBuildInputs = [
77 findXMLCatalogs
78 ];
79
80 configureFlags = [
81 (lib.withFeature pythonSupport "python")
82 (lib.optionalString pythonSupport "PYTHON=${python3.pythonOnBuildForHost.interpreter}")
83 (lib.withFeature cryptoSupport "crypto")
84 ];
85
86 enableParallelBuilding = true;
87
88 postFixup = ''
89 moveToOutput bin/xslt-config "$dev"
90 moveToOutput lib/xsltConf.sh "$dev"
91 ''
92 + lib.optionalString pythonSupport ''
93 mkdir -p $py/nix-support
94 echo ${libxml2.py} >> $py/nix-support/propagated-build-inputs
95 moveToOutput ${python3.sitePackages} "$py"
96 '';
97
98 passthru = {
99 inherit pythonSupport;
100
101 updateScript = gnome.updateScript {
102 packageName = "libxslt";
103 versionPolicy = "none";
104 };
105 };
106
107 meta = with lib; {
108 homepage = "https://gitlab.gnome.org/GNOME/libxslt";
109 description = "C library and tools to do XSL transformations";
110 license = licenses.mit;
111 platforms = platforms.all;
112 maintainers = with maintainers; [ jtojnar ];
113 broken = pythonSupport && !libxml2.pythonSupport; # see #73102 for why this is not an assert
114 };
115})