lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 23.05-pre 158 lines 4.7 kB view raw
1{ stdenv 2, lib 3, fetchurl 4, zlib 5, pkg-config 6, autoreconfHook 7, xz 8, libintl 9, python 10, gettext 11, ncurses 12, findXMLCatalogs 13, libiconv 14, pythonSupport ? enableShared 15, icuSupport ? false 16, icu 17, enableShared ? stdenv.hostPlatform.libc != "msvcrt" && !stdenv.hostPlatform.isStatic 18, enableStatic ? !enableShared 19, gnome 20}: 21 22let 23 # Newer versions fail with minimal python, probably because 24 # https://gitlab.gnome.org/GNOME/libxml2/-/commit/b706824b612adb2c8255819c9a55e78b52774a3c 25 # This case is encountered "temporarily" during stdenv bootstrapping on darwin. 26 # Beware that the old version has known security issues, so the final set shouldn't use it. 27 oldVer = python.pname == "python3-minimal"; 28in 29 assert oldVer -> stdenv.isDarwin; # reduce likelihood of using old libxml2 unintentionally 30 31let 32libxml = stdenv.mkDerivation rec { 33 pname = "libxml2"; 34 version = "2.10.3"; 35 36 outputs = [ "bin" "dev" "out" "doc" ] 37 ++ lib.optional pythonSupport "py" 38 ++ lib.optional (enableStatic && enableShared) "static"; 39 outputMan = "bin"; 40 41 src = fetchurl { 42 url = "mirror://gnome/sources/libxml2/${lib.versions.majorMinor version}/libxml2-${version}.tar.xz"; 43 sha256 = "XSzD14vsPb4hKp1/pimtolp9qSivQyyTBg/1wX7iipw="; 44 }; 45 46 patches = [ 47 # Upstream bugs: 48 # https://bugzilla.gnome.org/show_bug.cgi?id=789714 49 # https://gitlab.gnome.org/GNOME/libxml2/issues/64 50 # Patch from https://bugzilla.opensuse.org/show_bug.cgi?id=1065270 , 51 # but only the UTF-8 part. 52 # Can also be mitigated by fixing malformed XML inputs, such as in 53 # https://gitlab.gnome.org/GNOME/gnumeric/merge_requests/3 . 54 # Other discussion: 55 # https://github.com/itstool/itstool/issues/22 56 # https://github.com/NixOS/nixpkgs/pull/63174 57 # https://github.com/NixOS/nixpkgs/pull/72342 58 ./utf8-xmlErrorFuncHandler.patch 59 ]; 60 61 strictDeps = true; 62 63 nativeBuildInputs = [ 64 pkg-config 65 autoreconfHook 66 ]; 67 68 buildInputs = lib.optionals pythonSupport [ 69 python 70 ] ++ lib.optionals (pythonSupport && python?isPy2 && python.isPy2) [ 71 gettext 72 ] ++ lib.optionals (pythonSupport && python?isPy3 && python.isPy3) [ 73 ncurses 74 ] ++ lib.optionals (stdenv.isDarwin && pythonSupport && python?isPy2 && python.isPy2) [ 75 libintl 76 ] ++ lib.optionals stdenv.isFreeBSD [ 77 # Libxml2 has an optional dependency on liblzma. However, on impure 78 # platforms, it may end up using that from /usr/lib, and thus lack a 79 # RUNPATH for that, leading to undefined references for its users. 80 xz 81 ]; 82 83 propagatedBuildInputs = [ 84 zlib 85 findXMLCatalogs 86 ] ++ lib.optionals stdenv.isDarwin [ 87 libiconv 88 ] ++ lib.optionals icuSupport [ 89 icu 90 ]; 91 92 configureFlags = [ 93 "--exec-prefix=${placeholder "dev"}" 94 (lib.enableFeature enableStatic "static") 95 (lib.enableFeature enableShared "shared") 96 (lib.withFeature icuSupport "icu") 97 (lib.withFeature pythonSupport "python") 98 (lib.optionalString pythonSupport "PYTHON=${python.pythonForBuild.interpreter}") 99 ]; 100 101 installFlags = lib.optionals pythonSupport [ 102 "pythondir=\"${placeholder "py"}/${python.sitePackages}\"" 103 "pyexecdir=\"${placeholder "py"}/${python.sitePackages}\"" 104 ]; 105 106 enableParallelBuilding = true; 107 108 doCheck = 109 (stdenv.hostPlatform == stdenv.buildPlatform) && 110 stdenv.hostPlatform.libc != "musl"; 111 preCheck = lib.optional stdenv.isDarwin '' 112 export DYLD_LIBRARY_PATH="$PWD/.libs:$DYLD_LIBRARY_PATH" 113 ''; 114 115 preConfigure = lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") '' 116 MACOSX_DEPLOYMENT_TARGET=10.16 117 ''; 118 119 preInstall = lib.optionalString pythonSupport '' 120 substituteInPlace python/libxml2mod.la --replace "$dev/${python.sitePackages}" "$py/${python.sitePackages}" 121 ''; 122 123 postFixup = '' 124 moveToOutput bin/xml2-config "$dev" 125 moveToOutput lib/xml2Conf.sh "$dev" 126 '' + lib.optionalString (enableStatic && enableShared) '' 127 moveToOutput lib/libxml2.a "$static" 128 ''; 129 130 passthru = { 131 inherit version; 132 pythonSupport = pythonSupport; 133 134 updateScript = gnome.updateScript { 135 packageName = pname; 136 versionPolicy = "none"; 137 }; 138 }; 139 140 meta = with lib; { 141 homepage = "https://gitlab.gnome.org/GNOME/libxml2"; 142 description = "XML parsing library for C"; 143 license = licenses.mit; 144 platforms = platforms.all; 145 maintainers = with maintainers; [ eelco jtojnar ]; 146 }; 147}; 148in 149if oldVer then 150 libxml.overrideAttrs (attrs: rec { 151 version = "2.10.1"; 152 src = fetchurl { 153 url = "mirror://gnome/sources/libxml2/${lib.versions.majorMinor version}/libxml2-${version}.tar.xz"; 154 sha256 = "21a9e13cc7c4717a6c36268d0924f92c3f67a1ece6b7ff9d588958a6db9fb9d8"; 155 }; 156 }) 157else 158 libxml