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