File libfm.spec of Package libfm

#
# spec file for package libfm
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           libfm
Version:        1.2.3
Release:        0
Summary:        A glib/gio-based lib used to develop file managers
License:        GPL-2.0+
Group:          Development/Libraries/C and C++
Url:            http://www.lxde.org/
Source:         %{name}-%{version}.tar.xz
Source1:        %{name}-rpmlintrc
Patch0:         libfm-default-config.patch
# [SF#902] Handle NULL returned by fm_mime_type_from_native_file() correctly
Patch1:         libfm-1.2.3-Fix-SF902.patch
Patch2:         libfm-Additional-fix-after-SF902.patch
# [SF#922] Fix handling %c in desktop entry Exec key
Patch3:         libfm-1.2.3-Fix-SF922.patch
# [SF#914] Fix missing folder info update on folder attributes
Patch4:         libfm-1.2.3-Fix-SF914.patch
# [PATCH] Use G_SPAWN_DO_NOT_REAP_CHILD on application launch, that should fix a problem with pkexec
Patch5:         libfm-1.2.3-Use-G_SPAWN_DO_NOT_REAP_CHILD-on-applicaton-launch.patch
# [SF#946] Add missing newline at end of generated shortcut
Patch6:         libfm-1.2.3-Fix-SF946.patch
# [SF#925,938] Improve file type detection, it fails in some cases such as DOCX
Patch7:         libfm-1.2.3-Fix-SF925-and-SF938.patch
# Return back the workaround on thumbnailers which don't save Thumb::MTime
Patch8:         libfm-1.2.3-Return-back-the-workaround-on-thumbnailers.patch
# [SF#937] Fix wrong treating files like ".purple" as having extension "purple"
Patch9:         libfm-1.2.3-Fix-SF937.patch
# [SF#935] Fix invalid desktop entry save if 'Cancel' was pressed in dialog
Patch10:        libfm-1.2.3-Fix-SF935.patch
# [SF#915] Always do gtk_drag_finish() in FmDndDest even if drop was failed
Patch11:        libfm-1.2.3-Fix-SF915.patch
# [PATCH] FmDndDest: reset cached data if drag context was changed
Patch12:        libfm-1.2.3-Reset-cached-data-if-drag-context-was-changed.patch
# [PATCH] Fix uninitialized data in drag-motion callback of FmPlacesView
Patch13:        libfm-1.2.3-Fix-uninitialized-data-in-drag-motion-callback.patch
# [SF#953] Fix crash in expand_exec_macros() on missing Exec line in desktop entry
Patch14:        libfm-1.2.3-Fix-SF953.patch
# [SF#921] Rewrite broken rubberband rendering in icon view for GTK3
Patch15:        libfm-1.2.3-Fix-SF921.patch
# [SF#932] Fix renaming of desktop entries on copy operation error
Patch16:        libfm-1.2.3-Fix-SF932.patch
# Fix dropping files onto applications shortcuts on the desktop
Patch17:        libfm-1.2.3-Fix-dropping-files-onto-applications.patch
# Fix desktop file name for urxvt in terminals.list
Patch18:        libfm-1.2.3-Fix-desktop-file-name-for-urxvt.patch
# [SF#954] Add urxvtc data into the terminals.list file
Patch19:        libfm-1.2.3-Fix-SF954.patch
# [SF#950] Fix adding user-defined MIME associations into mimeapps.list config
Patch20:        libfm-1.2.3-Fix-SF950.patch
# [SF#959] Fix autoscroll issues with GTK+ 3
Patch21:        libfm-1.2.3-Fix-SF959.patch
# [SF#965] Fix stuck tooltip on entering empty folder
Patch22:        libfm-1.2.3-Fix-SF965.patch
# Fix crash on cancelling FmDirListJob while retrieving is in progress
Patch23:        libfm-1.2.3-Fix-crash-on-cancelling-FmDirListJob.patch
# [SF#919] Fix incomplete cleanup on folder reloading
Patch24:        libfm-1.2.3-Fix-SF919.patch
# [SF#967] Fix timer shown in progress dialog, it should show 01:00, not 00:60
Patch25:        libfm-1.2.3-Fix-SF967.patch
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  gtk2-devel
BuildRequires:  intltool
BuildRequires:  libtool
BuildRequires:  pkgconfig(dbus-glib-1)
BuildRequires:  pkgconfig(libmenu-cache)
# Optional: needed for custom actions support
BuildRequires:  vala >= 0.13.0
# Optional: HTML developers documentation
BuildRequires:  gtk-doc
# Optional: needed to load embbeded thumbnails in jpeg
BuildRequires:  libexif-devel
BuildRequires:  update-desktop-files
Recommends:     %{name}-lang
Recommends:     lxshortcut-%{version}
Requires(pre):  desktop-file-utils
Requires(pre):  shared-mime-info
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%lang_package

%description
A glib/gio-based library providing some file management utilities and
related-widgets missing in gtk+/glib. This is the core of PCManFM. The
library is desktop independent (not LXDE specific) and has clean API.
It can be used to develop other applications requiring file management
functionality. For example, you can create your own file manager with
facilities provided by libfm.


%package -n libfm4
Summary:        Libfm libraries
Group:          System/Libraries
# libfm is extensible by modules - which are in the main package
# they are not strictly required, but a very good thing to have present
Recommends:     %{name}

%description -n libfm4
libfm main library


%package -n libfm-gtk4
Summary:        GTK libfm libraries
Group:          System/Libraries

%description -n libfm-gtk4
GTK system libraries for libfm

%package -n lxshortcut
Summary:        Create shortcuts for LXDE
Group:          System/GUI/LXDE

%description -n lxshortcut
LXShortcut is a small program used to edit application shortcuts
created with freedesktop.org Desktop Entry spec.


%package devel
Summary:        Devel files for libfm
Group:          Development/Libraries/C and C++
Requires:       %{name}    = %{version}
Requires:       libfm4     = %{version}
Requires:       pkg-config
Requires:       pkgconfig(libfm-extra)

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


%package -n libfm-gtk-devel
Summary:        GTK devel files for libfm
Group:          Development/Libraries/C and C++
Requires:       %{name}    = %{version}
Requires:       gtk2-devel
Requires:       libfm-gtk4 = %{version}
Requires:       libfm4     = %{version}
Requires:       pkg-config

%description -n libfm-gtk-devel
GTK libfm libraries for development

%package doc
Summary:        GTK libfm libraries
Group:          Documentation/Other
Requires:       %{name} >= %{version}

%description doc
libfm developers documentation


%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1

%build
%configure \
        --enable-gtk-doc \
        --enable-udisks \
		--disable-static
# remove rpath
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
# macro for parallel make
make %{?_smp_mflags}

%install
%make_install
rm -f %{buildroot}%{_libdir}/*.la
rm -f %{buildroot}%{_bindir}/libfm-pref-apps
rm -f %{buildroot}%{_datadir}/applications/libfm-pref-apps.desktop
# using libfm-pref-apps.1.gz fails!
rm -f %{buildroot}%{_mandir}/man1/libfm-pref-apps.1
# we need to remove libfm-extra stuff
rm -rf %{buildroot}%{_includedir}/%{name}
rm -rf %{buildroot}%{_includedir}/%{name}-1.0/fm-extra.h
rm -rf %{buildroot}%{_includedir}/%{name}-1.0/fm-version.h
rm -rf %{buildroot}%{_includedir}/%{name}-1.0/fm-xml-file.h
rm -rf %{buildroot}%{_libdir}/pkgconfig/%{name}-extra.pc
rm -rf %{buildroot}%{_libdir}/%{name}-extra.so
rm -rf %{buildroot}%{_libdir}/%{name}-extra.so.4
rm -rf %{buildroot}%{_libdir}/%{name}-extra.so.4.0.3

%find_lang %{name}
%fdupes -s %{buildroot}/%{_datadir}/locale
%suse_update_desktop_file -u -r -G 'Shortcut Editor' lxshortcut Utility DesktopUtility GTK

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

%postun
/sbin/ldconfig
/usr/bin/update-mime-database %{_datadir}/mime > /dev/null 2>&1 || :
/usr/bin/update-desktop-database

%post   -n libfm4 -p /sbin/ldconfig

%postun -n libfm4 -p /sbin/ldconfig

%post   -n libfm-gtk4 -p /sbin/ldconfig

%postun -n libfm-gtk4 -p /sbin/ldconfig

%files
%defattr(-,root,root)
%dir %{_sysconfdir}/xdg/%{name}
%config %{_sysconfdir}/xdg/%{name}/%{name}.conf
%dir %{_libdir}/%{name}/
%dir %{_libdir}/%{name}/modules
%{_libdir}/%{name}/modules/gtk-fileprop-x-desktop.so
%{_libdir}/%{name}/modules/gtk-fileprop-x-shortcut.so
%{_libdir}/%{name}/modules/gtk-menu-actions.so
%{_libdir}/%{name}/modules/gtk-menu-trash.so
%{_libdir}/%{name}/modules/vfs-menu.so
%{_libdir}/%{name}/modules/vfs-search.so
%dir %{_datadir}/%{name}/images/
%{_datadir}/%{name}/images/folder.png
%{_datadir}/%{name}/images/unknown.png
%{_datadir}/%{name}/terminals.list
%{_datadir}/mime/packages/%{name}.xml

%files devel
%defattr(-,root,root)
%dir %{_includedir}/%{name}-1.0
%exclude %{_includedir}/%{name}-1.0/fm-gtk*.h
%{_includedir}/%{name}-1.0/*.h
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/%{name}.so

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

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

%files lang -f %{name}.lang
%defattr(-,root,root,-)

%files -n libfm4
%defattr(-,root,root)
%{_libdir}/libfm.so.*

%files -n libfm-gtk4
%defattr(-,root,root)
%{_libdir}/libfm-gtk.so.*
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/ui
%{_datadir}/%{name}/archivers.list
%{_datadir}/%{name}/ui/*.ui

%files -n lxshortcut
%defattr(-,root,root)
%{_bindir}/lxshortcut
%{_datadir}/applications/lxshortcut.desktop
%{_mandir}/man1/lxshortcut.1.gz

%changelog
openSUSE Build Service is sponsored by