1{ gtkWidgets ? false # build GTK widgets for libinfinity
2, avahiSupport ? false # build support for Avahi in libinfinity
3, lib, stdenv, fetchurl, pkg-config, glib, libxml2, gnutls, gsasl
4, gobject-introspection
5, gtk3 ? null, gtk-doc, docbook_xsl, docbook_xml_dtd_412, avahi ? null, libdaemon, libidn, gss
6, libintl }:
7
8assert avahiSupport -> avahi != null;
9assert gtkWidgets -> gtk3 != null;
10
11let
12 mkFlag = flag: feature: (if flag then "--with-" else "--without-") + feature;
13
14 self = stdenv.mkDerivation rec {
15 pname = "libinfinity";
16 version = "0.7.2";
17 src = fetchurl {
18 url = "https://github.com/gobby/${pname}/releases/download/${version}/${pname}-${version}.tar.gz";
19 sha256 = "17i3g61hxz9pzl3ryd1yr15142r25m06jfzjrpdy7ic1b8vjjw3f";
20 };
21
22 outputs = [ "bin" "out" "dev" "man" "devdoc" ];
23
24 nativeBuildInputs = [ pkg-config gtk-doc docbook_xsl docbook_xml_dtd_412 gobject-introspection ];
25 buildInputs = [ glib libxml2 gsasl libidn gss libintl libdaemon ]
26 ++ lib.optional gtkWidgets gtk3
27 ++ lib.optional avahiSupport avahi;
28
29 propagatedBuildInputs = [ gnutls ];
30
31 configureFlags = [
32 "--enable-gtk-doc"
33 "--enable-introspection"
34 (mkFlag gtkWidgets "inftextgtk")
35 (mkFlag gtkWidgets "infgtk")
36 "--with-infinoted"
37 "--with-libdaemon"
38 (mkFlag avahiSupport "avahi")
39 ];
40
41 passthru = {
42 infinoted = "${self.bin}/bin/infinoted-${lib.versions.majorMinor version}";
43 };
44
45 meta = {
46 homepage = "https://gobby.github.io/";
47 description = "An implementation of the Infinote protocol written in GObject-based C";
48 license = lib.licenses.lgpl2Plus;
49 maintainers = [ lib.maintainers.phreedom ];
50 platforms = with lib.platforms; linux ++ darwin;
51 };
52 };
53in self