File telegram-cli.spec of Package telegram-cli

#
# spec file for package tg
#
# Copyright (c) 2015 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/
#

%define lib_ver	2.0.1

# SLE doesn't seem to have jansson
%define has_jansson 0%{?sles_version} == 0 && 0%{?suse_version} != 1315

Name:           telegram-cli
Version:        1.3.1
Release:        0
Summary:        Command line telegram client
License:        GPL-2.0
Group:          TBD
Url:            https://github.com/vysheng/tg
Source0:        tg-%{version}.tar.gz
Source1:	tgl-%{lib_ver}.tar.gz
Source2:	tl-parser.tar.gz
BuildRequires:  libconfig-devel
%if %has_jansson
BuildRequires:	libjansson-devel
%endif
BuildRequires:  libevent-devel
BuildRequires:  lua-devel
BuildRequires:  openssl-devel
BuildRequires:  readline-devel
BuildRequires:  pkgconfig(zlib)

%description
Command line client for telegram IM network.

%prep
%setup -q -n tg-%{version} -a 1 -a 2
rmdir tgl
mv tgl-%{lib_ver} tgl
rmdir tgl/tl-parser
mv tl-parser-master tgl/tl-parser

%build
%configure \
    --enable-libconfig \
    --enable-extf \
    --enable-liblua \
%if %has_jansson
    --enable-json \
%else
    --disable-json \
%endif
    --disable-valgrind \
    --with-progname=%{name}
    
make %{?_smp_mflags}

%install
install -m 0755 -d %{buildroot}%{_bindir}
install -m 0755 -D -t %{buildroot}%{_bindir}/ bin/%{name}

install -m 0755 -d %{buildroot}%{_sysconfdir}/%{name}
install -m 0644 -D -t %{buildroot}%{_sysconfdir}/%{name} {tg-,}server.pub

install -m 0755 -d %{buildroot}%{_mandir}/man8
install -m 0644 -D -t %{buildroot}%{_mandir}/man8 debian/%{name}.8

%files
%{_bindir}/%{name}
%dir %{_sysconfdir}/%{name}
%config %{_sysconfdir}/%{name}/*
%{_mandir}/man8/%{name}.8*
%doc CHANGELOG README.md README-LUA

openSUSE Build Service is sponsored by