%global alt_name GPaste

Name:           gpaste
Version:        3.0.2
Release:        1%{?_dist_release}
Summary:        Clipboard management system
Summary(ja):    クリップボード管理システム

Group:          User Interface/Desktops
License:        GPLv3+
URL:            https://github.com/Keruspe/GPaste
Source0:        https://github.com/downloads/Keruspe/%{alt_name}/%{name}-%{version}.tar.xz

BuildRoot:      %{_tmppath}/%{name}-%{version}-root

BuildRequires: chrpath
BuildRequires: dbus-devel
BuildRequires: desktop-file-utils
BuildRequires: gettext
BuildRequires: glib2-devel >= 2.30
BuildRequires: gobject-introspection-devel
BuildRequires: gtk3-devel
BuildRequires: intltool >= 0.40.0
BuildRequires: libxml2-devel
BuildRequires: libXtst-devel
BuildRequires: vala-devel >= 0.14
BuildRequires: vala-tools >= 0.14
BuildRequires: xcb-util-keysyms-devel

Requires:       %{name}-libs%{?_isa} = %{version}-%{release}

%description
gpasted is a clipboard management daemon with DBus interface. gpaste is its CLI
client and gpaste-settings is a tool to edit gpasted settings.


%package libs
Summary:        Library to manage the clipboard history
Group:          System Environment/Libraries

%description libs
libgpaste is a library to manage the clipboard history (used by gpasted).


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

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


%package -n gnome-shell-extensions-%{name}
Summary:        GNOME Shell extension for GPaste
Summary(ja):    GPaste 用の Gnome Shell 機能拡張
Group:          User Interface/Desktops
Requires:       gnome-shell >= 3.3.5
Requires:       %{name} = %{version}-%{release}
BuildArch:      noarch

%description -n gnome-shell-extensions-%{name}
%{summary}.


%prep
%setup -q

%build
./autogen.sh
# Applet disabled since it is unusable in GNOME 3
%configure \
  --disable-applet \
  --disable-schemas-compile
make %{?_smp_mflags}


%install
make install DESTDIR=$RPM_BUILD_ROOT

rm $RPM_BUILD_ROOT%{_libdir}/*.la

# Fix Rpath issues
chrpath --delete $RPM_BUILD_ROOT%{_libexecdir}/%{name}/gpasted
chrpath --delete $RPM_BUILD_ROOT%{_libexecdir}/%{name}/gpaste-settings

# Install bash/zsh completion support
install -d $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d/
install -pm 0644 data/completions/%{name} -t $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d/
install -d $RPM_BUILD_ROOT%{_datadir}/zsh/site-functions/
install -pm 0644 data/completions/_%{name} -t $RPM_BUILD_ROOT%{_datadir}/zsh/site-functions/

desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/%{name}-settings.desktop

%find_lang %{alt_name}


%post libs -p /sbin/ldconfig


%postun libs -p /sbin/ldconfig


%postun
if [ $1 -eq 0 ]; then
  /usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || :
fi

%posttrans
/usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || :


%files -f %{alt_name}.lang
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS THANKS TODO
%{_bindir}/%{name}
%{_libexecdir}/%{name}/
%{_datadir}/applications/%{name}-settings.desktop
%{_datadir}/dbus-1/services/*.service
%{_datadir}/glib-2.0/schemas/*.xml
%{_datadir}/vala/vapi/*
%{_datadir}/zsh/
%{_mandir}/man1/%{name}.1.*
%{_sysconfdir}/bash_completion.d/


%files libs
%defattr(-,root,root,-)
%{_libdir}/girepository-1.0/%{alt_name}-1.0.typelib
%{_libdir}/*.so.*


%files devel
%defattr(-,root,root,-)
%{_datadir}/gir-1.0/*.gir
%{_includedir}/%{name}/
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc


%files -n gnome-shell-extensions-%{name}
%defattr(-,root,root,-)
%{_datadir}/gnome-shell/extensions/GPaste@gnome-shell-extensions.gnome.org/


%changelog
* Sat Aug 31 2013 Toshiharu Kudoh <toshi.kd2@gmail.com> - 3.0.2-1
- initial build for VineSeed

* Sat May 19 2012 Mohamed El Morabity <melmorabity@fedoraproject.org> - 2.8.1-1
- Update to 2.8.1

* Thu May 03 2012 Mohamed El Morabity <melmorabity@fedoraproject.org> - 2.8-1
- Update to 2.8

* Sun Apr 08 2012 Mohamed El Morabity <melmorabity@fedoraproject.org> - 2.5-2
- Fix Group and Requires tags in subpackages

* Fri Mar 30 2012 Mohamed El Morabity <melmorabity@fedoraproject.org> - 2.5-1
- Update to 2.5

* Sat Jan 07 2012 Mohamed El Morabity <melmorabity@fedoraproject.org> - 2.2.1-1
- Update to 2.2.1

* Fri Dec 09 2011 Mohamed El Morabity <melmorabity@fedoraproject.org> - 2.1-1
- Update to 2.1

* Tue Nov 29 2011 Mohamed El Morabity <melmorabity@fedoraproject.org> - 2.0-1
- Update to 2.0

* Sun Sep 25 2011 Mohamed El Morabity <melmorabity@fedoraproject.org> - 1.6-1
- Update to 1.6
- Remove no longer needed gpaste-1.5-DOS.patch patch

* Wed Sep 14 2011 Mohamed El Morabity <melmorabity@fedorapeople.org> - 1.5-1
- Update to 1.5
- Remove gpaste-1.3-remove_applet_refs.patch patch (there is no more reference
  to the GNOME 2 applet in documentation and completion files)
- Add gpaste-1.5-DSO.patch to fix DSO linking

* Sat Sep 03 2011 Mohamed El Morabity <melmorabity@fedoraproject.org> - 1.3-1
- Update to 1.3

* Sun Jul 10 2011 Mohamed El Morabity <melmorabity@fedoraproject.org> - 1.2-1
- Update to 1.2

* Sat Jun 25 2011 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.99-1.17dd47git
- Initial RPM release
