lol
1{ lib
2, stdenv
3, fetchurl
4# for passthru.tests
5, python3
6, perlPackages
7, haskellPackages
8, luaPackages
9, ocamlPackages
10}:
11
12# Note: this package is used for bootstrapping fetchurl, and thus
13# cannot use fetchpatch! All mutable patches (generated by GitHub or
14# cgit) that are needed here should be included directly in Nixpkgs as
15# files.
16
17stdenv.mkDerivation rec {
18 pname = "expat";
19 version = "2.5.0";
20
21 src = fetchurl {
22 url = "https://github.com/libexpat/libexpat/releases/download/R_${lib.replaceStrings ["."] ["_"] version}/${pname}-${version}.tar.xz";
23 sha256 = "1gnwihpfz4x18rwd6cbrdggmfqjzwsdfh1gpmc0ph21c4gq2097g";
24 };
25
26 strictDeps = true;
27
28 outputs = [ "out" "dev" ]; # TODO: fix referrers
29 outputBin = "dev";
30
31 enableParallelBuilding = true;
32
33 configureFlags = lib.optional stdenv.isFreeBSD "--with-pic";
34
35 outputMan = "dev"; # tiny page for a dev tool
36
37 doCheck = true; # not cross;
38
39 preCheck = ''
40 patchShebangs ./configure ./run.sh ./test-driver-wrapper.sh
41 '';
42
43 # CMake files incorrectly calculate library path from dev prefix
44 # https://github.com/libexpat/libexpat/issues/501
45 postFixup = ''
46 substituteInPlace $dev/lib/cmake/expat-${version}/expat-noconfig.cmake \
47 --replace "$"'{_IMPORT_PREFIX}' $out
48 '';
49
50 passthru.tests = {
51 inherit python3;
52 inherit (python3.pkgs) xmltodict;
53 inherit (haskellPackages) hexpat;
54 inherit (perlPackages) XMLSAXExpat XMLParser;
55 inherit (luaPackages) luaexpat;
56 inherit (ocamlPackages) ocaml_expat;
57 };
58
59 meta = with lib; {
60 homepage = "https://libexpat.github.io/";
61 description = "A stream-oriented XML parser library written in C";
62 platforms = platforms.all;
63 license = licenses.mit; # expat version
64 };
65}