File profanity.spec of Package profanity

#
# spec file for package profanity
#
# Copyright (c) 2018 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:           profanity
Version:        0.5.1
Release:        0
Summary:        Console-based XMPP client
License:        SUSE-GPL-3.0+-with-openssl-exception
Group:          Productivity/Networking/Instant Messenger
Url:            http://profanity.im/
Source:         http://profanity.im/%{name}-%{version}.tar.gz
Source1:        profanity-rpmlintrc
BuildRequires:  glib2-devel >= 2.26
BuildRequires:  gtk2-devel
BuildRequires:  libcurl-devel
BuildRequires:  libexpat-devel
BuildRequires:  libgpgme-devel
BuildRequires:  libmesode-devel >= 0.9.0
BuildRequires:  libnotify-devel
BuildRequires:  libotr-devel
BuildRequires:  libuuid-devel
BuildRequires:  ncurses-devel
BuildRequires:  python3-devel
BuildRequires:  readline-devel
Requires:       libmesode0 >= 0.9.0
Requires:       profanity-binary = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Profanity is a console-based XMPP client written in C using ncurses,
and inspired by Irssi.

%package mini
Summary:        Console-based XMPP client
Group:          Productivity/Networking/Instant Messenger
Requires:       profanity = %{version}
Requires(post): update-alternatives
Requires(preun): update-alternatives
Provides:       profanity-binary = %{version}-%{release}

%description mini
Profanity is a console-based XMPP client written in C using ncurses,
and inspired by Irssi.
This package holds a minimal version, with most options not compiled
in to have fewer dependencies. It is thus well suited for headless
servers.

%package standard
Summary:        Console-based XMPP client
Group:          Productivity/Networking/Instant Messenger
Requires:       profanity = %{version}
Requires(post): update-alternatives
Requires(preun): update-alternatives
Provides:       profanity-binary = %{version}-%{release}

%description standard
Profanity is a-console based XMPP client written in C using ncurses,
and inspired by Irssi.

This package holds the standard version.
Including:
 * Desktop notifications (OSD)
 * Tray icon

%prep
%setup -q
sed -i -e "s/python-config/python3-config/g" configure

%build
%configure PYTHON_VERSION=3 \
	--enable-notifications \
	--enable-otr \
	--with-themes \
	--enable-pgp \
	--enable-python-plugins \
	--enable-c-plugins \
	--enable-plugins \
	--enable-icons

make %{?_smp_mflags}

%install
make %{?_smp_mflags} DESTDIR=%{buildroot} install
rm %{buildroot}%{_libdir}/libprofanity.la

mv %{buildroot}%{_bindir}/profanity{,-standard}

make clean

%configure PYTHON_VERSION=3 \
	--disable-notifications \
	--enable-otr \
	--with-themes \
	--enable-pgp \
	--enable-python-plugins \
	--enable-c-plugins \
	--enable-plugins \
	--disable-icons

make %{?_smp_mflags}
make %{?_smp_mflags} DESTDIR=%{buildroot} install
rm %{buildroot}%{_libdir}/libprofanity.la

mv %{buildroot}%{_bindir}/profanity{,-mini}

# u-a handling
mkdir -p %{buildroot}%{_sysconfdir}/alternatives/
ln -s profanity %{buildroot}%{_sysconfdir}/alternatives/profanity
ln -s profanity %{buildroot}%{_bindir}/profanity

%files
%defattr(-,root,root)
%{_mandir}/man1/profanity.1%{ext_man}
%dir %{_datadir}/profanity/
%dir %{_datadir}/profanity/themes/
%dir %{_datadir}/profanity/icons/
%{_datadir}/profanity/themes/*
%{_datadir}/profanity/icons/*
# for now we will have them here
%{_libdir}/libprofanity.so
%{_includedir}/profapi.h

%files mini
%defattr(-,root,root)
%ghost %{_sysconfdir}/alternatives/profanity
%ghost %{_bindir}/profanity
%{_bindir}/profanity-mini

%files standard
%defattr(-,root,root)
%ghost %{_sysconfdir}/alternatives/profanity
%ghost %{_bindir}/profanity
%{_bindir}/profanity-standard

%post mini
%{_sbindir}/update-alternatives --install \
    %{_bindir}/profanity profanity %{_bindir}/profanity-mini 10

%preun mini
if [ "$1" = 0 ] ; then
  %{_sbindir}/update-alternatives --remove profanity %{_bindir}/profanity-mini
fi

%post standard
%{_sbindir}/update-alternatives --install \
    %{_bindir}/profanity profanity %{_bindir}/profanity-standard 20

%preun standard
if [ "$1" = 0 ] ; then
  %{_sbindir}/update-alternatives --remove profanity %{_bindir}/profanity-standard
fi

%changelog
openSUSE Build Service is sponsored by