nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 updateAutotoolsGnuConfigScriptsHook,
6 # for passthru.tests
7 python3,
8 perlPackages,
9 haskellPackages,
10 luaPackages,
11 ocamlPackages,
12 testers,
13}:
14
15# Note: this package is used for bootstrapping fetchurl, and thus
16# cannot use fetchpatch! All mutable patches (generated by GitHub or
17# cgit) that are needed here should be included directly in Nixpkgs as
18# files.
19
20let
21 version = "2.7.4";
22 tag = "R_${lib.replaceStrings [ "." ] [ "_" ] version}";
23in
24stdenv.mkDerivation (finalAttrs: {
25 pname = "expat";
26 inherit version;
27
28 src = fetchurl {
29 url =
30 with finalAttrs;
31 "https://github.com/libexpat/libexpat/releases/download/${tag}/${pname}-${version}.tar.xz";
32 hash = "sha256-npyrtFfB4J3pHbJwbYNlZFeSY46zvh+U27IUkwEIasA=";
33 };
34
35 strictDeps = true;
36 nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];
37
38 outputs = [
39 "out"
40 "dev"
41 ]; # TODO: fix referrers
42 outputBin = "dev";
43
44 enableParallelBuilding = true;
45
46 configureFlags = lib.optional stdenv.hostPlatform.isFreeBSD "--with-pic";
47
48 outputMan = "dev"; # tiny page for a dev tool
49
50 doCheck = true; # not cross;
51
52 preCheck = ''
53 patchShebangs ./run.sh ./test-driver-wrapper.sh
54 '';
55
56 # CMake files incorrectly calculate library path from dev prefix
57 # https://github.com/libexpat/libexpat/issues/501
58 postFixup = ''
59 substituteInPlace $dev/lib/cmake/expat-${finalAttrs.version}/expat-noconfig.cmake \
60 --replace "$"'{_IMPORT_PREFIX}' $out
61 '';
62
63 passthru.tests = {
64 inherit python3;
65 inherit (python3.pkgs) xmltodict;
66 inherit (haskellPackages) hexpat;
67 inherit (perlPackages) XMLSAXExpat XMLParser;
68 inherit (luaPackages) luaexpat;
69 inherit (ocamlPackages) ocaml_expat;
70 pkg-config = testers.hasPkgConfigModules {
71 package = finalAttrs.finalPackage;
72 };
73 };
74
75 meta = {
76 changelog = "https://github.com/libexpat/libexpat/blob/${tag}/expat/Changes";
77 homepage = "https://libexpat.github.io/";
78 description = "Stream-oriented XML parser library written in C";
79 mainProgram = "xmlwf";
80 platforms = lib.platforms.all;
81 license = lib.licenses.mit; # expat version
82 pkgConfigModules = [ "expat" ];
83 };
84})