File td.spec of Package tdlib

#
# spec file for package td
#
# Copyright (c) 2021 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%global _lto_cflags %{?_lto_cflags} -ffat-lto-objects

Name:           td
Version:        1.7.0
Release:        0
Summary:        Cross-platform library for building Telegram clients
License:        BSL-1.0
URL:            https://core.telegram.org/tdlib
Source:         %{name}-%{version}.tar.xz
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  gperf
# build on low mormory devices
BuildRequires:  php
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(zlib)

%description
TDLib (Telegram Database library) is a cross-platform library for building
Telegram clients. It can be easily used from almost any programming language.

%package devel
Summary:        Development files for %{name}
# FIXME: use correct group or remove it, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}-%{release}

%description devel
%{summary}.

Devel package

%package static
Summary:        Static lib files for %{name}
# FIXME: use correct group or remove it, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}-%{release}

%description static
%{summary}.

Static .a package

%prep
%setup -q

%build
%cmake
%cmake_build prepare_cross_compiling
pushd %{_builddir}/%{name}-%{version} || exit
php SplitSource.php
popd || exit
%cmake_build tdjson
pushd %{_builddir}/%{name}-%{version} || exit
php SplitSource.php --undo
popd || exit

%install
%cmake_install

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%license LICENSE_1_0.txt
%doc CHANGELOG.md README.md
%{_libdir}/*.so.*

%files devel
%{_includedir}/td
%{_libdir}/*.so
%{_libdir}/cmake/Td
%dir %{_libdir}/cmake
%dir %{_libdir}/cmake/Td
%{_libdir}/pkgconfig/*.pc

%files static
%{_libdir}/*.a

%changelog
openSUSE Build Service is sponsored by