Name:	        transmission
Version:	2.84
Release:	1%{?_dist_release}
Summary:	A lightweight BitTorrent client
Summary(ja):	軽量な BitTorrent クライアント

Group:	        Applications/Internet
License:	MIT and GPLv2+
URL:	        http://www.transmissionbt.com/
Source0:        http://download.m0k.org/transmission/files/transmission-%{version}.tar.xz
Source1:        transmission-daemon-init
#Patch0:         desktop_fix.patch

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

BuildRequires:  openssl-devel
BuildRequires:  curl-devel >= 7.18.0
BuildRequires:  dbus-glib-devel
BuildRequires:  glib2-devel >= 2.28.0
BuildRequires:  libnotify-devel
BuildRequires:  gtk3-devel >= 3.2.0
BuildRequires:  desktop-file-utils
BuildRequires:  gettext >= 0.14.1
BuildRequires:  intltool >= 0.40
BuildRequires:  libcanberra-devel
BuildRequires:  libevent-devel

Requires: transmission-cli
Requires: transmission-gtk

Vendor: Project Vine
Distribution: Vine Linux
Packager: kudoh

%description
Transmission is a free, lightweight BitTorrent client. It features a
simple, intuitive interface on top on an efficient, cross-platform
back-end.

%description -l ja
Transmission はフリーで軽量な BitTorrent クライアントです。
シンプル且つ直感的なインターフェイス、クロスプラットフォームなバックエンドが特色です。


%package common
Summary: Common files for Transmission BitTorrent client
Summary(ja): Transmission BitTorrent クライアントの共通ファイル
Group: Applications/Internet
Obsoletes:	transmission =< 1.83

%description common
Transmission is a free, lightweight BitTorrent client. This package
contains the common files used by the different front-ends.

%description -l ja common
Transmission はフリーで軽量な BitTorrent クライアントです。
このパッケージは異なるフロントエンドにより使用される
共通ファイルを含みます。

%package cli
Summary:       Transmission command line implementation
Summary(ja):   Transmission のコマンドライン実装
Group:         Applications/Internet
Requires:      transmission-common
Provides:      transmission = %{version}-%{release}

%description cli
Command line version of Transmission BitTorrent client.

%description cli -l ja
Transmission BitTorrent クライアントのコマンドライン版です。

%package daemon
Summary:       Transmission daemon
Summary(ja):   Transmission デーモン
Group:         Applications/Internet
Requires:      transmission-common
Requires(pre): shadow-utils
Requires(post): chkconfig
Requires(preun): chkconfig
Requires(preun): initscripts
Requires(postun): initscripts
Provides:      transmission = %{version}-%{release}

%description daemon
Transmission BitTorrent client daemon.

%description daemon -l ja
Transmission BitTorrent クライアントデーモンです。

%package gtk
Summary: GTK Interface for Transmission BitTorrent client
Summary(ja): Transmission BitTorrent client の GTK インターフェイス
Group: Applications/Internet
BuildRequires:  gtk3-devel >= 3.2.0

Requires:	%{name}-common = %{version}
Provides:	%{name} = %{version}-%{release}
Provides:	%{name}-gui = %{version}-%{release}
Obsoletes:	transmission =< 1.83

%description gtk
Transmission is a free, lightweight BitTorrent client. It features a
simple, intuitive interface on top of an efficient back-end.

This package provides the GTK Interface.

%description -l ja gtk
Transmission はフリーで軽量な BitTorrent クライアントです。 
シンプル且つ直感的なインターフェイス、クロスプラットフォームなバックエンドが特色です。

このパッケージは GTK インターフェイスを提供します。

%package qt
Summary: Qt4 Interface for Transmission BitTorrent client
Summary(ja): Transmission BitTorrent client の Qt4 インターフェイス
Group: Applications/Internet
Provides:	%{name}-gui = %{version}-%{release}
Requires:	%{name}-common = %{version}
BuildRequires:	qt4-devel qt4-designer

%description qt
Transmission is a simple BitTorrent client. It features a very simple,
intuitive interface on top on an efficient, cross-platform back-end.

This package contains QTransmission, a QT4 based GUI for Transmission
loosely based on the GTK+ client.

%description -l ja qt
Transmission はフリーで軽量な BitTorrent クライアントです。
シンプル且つ直感的なインターフェイス、クロスプラットフォームなバックエンドが特色です。

このパッケージは QTransmission - GTK+ クライアントに概ね基づいた
Transmission の QT4 ベース GUI - を含みます。

%pre daemon
getent group transmission >/dev/null || groupadd -r transmission
getent passwd transmission >/dev/null || \
useradd -r -g transmission -d /var/lib/transmission -s /sbin/nologin \
        -c "transmission daemon account" transmission
exit 0

%prep
%setup -q
#sed -i "s/x-bittorrent;x-scheme-handler\/magnet;/x-bittorrent;/g" \
#        gtk/transmission-gtk.desktop.in
#sed -i "s/OnlyShowIn=Unity/OnlyShowIn=Unity;/g" \
#        gtk/transmission-gtk.desktop.in
#%patch0 -p1

%build
%configure --disable-static --enable-daemon \
           --enable-utp --enable-nls --enable-cli
make %{?_smp_mflags} CC=%{__cc}
#make CFLAGS="$RPM_OPT_FLAGS"

#for QT gui build
pushd qt
#%{_libdir}/qt4/bin/qmake qtr.pro
%{_libdir}/qt4/bin/qmake QMAKE_LFLAGS="$RPM_LD_FLAGS" QMAKE_CXXFLAGS="$CXXFLAGS -std=c++11" qtr.pro
make %{?_smp_mflags}
popd

%install
rm -rf $RPM_BUILD_ROOT

mkdir -p %{buildroot}%{_initddir}
install -m755 %{SOURCE1} %{buildroot}%{_initddir}/transmission-daemon
mkdir -p %{buildroot}/var/lib/transmission

make install DESTDIR=$RPM_BUILD_ROOT
make install INSTALL_ROOT=%{buildroot}%{_prefix} -C qt

%find_lang %{name}-gtk

desktop-file-install --vendor "" \
        --delete-original \
        --dir $RPM_BUILD_ROOT%{_datadir}/applications/ \
        $RPM_BUILD_ROOT%{_datadir}/applications/%{name}-gtk.desktop

mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
cat > $RPM_BUILD_ROOT%{_datadir}/applications/transmission-qt.desktop << EOF
[Desktop Entry]
Encoding=UTF-8
Name=Qtransmission Bittorrent Client
Name[ja]=Qtransmission Bittorrent クライアント
GenericName=BitTorrent Client
GenericName[ja]=BitTorrent クライアント
Comment=Download and share files over BitTorrent
Comment[ja]=BitTorrent でファイルをダウンロード及び共有します
Exec=transmission-qt %F
Icon=transmission
Terminal=false
Type=Application
MimeType=application/x-bittorrent;
Categories=Network;FileTransfer;P2P;Qt;
NotShowIn=GNOME;MATE;XFCE;LXDE;
EOF

%clean
rm -rf $RPM_BUILD_ROOT

%post daemon
/sbin/chkconfig --add transmission-daemon


%post gtk
touch --no-create %{_datadir}/icons/hicolor || :
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
update-desktop-database > /dev/null 2>&1 || :


%postun gtk
touch --no-create %{_datadir}/icons/hicolor || :
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
update-desktop-database > /dev/null 2>&1 || :

%preun daemon
if [ $1 = 0 ] ; then
    /sbin/service transmission-daemon stop >/dev/null 2>&1
    /sbin/chkconfig --del transmission-daemon
fi

%postun daemon
if [ "$1" -ge "1" ] ; then
    /sbin/service transmission-daemon condrestart >/dev/null 2>&1 || :
fi

%files

%files common
%defattr(-, root, root, -)
%doc AUTHORS COPYING NEWS README
%{_bindir}/transmission-create
%{_bindir}/transmission-edit
%{_bindir}/transmission-remote
%{_bindir}/transmission-show
%{_datadir}/transmission/web/
%{_datadir}/pixmaps/*
%{_datadir}/icons/hicolor/*/apps/transmission.*
%doc %{_mandir}/man1/transmission-create*
%doc %{_mandir}/man1/transmission-edit*
%doc %{_mandir}/man1/transmission-remote*
%doc %{_mandir}/man1/transmission-show*

%files cli
%defattr(-, root, root, -)
%{_bindir}/transmission-cli
%doc %{_mandir}/man1/transmission-cli*

%files daemon
%defattr(-, root, root, -)
%{_bindir}/transmission-daemon
%{_initddir}/transmission-daemon
%attr(-,transmission, transmission)/var/lib/transmission/
%doc %{_mandir}/man1/transmission-daemon*

%files gtk -f %{name}-gtk.lang
%defattr(-,root,root)
%{_bindir}/%{name}-gtk
%{_datadir}/applications/%{name}-gtk.desktop
%{_mandir}/man1/transmission-gtk.1*

%files qt
%defattr(-,root,root)
%{_bindir}/transmission-qt
%{_datadir}/applications/transmission-qt.desktop
%{_mandir}/man1/transmission-qt.1*

%changelog
* Sun Jul 13 2014 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.84-1
- new upstream release
- fixed qmake paramater
- fixed License a little (GPLv2 to GPLv2+)

* Sat Jul 20 2013 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.81-1
- new upstream release

* Sat Jun 29 2013 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.80-1
- new upstream release

* Sun Feb 24 2013 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.77-1
- new upstream release

* Fri Jan 11 2013 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.76-1
- new upstream release

* Fri Dec 14 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.75-1
- new upstream release

* Thu Oct 25 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.73-1
- new upstream release

* Sat Oct 20 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.72-1
- new upstream release

* Thu Sep 27 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.71-1
- new upstream release
- deleted Patch0
- changed BuildRequires: gtk3-devel >= 3.4.0

* Wed Jul 25 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.61-1
- new upstream release
- deleted conditional branch for GTK+2
  - because not supported GTK+2, GTK+3 only

* Sat Jul 07 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.60-1
- new upstream release

* Sat May 26 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.52-1
- new upstream release
- added patch0 to fix .desktop validate

* Thu Apr 26 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.51-1
- new upstream release
- fixed conditional branch

* Thu Feb 23 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.50-1
- new upstream release
- deleted unrecognized option: --enable-gtk 
- fixed transmission-qt desktop entry a little

* Wed Nov 09 2011 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.42-1
- new upstream release
- aded BuildRequires: gtk3-devel >= 3.2.0
  - made conditional branch for Vine 6 (support for GTK+2)

* Mon Oct 10 2011 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.41-1
- new upstream release
- changed BuildRequires
  - gtk2-devel >= 2.6.0 to gtk2-devel >= 2.22.0
  - glib2-devel >= 2.28.0
- deleted unrecognized option: --enable-libcanberra

* Thu Aug 18 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.33-1
- new upstream release
- remove BuildRequires: GConf2-devel

* Wed Aug 17 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.32-2
- rebuild with libnotify-0.7

* Sun Jul 03 2011 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.32-1
- new upstream release

* Thu May 19 2011 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.31-1
- new upstream release
- suppressed warning in installing desktop file
- added configure option
  --enable-utp, --enable-nls, --enable-cli, --enable-daemon

* Wed Apr 20 2011 Daisuke SUZUKI <daisuke@linux.or.jp> 2.22-1
- update to 2.22

* Sat Feb 12 2011 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.20-1
- Update to upstream 2.20

* Wed Jan 12 2011 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.13-2
- rebuilt with openssl-1.0.0c

* Sat Dec 11 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.13-1
- Update to upstream 2.13
- deleted disable option
- added configure option --enable-gtk

* Mon Nov 15 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.12-1
- Update to upstream 2.12

* Mon Oct 18 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.11-1
- Update to upstream 2.11

* Thu Oct 14 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.10-2
- fixed and changed transmission-qt.desktop
  - did not show transmission-qt.desktop in LXDE

* Mon Oct 11 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.10-1
- Update to upstream 2.10

* Mon Aug 9 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.04-1
- Update to upstream 2.04

* Fri Jul 30 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.03-1
- Update to upstream 2.03

* Fri Jul 9 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.01-1
- Update to upstream 2.01

* Fri Jun 18 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 2.00-1
- Update to upstream 2.00

* Tue May 4 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.93-1
- Update to upstream 1.93

* Thu Mar 18 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.92-1
- Update to upstream 1.92
- applied new naming policy to spec

* Mon Feb 22 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.91-1
- Update to upstream 1.91
- changed summary, summary(ja) a little
- added %configure option --enable-libcanberra --enable-daemon
- added Source1 from Fedora
- splitted common, cli, daemon, gtk, qt packages

* Sat Jan 30 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.83-1
- Update to upstream 1.83
- added BuildRequires:  libcanberra-devel, libevent-devel

* Sun Jan 24 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.82-1
- Update to upstream 1.82

* Fri Jan 22 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.80-1
- Update to upstream 1.80
- changed BuildRequires: intltool >= 0.40

* Sun Jan 10 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.77-1
- Update to upstream 1.77
- dropt Patch1
- aded BuildRequires:  GConf2-devel

* Mon Oct 26 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.76-1
- Update to upstream 1.76

* Tue Sep 22 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.75-2
- a few fixed transmission_ja_po.patch
- added --disable-static=no to configure option
- run gtk-update-icon-cache in %post, %postun
- cleaned up spec

* Tue Sep 15 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.75-1
- Update to upstream 1.75

* Sun Jul 19 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.73-1
- Update to upstream 1.73

* Sun Jun 21 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.72-1
- Update to upstream 1.72
- cleaned up spec

* Tue Jun 9 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.71-1
- Update to upstream 1.71

* Sat Jun 6 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.70-1
- Update to upstream 1.70

* Tue May 12 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.61-1
- Update to upstream 1.61
- added BuildRequires:  glib2-devel

* Wed May 6 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.60-1
- Update to upstream 1.60
- spec in UTF-8

* Mon Apr 13 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.52-1
- Update to upstream 1.52
- fixed Desktop-file name
- fixed BuildRoot

* Sat Feb 28 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.51-1
- Update to upstream 1.51
- changed BuildRequires:  curl-devel >= 7.18.0
- dropped Patch1

* Sun Feb 15 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.50-1
- Update to upstream 1.50

* Thu Jan 8 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.42-2
- added Summary(ja)
- fixed Lisense
- added patch1 (transmission-1.42-libevent.patch, from Fedora)
- fixed %build
- changed %install
- fixed %changelog

* Sat Dec 27 2008 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.42-1
- initial build for VineSeed
- Update to upstream 1.42
- dropped Patch0 (transmission-0.71-manpath.patch)
- added patch0 (transmission_ja_po.patch, to fix ja.po)
- modified %files, %install
- modified BuildRoot
- added BuildRequires to curl-devel, dbus-glib-devel, libnotify-devel

* Mon Feb 4 2008 Denis Leroy <denis@poolshark.org> - 1.04-1
- Update to upstream 1.04
- Modified Build-Require

* Thu Aug 16 2007 Denis Leroy <denis@poolshark.org> - 0.80-1
- Update to upstream 0.80

* Wed May  2 2007 Denis Leroy <denis@poolshark.org> - 0.72-1
- Update to 0.72
- Added libevent BR

* Wed Apr 25 2007 Denis Leroy <denis@poolshark.org> - 0.71-1
- Update to 0.71
- Removed custom desktop file
- Added patch to fix manpath

* Thu Sep 28 2006 Denis Leroy <denis@poolshark.org> - 0.6.1-3
- Added project icon
- Honor cc variable

* Mon Sep 25 2006 Denis Leroy <denis@poolshark.org> - 0.6.1-2
- Removed ldconfig Requires

* Wed Sep 13 2006 Denis Leroy <denis@poolshark.org> - 0.6.1-1
- First version

