1{ lib
2, stdenv
3, substituteAll
4, fetchFromGitHub
5, meson
6, mesonEmulatorHook
7, ninja
8, pkg-config
9, gettext
10, xmlto
11, docbook-xsl-nons
12, docbook_xml_dtd_45
13, libxslt
14, libstemmer
15, glib
16, xapian
17, libxml2
18, libxmlb
19, libyaml
20, gobject-introspection
21, pcre
22, itstool
23, gperf
24, vala
25, curl
26, nixosTests
27}:
28
29stdenv.mkDerivation rec {
30 pname = "appstream";
31 version = "0.15.5";
32
33 outputs = [ "out" "dev" "installedTests" ];
34
35 src = fetchFromGitHub {
36 owner = "ximion";
37 repo = "appstream";
38 rev = "v${version}";
39 sha256 = "sha256-KVZCtu1w5FMgXZMiSW55rbrI6W/A9zWWKKvACtk/jjk=";
40 };
41
42 patches = [
43 # Fix hardcoded paths
44 (substituteAll {
45 src = ./fix-paths.patch;
46 libstemmer_includedir = "${lib.getDev libstemmer}/include";
47 })
48
49 # Allow installing installed tests to a separate output.
50 ./installed-tests-path.patch
51 ];
52
53 strictDeps = true;
54
55 depsBuildBuild = [
56 pkg-config
57 ];
58
59 nativeBuildInputs = [
60 meson
61 ninja
62 pkg-config
63 gettext
64 libxslt
65 xmlto
66 docbook-xsl-nons
67 docbook_xml_dtd_45
68 gobject-introspection
69 itstool
70 vala
71 gperf
72 ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
73 mesonEmulatorHook
74 ];
75
76 buildInputs = [
77 libstemmer
78 pcre
79 glib
80 xapian
81 libxml2
82 libxmlb
83 libyaml
84 curl
85 ];
86
87 mesonFlags = [
88 "-Dapidocs=false"
89 "-Ddocs=false"
90 "-Dvapi=true"
91 "-Dinstalled_test_prefix=${placeholder "installedTests"}"
92 ];
93
94 passthru = {
95 tests = {
96 installed-tests = nixosTests.installed-tests.appstream;
97 };
98 };
99
100 meta = with lib; {
101 description = "Software metadata handling library";
102 longDescription = ''
103 AppStream is a cross-distro effort for building Software-Center applications
104 and enhancing metadata provided by software components. It provides
105 specifications for meta-information which is shipped by upstream projects and
106 can be consumed by other software.
107 '';
108 homepage = "https://www.freedesktop.org/wiki/Distributions/AppStream/";
109 license = licenses.lgpl21Plus;
110 mainProgram = "appstreamcli";
111 platforms = platforms.unix;
112 };
113}