Name: libfm
Summary: A glib/gio-based lib used to develop file managers
Summary(ja): ファイルマネージャー開発に用いられる glib/gio ベースのライブラリー
Version: 1.0
Release: 1.rc1%{?_dist_release}
License: GPLv2+
Group: System Environment/Libraries
URL: http://sourceforge.net/projects/pcmanfm/
Source0: %{name}-%{version}rc1.tar.gz
Patch0: libfm_customize.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: autoconf automake
BuildRequires: desktop-file-utils
BuildRequires: fdupes
BuildRequires: gettext
BuildRequires: gvfs-devel
BuildRequires: gtk-doc
BuildRequires: gtk2-devel >= 2.16.0
BuildRequires: glib2-devel >= 2.24.0
BuildRequires: intltool >= 0.40
BuildRequires: menu-cache-devel >= 0.3.2
BuildRequires: pango-devel
BuildRequires: perl-XML-Parser
BuildRequires: pkgconfig
BuildRequires: udisks

Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig

Vendor: Project Vine
Distribution: Vine Linux
Packager: kudoh

%description
A glib/gio-based lib used to develop file managers providing some
file management utilities and related-widgets missing in gtk+/glib.

%package        gtk
Summary:        File manager-related GTK+ widgets of %{name}
Summary(ja):    ファイルマネージャーに関連する %{name} の GTK+ ウィジェット
Group:          System Environment/Libraries
Requires:       %{name} = %{version}-%{release}
Requires:       gvfs

%description    gtk
libfm is a GIO-based library used to develop file manager-like programs. It is
developed as the core of next generation PCManFM and takes care of all file-
related operations such as copy & paste, drag & drop, file associations or 
thumbnail support. By utilizing glib/gio and gvfs, libfm can access remote 
file systems supported by gvfs.

This package provides useful file manager-related GTK+ widgets.

%package        devel
Summary:        Development files for %{name}
Summary(ja):    %{name} の開発ファイル
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.


%package        gtk-devel
Summary:        Development files for %{name}-gtk
Summary(ja):    %{name}-gtk の開発ファイル
Group:          Development/Libraries
Requires:       %{name}-gtk = %{version}-%{release}
Requires:       %{name}-devel = %{version}-%{release}

%description    gtk-devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}-gtk.


%package        devel-docs
Summary:        Development documation for %{name}
Summary(ja):    %{name} の開発ドキュメント
Group:          Development/Libraries

%description    devel-docs
This package containg development documentation files for %{name}.

%prep
%setup -qn libfm-1.0rc1
%patch0 -p1

# treak rpath
sed -i.libdir_syssearch -e \
  '/sys_lib_dlsearch_path_spec/s|/usr/lib |/usr/lib /usr/lib64 /lib /lib64 |' \
  configure

%build
%configure --enable-static=no
make -C po -j1 GMSGFMT="msgfmt --statistics"
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT INSTALL='install -p'

find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'

desktop-file-validate %{buildroot}/%{_datadir}/applications/*.desktop

%find_lang %{name}

echo '%%defattr(-,root,root,-)' > base-header.files
echo '%%defattr(-,root,root,-)' > gtk-header.files
for f in $RPM_BUILD_ROOT%{_includedir}/%name/%name/*.h
do
  bf=$(basename $f)
  for dir in base job
  do
    if [ -f src/$dir/$bf ]
    then
      echo %_includedir/%name/%name/$bf >> base-header.files
    fi
  done
  for dir in gtk
  do
    if [ -f src/$dir/$bf ]
    then
      echo %_includedir/%name/%name/$bf >> gtk-header.files
    fi
  done
done

/usr/lib/rpm/check-rpaths

%clean
rm -fr %{buildroot}

%post
/sbin/ldconfig
update-mime-database %{_datadir}/mime &> /dev/null || :


%postun
/sbin/ldconfig
update-mime-database %{_datadir}/mime &> /dev/null || :


%post gtk -p /sbin/ldconfig
%postun gtk -p /sbin/ldconfig

%files -f %{name}.lang
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
%dir %{_sysconfdir}/xdg/libfm/
%config(noreplace) %{_sysconfdir}/xdg/libfm/pref-apps.conf
%config(noreplace) %{_sysconfdir}/xdg/libfm/libfm.conf
%{_libdir}/%{name}.so.*
%{_datadir}/mime/packages/libfm.xml


%files gtk
%defattr(-,root,root,-)
%{_bindir}/libfm-pref-apps
%{_libdir}/%{name}-gtk.so.*
%{_datadir}/libfm/
%{_datadir}/applications/libfm-pref-apps.desktop
%{_mandir}/man1/libfm-pref-apps.1.gz


%files devel -f base-header.files
%defattr(-,root,root,-)
%doc TODO
%dir %{_includedir}/libfm/
%dir %{_includedir}/libfm/libfm/
%{_includedir}/libfm/libfm/fm.h
%{_includedir}/libfm/libfm/fm-actions.h
%{_libdir}/%{name}.so
%{_libdir}/pkgconfig/libfm.pc


%files gtk-devel -f gtk-header.files
%defattr(-,root,root,-)
%{_includedir}/libfm/libfm/fm-gtk.h
%{_libdir}/%{name}-gtk.so
%{_libdir}/pkgconfig/libfm-gtk.pc


%files devel-docs
%defattr(-,root,root,-)
%dir %{_datadir}/gtk-doc
%dir %{_datadir}/gtk-doc/html
%{_datadir}/gtk-doc/html/%{name}

%changelog
* Tue Jul 10 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.0rc1-1
- new upstream release

* Sun Feb 05 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.1.17
- initial build for VineSeed

* Sat Jan 30 2010 Oliver Burger <rpm@mandrivauser.de> 1.2-0.1git20100129.1mud2010.0
- initial package for Mandriva Linux
