1{ lib
2, stdenv
3, fetchurl
4, glib
5, intltool
6, menu-cache
7, pango
8, pkg-config
9, vala
10, extraOnly ? false
11, withGtk3 ? false, gtk2, gtk3
12}:
13
14let
15 gtk = if withGtk3 then gtk3 else gtk2;
16 inherit (lib) optional optionalString;
17in
18stdenv.mkDerivation rec {
19 pname = if extraOnly
20 then "libfm-extra"
21 else "libfm";
22 version = "1.3.2";
23
24 src = fetchurl {
25 url = "mirror://sourceforge/pcmanfm/libfm-${version}.tar.xz";
26 sha256 = "sha256-pQQmMDBM+OXYz/nVZca9VG8ii0jJYBU+02ajTofK0eU=";
27 };
28
29 nativeBuildInputs = [ vala pkg-config intltool ];
30 buildInputs = [ glib gtk pango ]
31 ++ optional (!extraOnly) menu-cache;
32
33 configureFlags = [ "--sysconfdir=/etc" ]
34 ++ optional extraOnly "--with-extra-only"
35 ++ optional withGtk3 "--with-gtk=3";
36
37 installFlags = [ "sysconfdir=${placeholder "out"}/etc" ];
38
39 # libfm-extra is pulled in by menu-cache and thus leads to a collision for libfm
40 postInstall = optionalString (!extraOnly) ''
41 rm $out/lib/libfm-extra.so $out/lib/libfm-extra.so.* $out/lib/libfm-extra.la $out/lib/pkgconfig/libfm-extra.pc
42 '';
43
44 enableParallelBuilding = true;
45
46 meta = with lib; {
47 broken = stdenv.isDarwin;
48 homepage = "https://blog.lxde.org/category/pcmanfm/";
49 license = licenses.lgpl21Plus;
50 description = "A glib-based library for file management";
51 maintainers = [ maintainers.ttuegel ];
52 platforms = platforms.linux ++ platforms.darwin;
53 };
54}