LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File transmission.spec of Package transmission (Project home:sagiben)

#
# spec file for package transmission
#
# Copyright (c) 2017 SUSE LINUX 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
Version:        2.92
Release:        0
Summary:        Lightweight, yet powerful BitTorrent client
License:        (GPL-2.0 or GPL-3.0) and MIT
Group:          Productivity/Networking/Other
Url:            http://www.transmissionbt.com/
Source0:        http://download.m0k.org/transmission/files/%{name}-%{version}.tar.xz
Source1:        transmission-qt.desktop
Source2:        transmission-daemon-systemd
Source3:        README.openSUSE
Source4:        transmission-qt.appdata.xml
# PATCH-FIX-UPSTREAM transmission-appdata.patch badshah400@gmail.com -- Add and install appdata files for both gtk and qt applications; enable translations for the gtk metainfo
Patch0:         transmission-appdata.patch
# PATCH-FIX-UPSTREAM transmission-systemd.patch dimstar@opensuse.org -- Fix build with systemd 232, patch taken from git
Patch1:         transmission-systemd.patch
# Patch0 touches autotool files
# PATCH-FIX-UPSTREAM support for OpenSSL 1.1
Patch2:         0001-transmission-build-against-openssl-1.1.0.patch
# PATCH-FIX-UPSTREAM support for OpenSSL 1.1
Patch3:         0002-Fix-coding-style-and-building-with-TR_LIGHTWEIGHT.patch
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  intltool
BuildRequires:  libtool
%if 0%{?WITH_APPINDICATOR}
BuildRequires:  libappindicator-devel >= 0.4.90
%endif
BuildRequires:  libb64-devel
BuildRequires:  libcurl-devel
BuildRequires:  libevent-devel >= 2.0.0
BuildRequires:  libminiupnpc-devel
BuildRequires:  libqt5-linguist
BuildRequires:  libqt5-qtbase-devel
BuildRequires:  openssl-devel >= 0.9.7
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(glib-2.0) >= 2.32.0
BuildRequires:  pkgconfig(gtk+-3.0) >= 3.4.0
BuildRequires:  pkgconfig(libsystemd) >= 209
BuildRequires:  pkgconfig(zlib) >= 1.2.3
Requires:       %{name}-common = %{version}
Provides:       %{name}-ui = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires(post): update-alternatives
Requires(postun): update-alternatives

%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
Recommends:     %{name}-gtk-lang
Provides:       %{name}-ui = %{version}
Requires(post): update-alternatives
Requires(postun): update-alternatives

%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}
Recommends:     %{name}-qt-lang
Provides:       %{name}-ui = %{version}
Requires(post): update-alternatives
Requires(postun): update-alternatives

%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}
BuildArch:      noarch

%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.

%package daemon
Summary:        Lightweight, yet powerful BitTorrent client - daemon
Group:          Productivity/Networking/Other
%{?systemd_requires}

%description daemon
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
%lang_package -n %{name}-qt
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
cp %{S:3} .

%build
# Prevent m4_copy error when running aclocal
# m4_copy: won't overwrite defined macro: glib_DEFUN
rm m4/glib-gettext.m4 || exit 1
autoreconf
export CFLAGS="%{optflags} -fPIC"
export CXXFLAGS="%{optflags} -fPIC"
%configure \
        --disable-static \
%if 0%{?WITH_APPINDICATOR}
        --enable-libappindicator \
%endif
	--with-gtk \
        --enable-external-b64 \
        --enable-cli
make %{?_smp_mflags}
# the qt ui requires an extrawurst for now
cd qt
qmake-qt5 QMAKE_CXXFLAGS="%{optflags} -fPIC" qtr.pro
make %{?_smp_mflags}
lrelease-qt5 translations/*.ts

%install
%make_install
# install qt ui
cd qt
make install INSTALL_ROOT=%{buildroot}%{_prefix}
install -d %{buildroot}%{_datadir}/qt5/translations/
install -m0644 translations/*.qm %{buildroot}%{_datadir}/qt5/translations/
install -D -m 0644 %{S:2} %{buildroot}%{_unitdir}/transmission-daemon.service
install -d %{buildroot}%{_sbindir}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rctransmission-daemon
mkdir -p %{buildroot}%{_localstatedir}/lib/transmission
cd ..
# create targets for transmission below /etc/alternatives/
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
ln -s -f %{_sysconfdir}/alternatives/transmission %{buildroot}/%{_bindir}/transmission
ln -s -f %{_sysconfdir}/alternatives/transmission.1.gz %{buildroot}/%{_mandir}/man1/transmission.1.gz
%find_lang transmission-gtk %{?no_lang_C}
%find_lang transmission transmission-qt.lang --with-qt --without-mo %{?no_lang_C}
%suse_update_desktop_file transmission-gtk
%suse_update_desktop_file -i transmission-qt
%fdupes %{buildroot}

# Install metainfo for qt
install -Dm0644 %{S:4} %{buildroot}%{_datadir}/appdata/transmission-qt.appdata.xml

%clean
rm -rf %{buildroot}

%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 BT daemon user" transmission
%service_add_pre transmission-daemon.service

%post daemon
%service_add_post transmission-daemon.service

%preun daemon
%service_del_preun transmission-daemon.service

%postun daemon
%service_del_postun transmission-daemon.service

%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
%desktop_database_post

%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
%desktop_database_post

%post common
%icon_theme_cache_post

%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
%desktop_database_postun

%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
%desktop_database_postun

%postun common
%icon_theme_cache_postun

%files
%defattr(-,root,root)
%doc AUTHORS NEWS README COPYING README.openSUSE
%{_bindir}/transmission-cli
%{_bindir}/transmission-create
%{_bindir}/transmission-edit
%{_bindir}/transmission-remote
%{_bindir}/transmission-show
%doc %{_mandir}/man1/transmission-cli.1*
%doc %{_mandir}/man1/transmission-create.1*
%doc %{_mandir}/man1/transmission-edit.1*
%doc %{_mandir}/man1/transmission-remote.1*
%doc %{_mandir}/man1/transmission-show.1*
# Update-Alternative managed
%{_bindir}/transmission
%{_mandir}/man1/transmission.1%{?ext_man}
%ghost %{_sysconfdir}/alternatives/transmission
%ghost %{_sysconfdir}/alternatives/transmission.1.gz

%files daemon
%defattr(-,root,root)
%doc AUTHORS NEWS README COPYING README.openSUSE
%dir %{_localstatedir}/lib/transmission
%doc %{_mandir}/man1/transmission-daemon.1*
%{_bindir}/transmission-daemon
%{_sbindir}/rctransmission-daemon
%{_unitdir}/transmission-daemon.service
%attr(-,transmission,transmission)%{_localstatedir}/lib/transmission/

%files -n %{name}-gtk-lang -f transmission-gtk.lang
%defattr(-,root,root)

%files gtk
%defattr(-,root,root)
%doc AUTHORS NEWS README COPYING README.openSUSE
%{_bindir}/transmission-gtk
%{_datadir}/applications/transmission-gtk.desktop
%doc %{_mandir}/man1/transmission-gtk.1*
# Update-Alternative managed
%{_bindir}/transmission
%{_mandir}/man1/transmission.1%{?ext_man}
%ghost %{_sysconfdir}/alternatives/transmission
%ghost %{_sysconfdir}/alternatives/transmission.1.gz
%dir %{_datadir}/appdata
%{_datadir}/appdata/transmission-gtk.appdata.xml

%files -n %{name}-qt-lang -f transmission-qt.lang
%defattr(-,root,root)
%dir %{_datadir}/qt5
%dir %{_datadir}/qt5/translations

%files qt
%defattr(-,root,root)
%doc AUTHORS NEWS README COPYING README.openSUSE
%{_bindir}/transmission-qt
%{_datadir}/applications/transmission-qt.desktop
%doc %{_mandir}/man1/transmission-qt.1*
# Update-Alternative managed
%{_bindir}/transmission
%{_mandir}/man1/transmission.1%{?ext_man}
%ghost %{_sysconfdir}/alternatives/transmission
%ghost %{_sysconfdir}/alternatives/transmission.1.gz
%dir %{_datadir}/appdata
%{_datadir}/appdata/transmission-qt.appdata.xml

%files common
%defattr(-,root,root)
%{_datadir}/transmission/
%{_datadir}/icons/*/*/apps/transmission.*
%{_datadir}/pixmaps/transmission.png

%changelog