1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 fetchpatch2,
6 pkg-config,
7 meson,
8 ninja,
9 gobject-introspection,
10 python3,
11 libyaml,
12 rpm,
13 file,
14 gtk-doc,
15 docbook-xsl-nons,
16 docbook_xml_dtd_412,
17 glib,
18}:
19
20stdenv.mkDerivation rec {
21 pname = "libmodulemd";
22 version = "2.15.0";
23
24 outputs = [
25 "bin"
26 "out"
27 "dev"
28 "devdoc"
29 "man"
30 "py"
31 ];
32
33 src = fetchFromGitHub {
34 owner = "fedora-modularity";
35 repo = "libmodulemd";
36 rev = "libmodulemd-${version}";
37 sha256 = "sha256-mIyrdksyEk1AKV+vw4g8LUwlQRzwwMkPDuCbw2IiNcA=";
38 };
39
40 patches = [
41 # Adapt to GLib 2.79 documentation
42 # https://github.com/fedora-modularity/libmodulemd/pull/612
43 (fetchpatch2 {
44 url = "https://github.com/fedora-modularity/libmodulemd/commit/9d2809090cc0cccd7bab67453dc00cf43a289082.patch";
45 hash = "sha256-dMtc6GN6lIDjUReFUhEFJ/8wosASo3tLu4ve72BCXQ8=";
46 })
47 (fetchpatch2 {
48 url = "https://github.com/fedora-modularity/libmodulemd/commit/29c339a31b1c753dcdef041e5c2e0e600e48b59d.patch";
49 hash = "sha256-uniHrQdbcXlJk2hq106SgV/E330LfxDc07E4FbOMLr0=";
50 })
51 # Adapt to GLib 2.80.1 documentation
52 (fetchpatch2 {
53 url = "https://github.com/fedora-modularity/libmodulemd/commit/f3336199b4e69af3305f156abc7533bed9e9a762.patch";
54 hash = "sha256-Rvg+/KTKiEBXVEK7tlcTDf53HkaW462g/rg1rHPzaZA=";
55 })
56 ];
57
58 nativeBuildInputs = [
59 pkg-config
60 meson
61 ninja
62 gtk-doc
63 docbook-xsl-nons
64 docbook_xml_dtd_412
65 gobject-introspection
66 ];
67
68 buildInputs = [
69 libyaml
70 rpm
71 file # for libmagic
72 glib
73 ];
74
75 mesonFlags = [
76 "-Dgobject_overrides_dir_py3=${placeholder "py"}/${python3.sitePackages}/gi/overrides"
77 ];
78
79 postPatch = ''
80 # Use proper glib devdoc path
81 substituteInPlace meson.build --replace-fail \
82 "glib_docpath = join_paths(glib_prefix," "glib_docpath = join_paths('${lib.getOutput "devdoc" glib}',"
83 '';
84
85 postFixup = ''
86 # Python overrides depend our own typelibs and other packages
87 mkdir -p "$py/nix-support"
88 echo "$out ${python3.pkgs.pygobject3} ${python3.pkgs.six}" > "$py/nix-support/propagated-build-inputs"
89 '';
90
91 meta = with lib; {
92 description = "C Library for manipulating module metadata files";
93 mainProgram = "modulemd-validator";
94 homepage = "https://github.com/fedora-modularity/libmodulemd";
95 license = licenses.mit;
96 maintainers = [ ];
97 platforms = platforms.linux ++ platforms.darwin;
98 };
99}