lol
1{
2 lib,
3 stdenv,
4 fetchurl,
5 fetchpatch,
6 pkg-config,
7 meson,
8 ninja,
9 gettext,
10 gobject-introspection,
11 gtk-doc,
12 docbook_xsl,
13 glib,
14 libsoup_3,
15 libxml2,
16 libxslt,
17 check,
18 curl,
19 perl,
20 hwdata,
21 osinfo-db,
22 replaceVars,
23 vala ? null,
24}:
25
26stdenv.mkDerivation rec {
27 pname = "libosinfo";
28 version = "1.12.0";
29
30 src = fetchurl {
31 url = "https://releases.pagure.org/${pname}/${pname}-${version}.tar.xz";
32 sha256 = "sha256-rYVX7OJnk9pD0m3lZePWjOLua/uNARO3zH3+B/a/xrY=";
33 };
34
35 outputs = [
36 "out"
37 "dev"
38 ]
39 ++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) "devdoc";
40
41 nativeBuildInputs = [
42 pkg-config
43 meson
44 ninja
45 vala
46 gettext
47 gobject-introspection
48 gtk-doc
49 docbook_xsl
50 perl # for pod2man
51 ];
52 buildInputs = [
53 glib
54 libsoup_3
55 libxml2
56 libxslt
57 ];
58 nativeCheckInputs = [
59 check
60 curl
61 perl
62 ];
63
64 patches = [
65 (replaceVars ./osinfo-db-data-dir.patch {
66 osinfo_db_data_dir = "${osinfo-db}/share";
67 })
68
69 # Fix build with libxml 2.14
70 (fetchpatch {
71 url = "https://gitlab.com/libosinfo/libosinfo/-/commit/0adf38535637ec668e658d43f04f60f11f51574f.patch";
72 hash = "sha256-NZija5BwevRU7bAe2SPx9GnoGb1P+mXEbJ5EVAFT9Yw=";
73 })
74 ];
75
76 mesonFlags = [
77 "-Dwith-usb-ids-path=${hwdata}/share/hwdata/usb.ids"
78 "-Dwith-pci-ids-path=${hwdata}/share/hwdata/pci.ids"
79 "-Denable-gtk-doc=true"
80 ];
81
82 preCheck = ''
83 patchShebangs ../osinfo/check-symfile.pl ../osinfo/check-symsorting.pl
84 '';
85
86 doCheck = true;
87
88 meta = {
89 description = "GObject based library API for managing information about operating systems, hypervisors and the (virtual) hardware devices they can support";
90 homepage = "https://libosinfo.org/";
91 changelog = "https://gitlab.com/libosinfo/libosinfo/-/blob/v${version}/NEWS";
92 license = lib.licenses.lgpl2Plus;
93 platforms = lib.platforms.unix;
94 maintainers = [ lib.maintainers.bjornfor ];
95 };
96}