File telegram-cli.spec of Package telegram-cli
#
# spec file for package telegram-cli
#
# Copyright (c) 2015 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/
#
%global py2dir %{_builddir}/python2-%{name}-%{version}-%{release}
%global py3dir %{_builddir}/python3-%{name}-%{version}-%{release}
Name: telegram-cli
Version: 1.3.1
Release: 0
License: GPL-2.0
Summary: Telegram messenger CLI
Url: https://github.com/vysheng/tg
Group: Productivity/Networking/Instant Messenger
Source: %{name}-%{version}.tar.xz
BuildRequires: pkgconfig
BuildRequires: pkgconfig(jansson)
BuildRequires: pkgconfig(libconfig)
BuildRequires: pkgconfig(libevent)
BuildRequires: pkgconfig(lua)
BuildRequires: pkgconfig(openssl)
BuildRequires: readline-devel
Requires: %{name}-data = %{version}-%{release}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Command-line interface for Telegram. Uses readline interface.
%package data
Summary: Telegram-cli licenses and config files
BuildArch: noarch
%description data
Command-line interface for Telegram. Uses readline interface.
Telegram-cli licenses and config files
%package -n python2-%{name}
Summary: Telegram-cli Python2 binding
BuildRequires: pkgconfig(python)
Requires: %{name}-data = %{version}-%{release}
%description -n python2-%{name}
Command-line interface for Telegram. Uses readline interface.
Telegram-cli Python2 binding
%package -n python3-%{name}
Summary: Telegram-cli Python3 binding
BuildRequires: pkgconfig(python3)
Requires: %{name}-data = %{version}-%{release}
%description -n python3-%{name}
Command-line interface for Telegram. Uses readline interface.
Telegram-cli Python3 binding
%prep
%setup -q
sed -i '/EVENT_V2/s/$/\n#define EVENT_V2 1/' tgl/config.h.in
chmod 0644 README-Cygwin.md
rm -rf %{py2dir}
cp -a . %{py2dir}
sed -i \
's|for python in python3.4 python3.3 python3.2 python3.1 python3 python2.7 python2.6 python2 python; do|for python in python%{py_ver} python2.6 python2; do|g' \
%{py2dir}/ax_python.m4 %{py2dir}/configure
rm -rf %{py3dir}
cp -a . %{py3dir}
sed -i \
's|for python in python3.4 python3.3 python3.2 python3.1 python3 python2.7 python2.6 python2 python; do|for python in python%{py3_ver}m python3; do|g' \
%{py3dir}/ax_python.m4 %{py3dir}/configure
%build
%configure --enable-extf \
--enable-json \
--enable-libconfig \
--enable-liblua \
--disable-python \
--disable-valgrind \
--with-zlib=%{_prefix} \
--with-openssl=%{_prefix} \
--with-progname=%{name}
make %{?_smp_mflags}
pushd %{py2dir}
%configure --enable-extf \
--enable-json \
--enable-libconfig \
--enable-liblua \
--enable-python \
--disable-valgrind \
--with-zlib=%{_prefix} \
--with-openssl=%{_prefix} \
--with-progname=%{name}
make %{?_smp_mflags}
popd
pushd %{py3dir}
%configure --enable-extf \
--enable-json \
--enable-libconfig \
--enable-liblua \
--enable-python \
--disable-valgrind \
--with-zlib=%{_prefix} \
--with-openssl=%{_prefix} \
--with-progname=%{name}
make %{?_smp_mflags}
popd
%install
install -dm 0755 %{buildroot}%{_bindir}
install -dm 0755 %{buildroot}%{_sysconfdir}/%{name}
install -dm 0755 %{buildroot}%{_mandir}/man8
install -Dm 0755 bin/%{name} %{buildroot}%{_bindir}
install -Dm 0755 bin/tl-parser %{buildroot}%{_bindir}
install -Dm 0755 bin/generate %{buildroot}%{_bindir}
pushd %{py2dir}
install -Dm 0755 bin/%{name} %{buildroot}%{_bindir}/py2-%{name}
install -Dm 0755 bin/tl-parser %{buildroot}%{_bindir}/py2-tl-parser
install -Dm 0755 bin/generate %{buildroot}%{_bindir}/py2-generate
popd
pushd %{py3dir}
install -Dm 0755 bin/%{name} %{buildroot}%{_bindir}/py3-%{name}
install -Dm 0755 bin/tl-parser %{buildroot}%{_bindir}/py3-tl-parser
install -Dm 0755 bin/generate %{buildroot}%{_bindir}/py3-generate
popd
install -Dm 0644 server.pub %{buildroot}%{_sysconfdir}/%{name}
install -Dm 0644 debian/%{name}.8 %{buildroot}%{_mandir}/man8
%files
%defattr(-,root,root)
%{_bindir}/%{name}
%{_bindir}/tl-parser
%{_bindir}/generate
%files data
%defattr(-,root,root)
%doc CHANGELOG LICENSE README-Cygwin.md README.es README-LUA README.md README-PY.md
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/server.pub
%{_mandir}/man8/%{name}.8*
%files -n python2-%{name}
%defattr(-,root,root)
%{_bindir}/py2-%{name}
%{_bindir}/py2-tl-parser
%{_bindir}/py2-generate
%files -n python3-%{name}
%defattr(-,root,root)
%{_bindir}/py3-%{name}
%{_bindir}/py3-tl-parser
%{_bindir}/py3-generate