%global xfceversion 4.12

Name:           orage
Version:        4.12.1
Release:        2
Summary:        Time-managing application for the Xfce desktop environment
License:        GPLv2+
#Group:          Development/Libraries
URL:            http://www.xfce.org/
Source0:        http://archive.xfce.org/src/apps/%{name}/%{xfceversion}/%{name}-%{version}.tar.bz2
Patch0:         %{name}-%{version}-libical3.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
#BuildArch:      noarch
BuildRequires:  gcc
BuildRequires:  pkgconfig(libxfce4panel-1.0) >= 4.6.0
BuildRequires:  pkgconfig(libnotify) >= 0.3.2
BuildRequires:  pkgconfig(libical) >= 0.43
BuildRequires:  pkgconfig(dbus-glib-1) >= 0.34
BuildRequires:  popt-devel
BuildRequires:  gettext intltool
BuildRequires:  desktop-file-utils
Requires:       dbus
Requires:       xfce4-panel
Provides:       xfcalendar = %{version}-%{release}

%description
Orage provides a calendar which integrates nicely into the Xfce Desktop 
Environment. It is highly configurable and supports alerts based on dates. 
It warns you with popup or audio alarm. As it is an application for every 
day use it launches itself in the background as a daemon and can be accessed 
using the Orage Clock plugin for the panel. 

%prep
%setup -q
%patch0 -p1

%build
export CFLAGS="$RPM_OPT_FLAGS -I/usr/include/libical"
%configure --disable-static --enable-libical

make %{?_smp_mflags}

%install
make install DESTDIR=%{buildroot} INSTALL='install -p'
%find_lang %{name}

desktop-file-install \
        --dir %{buildroot}%{_datadir}/applications         \
        --delete-original                                       \
        %{buildroot}%{_datadir}/applications/xfcalendar.desktop

desktop-file-install                            \
        --dir %{buildroot}%{_datadir}/applications         \
        --remove-category Application                           \
        --delete-original                                       \
        %{buildroot}%{_datadir}/applications/globaltime.desktop

# remove unneeded .la file
rm -f %{buildroot}%{_libdir}/xfce4/panel/plugins/liborageclock.la

%files -f %{name}.lang
%license COPYING
%doc README ChangeLog AUTHORS
%{_bindir}/globaltime
%{_bindir}/orage
%{_bindir}/tz_convert
%{_datadir}/applications/*xfcalendar.desktop
%{_datadir}/applications/globaltime.desktop
%{_datadir}/applications/xfce-xfcalendar-settings.desktop
%{_datadir}/orage/
%{_datadir}/icons/hicolor/*/*/*
%{_datadir}/dbus-1/services/org.xfce.calendar.service
%{_datadir}/dbus-1/services/org.xfce.orage.service
%{_datadir}/xfce4/panel/plugins/xfce4-orageclock-plugin.desktop
%{_libdir}/xfce4/panel/plugins/liborageclock.so
%{_mandir}/man1/globaltime.1.*
%{_mandir}/man1/orage.1.*
%{_mandir}/man1/tz_convert.1.*

%changelog
* Mon Jul 27 2020 Dillon Chen <dillon.chen@turbolinux.com.cn> - 4.12.1-2
- Fix source0 url error.
* Mon Jul 27 2020 Dillon Chen <dillon.chen@turbolinux.com.cn> - 4.12.1-1
- Init package
