File transmission.spec of Package transmission
#
# spec file for package transmission
#
# Copyright (c) 2012 SUSE LINUX Products 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:           transmission
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  glib2-devel >= 2.28.0
%if 0%{?favor_gtk2}
BuildRequires:  gtk2-devel >= 2.22.0
%else
BuildRequires:  pkgconfig(gtk+-3.0) >= 3.2.0
%endif
BuildRequires:  intltool
%if 0%{?WITH_APPINDICATOR}
BuildRequires:  libappindicator-devel >= 0.4.90
%endif
BuildRequires:  libcurl-devel
BuildRequires:  libevent-devel >= 2.0.0
%if 0%{?suse_version} > 1210
BuildRequires:  libminiupnpc-devel
%endif
BuildRequires:  libqt4-devel
BuildRequires:  openssl-devel
BuildRequires:  update-desktop-files
Version:        2.60
Release:        0
Summary:        Lightweight, yet powerful BitTorrent client
License:        GPL-2.0 ; MIT
Group:          Productivity/Networking/Other
Source0:        http://download.m0k.org/transmission/files/%{name}-%{version}.tar.xz
Source1:        transmission-qt.desktop
Url:            http://www.transmissionbt.com/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       %{name}-common = %{version}
Requires(post): update-alternatives
Requires(postun): update-alternatives
Provides:       %{name}-ui = %{version}
%description
Transmission is a fast, easy, and free multi-platform BitTorrent client
with a focus on being lightweight yet feature-filled. Its simple,
intuitive interface is designed to integrate tightly with whatever
computing environment you choose to use. Transmission strikes a balance
between providing useful functionality without feature bloat.
Furthermore, it is free for anyone to use or modify.
%package gtk
Summary:        Lightweight, yet powerful BitTorrent client
Group:          Productivity/Networking/Other
Requires:       %{name}-common = %{version}
# For canberra-gtk-play binary
Requires:       canberra-gtk-play
Requires(post): update-alternatives
Requires(postun): update-alternatives
Recommends:     %{name}-gtk-lang
Provides:       %{name}-ui = %{version}
%description gtk
Transmission is a fast, easy, and free multi-platform BitTorrent client
with a focus on being lightweight yet feature-filled. Its simple,
intuitive interface is designed to integrate tightly with whatever
computing environment you choose to use. Transmission strikes a balance
between providing useful functionality without feature bloat.
Furthermore, it is free for anyone to use or modify.
This package contains a graphical user interface to transmission.
%package qt
Summary:        Lightweight, yet powerful BitTorrent client
Group:          Productivity/Networking/Other
Requires:       %{name}-common = %{version}
Requires(post): update-alternatives
Requires(postun): update-alternatives
Provides:       %{name}-ui = %{version}
%description qt
Transmission is a fast, easy, and free multi-platform BitTorrent client
with a focus on being lightweight yet feature-filled. Its simple,
intuitive interface is designed to integrate tightly with whatever
computing environment you choose to use. Transmission strikes a balance
between providing useful functionality without feature bloat.
Furthermore, it is free for anyone to use or modify.
This package contains a graphical user interface to transmission.
%package common
Summary:        Lightweight, yet powerful BitTorrent client - Common Data
Group:          Productivity/Networking/Other
Requires:       %{name}-ui = %{version}
%if 0%{suse_version} > 1110
BuildArch:      noarch
%endif
%description common
Transmission is a fast, easy, and free multi-platform BitTorrent client
with a focus on being lightweight yet feature-filled. Its simple,
intuitive interface is designed to integrate tightly with whatever
computing environment you choose to use. Transmission strikes a balance
between providing useful functionality without feature bloat.
Furthermore, it is free for anyone to use or modify.
%lang_package -n %{name}-gtk
%prep
%setup -q
%build
export CFLAGS="$RPM_OPT_FLAGS -fPIC"
export CXXFLAGS="$RPM_OPT_FLAGS -fPIC"
%configure \
        --disable-static \
%if 0%{?WITH_APPINDICATOR}
        --enable-libappindicator \
%endif
	--with-gtk
%__make %{?jobs:-j%{jobs}}
# the qt ui requires an extrawurst for now
cd qt
qmake QMAKE_CXXFLAGS="$RPM_OPT_FLAGS -fPIC" qtr.pro
%__make %{?jobs:-j%{jobs}}
%install
%makeinstall
%if 0%{?suse_version} <= 1110
%{__rm} %{buildroot}%{_datadir}/locale/fil/LC_MESSAGES/*
%endif
%if 0%{?suse_version} <= 1130
%{__rm} %{buildroot}%{_datadir}/locale/ceb/LC_MESSAGES/*
%endif
# install qt ui
cd qt
%__make install INSTALL_ROOT=%{buildroot}%{_prefix}
cd ..
# touch files for alternatives
touch %{buildroot}%{_bindir}/transmission
chmod 0755 %{buildroot}%{_bindir}/transmission
touch %{buildroot}%{_mandir}/man1/transmission.1.gz
%find_lang transmission-gtk %{?no_lang_C}
%suse_update_desktop_file transmission-gtk
%suse_update_desktop_file -i transmission-qt
%fdupes $RPM_BUILD_ROOT
%clean
rm -rf %{buildroot}
%post
update-alternatives --install %{_bindir}/transmission           transmission      %{_bindir}/transmission-cli 5         \
                    --slave   %{_mandir}/man1/transmission.1.gz transmission.1.gz %{_mandir}/man1/transmission-cli.1.gz
%post gtk
update-alternatives --install %{_bindir}/transmission           transmission      %{_bindir}/transmission-gtk 15        \
                    --slave   %{_mandir}/man1/transmission.1.gz transmission.1.gz %{_mandir}/man1/transmission-gtk.1.gz
%if 0%{?suse_version} > 1130
%desktop_database_post
%endif
%post qt
update-alternatives --install %{_bindir}/transmission           transmission      %{_bindir}/transmission-qt 10         \
                    --slave   %{_mandir}/man1/transmission.1.gz transmission.1.gz %{_mandir}/man1/transmission-qt.1.gz
%if 0%{?suse_version} > 1130
%desktop_database_post
%endif
%if 0%{?suse_version} > 1130
%post common
%icon_theme_cache_post
%endif
%postun
# Note: we don't use "$1 -eq 0", to avoid issues if the package gets renamed
if [ ! -f %{_bindir}/transmission-cli ]; then
  update-alternatives --remove transmission %{_bindir}/transmission-cli
fi
%postun gtk
# Note: we don't use "$1 -eq 0", to avoid issues if the package gets renamed
if [ ! -f %{_bindir}/transmission-gtk ]; then
  update-alternatives --remove transmission %{_bindir}/transmission-gtk
fi
%if 0%{?suse_version} > 1130
%desktop_database_postun
%endif
%postun qt
# Note: we don't use "$1 -eq 0", to avoid issues if the package gets renamed
if [ ! -f %{_bindir}/transmission-qt ]; then
  update-alternatives --remove transmission %{_bindir}/transmission-qt
fi
%if 0%{?suse_version} > 1130
%desktop_database_postun
%endif
%if 0%{?suse_version} > 1130
%postun common
%icon_theme_cache_postun
%endif
%files
%defattr(-,root,root)
%doc AUTHORS NEWS README COPYING
%ghost %{_bindir}/transmission
%{_bindir}/transmission-cli
%{_bindir}/transmission-create
%{_bindir}/transmission-daemon
%{_bindir}/transmission-edit
%{_bindir}/transmission-remote
%{_bindir}/transmission-show
%ghost %doc %{_mandir}/man1/transmission.1*
%doc %{_mandir}/man1/transmission-cli.1*
%doc %{_mandir}/man1/transmission-create.1*
%doc %{_mandir}/man1/transmission-daemon.1*
%doc %{_mandir}/man1/transmission-edit.1*
%doc %{_mandir}/man1/transmission-remote.1*
%doc %{_mandir}/man1/transmission-show.1*
%files -n %{name}-gtk-lang -f transmission-gtk.lang
%defattr(-,root,root)
%if 0%{?suse_version} <= 1140
%dir %{_datadir}/locale/an
%dir %{_datadir}/locale/an/LC_MESSAGES
%endif
%files gtk
%defattr(-,root,root)
%doc AUTHORS NEWS README COPYING
%ghost %{_bindir}/transmission
%{_bindir}/transmission-gtk
%{_datadir}/applications/transmission-gtk.desktop
%ghost %doc %{_mandir}/man1/transmission.1*
%doc %{_mandir}/man1/transmission-gtk.1*
%files qt
%defattr(-,root,root)
%doc AUTHORS NEWS README COPYING
%ghost %{_bindir}/transmission
%{_bindir}/transmission-qt
%{_datadir}/applications/transmission-qt.desktop
%ghost %doc %{_mandir}/man1/transmission.1*
%doc %{_mandir}/man1/transmission-qt.1*
%files common
%defattr(-,root,root)
%{_datadir}/transmission/
%{_datadir}/icons/*/*/apps/transmission.*
%{_datadir}/pixmaps/transmission.png
%changelog