%global xfceversion 4.14
Name:           exo
Version:        0.12.11
Release:        1
Summary:        An extension library to Xfce
License:        LGPLv2+ and GPLv2+
#Group:          Development/Libraries
URL:            http://xfce.org/
Source0:        http://archive.xfce.org/src/xfce/%{name}/0.12/%{name}-%{version}.tar.bz2

# replace mailto handler with python version
# https://bugzilla.xfce.org/show_bug.cgi?id=9964
Source1:        mailtoparse.py
Patch1:         exo-0.7.2-remove-xfce-category.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
#BuildArch:      noarch
BuildRequires:  gcc-c++
BuildRequires:  gtk-doc
BuildRequires:  gettext
BuildRequires:  perl-URI
BuildRequires:  pkgconfig(glib-2.0) >= 2.24.0
BuildRequires:  pkgconfig(gtk+-2.0) >= 2.20.0
BuildRequires:  pkgconfig(libxfce4util-1.0) >= %{xfceversion}
BuildRequires:  pkgconfig(libxfce4ui-1) >= %{xfceversion}
BuildRequires:  libnotify-devel
BuildRequires:  intltool >= 0.31
BuildRequires:  chrpath
BuildRequires:  desktop-file-utils
BuildRequires:  gobject-introspection-devel

%description
An extension library for Xfce, targeted at application development.

%package        devel
Summary:        Development tools for exo library
Requires:       %{name} = %{version}-%{release}
Requires:       libxfce4util-devel
Requires:       pkgconfig

%description devel
Development tools and static libraries and header files for the exo library.

%prep
%setup -q

%patch1 -p1

%build
%configure --enable-gtk-doc --disable-static
%make_build

%install
%make_install

find %{buildroot} -type f -name "*.la" -exec rm -f {} ';'

chrpath --delete %{buildroot}%{_bindir}/exo-desktop-item-edit
chrpath --delete %{buildroot}%{_bindir}/exo-open
chrpath --delete %{buildroot}%{_libdir}/xfce4/exo-*/exo-helper-*

%find_lang exo-1

for file in %{buildroot}/%{_datadir}/applications/%{name}-*.desktop ; do
   desktop-file-validate $file
done

# replace upstream perl script with python one. 
rm -f %{buildroot}%{_libdir}/xfce4/exo-1/exo-compose-mail-1
install -Dpm 0755 %{SOURCE1} %{buildroot}%{_libdir}/xfce4/exo-1/exo-compose-mail-1

%ldconfig_scriptlets

%files -f exo-1.lang
%license COPYING
%doc AUTHORS ChangeLog NEWS README THANKS
%dir %{_sysconfdir}/xdg/xfce4
%config(noreplace) %{_sysconfdir}/xdg/xfce4/helpers.rc
%{_bindir}/exo-csource
%{_bindir}/exo-desktop-item-edit
%{_bindir}/exo-open
%{_bindir}/exo-preferred-applications
%{_libdir}/libexo-1.so.0
%{_libdir}/libexo-1.so.0.1.0
%{_libdir}/libexo-2.so.0
%{_libdir}/libexo-2.so.0.1.0
%{_libdir}/xfce4/
%{_datadir}/xfce4/
%{_datadir}/applications/*.desktop
%{_datadir}/icons/hicolor/*/*/*
%{_datadir}/pixmaps/exo
%{_mandir}/man1/exo-open.1.*
%{_mandir}/man1/exo-csource.1.*

%files devel
%doc TODO
%doc %{_datadir}/gtk-doc
%{_includedir}/exo*
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/*.pc

%changelog
* Tue Jul 7 2020 Dillon Chen <dillon.chen@turbolinux.com.cn> - 0.12.11-1
- Init Package
