File tdlib.spec of Package tdlib

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


%define soname  1_8_22
%define commit  24893faf75d84b2b885f3f7aeb9d5a3c056fa7be
%bcond_with     static
%if %{with static}
%define _lto_cflags %{nil}
%endif
Name:           tdlib
Version:        1.8.22
Release:        0
Summary:        Cross-platform library for building Telegram clients
License:        BSL-1.0
URL:            https://github.com/tdlib/td
Source:         %{url}/archive/%{commit}.tar.gz#/td-%{commit}.tar.gz
BuildRequires:  extra-cmake-modules
BuildRequires:  gperf
BuildRequires:  gperftools-devel
BuildRequires:  libressl-devel
BuildRequires:  zlib-devel

%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}
Requires:       libtdapi%{soname} = %{version}
Requires:       libtdclient%{soname} = %{version}
Requires:       libtdjson%{soname} = %{version}

%description devel
%{summary}.

%if %{with static}
%package static
Summary:        Static libraries for %{name}
Requires:       %{name}-devel = %{version}

%description static
%{summary}.
%endif

%package -n libtdapi%{soname}
Summary:        Telegram database API library

%description -n libtdapi%{soname}
%{summary}.

%package -n libtdclient%{soname}
Summary:        Telegram database client library

%description -n libtdclient%{soname}
%{summary}.

%package -n libtdjson%{soname}
Summary:        Telegram database JSON library

%description -n libtdjson%{soname}
%{summary}.

%prep
%autosetup -n td-%{commit}

%build
%cmake
%cmake_build

%install
%cmake_install
%if %{without static}
rm -fv %{buildroot}%{_libdir}/*.a
%endif

%ldconfig_scriptlets -n libtdclient%{soname}
%ldconfig_scriptlets -n libtdjson%{soname}
%ldconfig_scriptlets -n libtdapi%{soname}

%files devel
%license LICENSE_1_0.txt
%doc CHANGELOG* README*
%{_includedir}/td
%{_libdir}/libtd*.so
%{_libdir}/cmake/Td
%{_libdir}/pkgconfig/td*.pc

%files -n libtdapi%{soname}
%{_libdir}/libtdapi.so.%{version}

%files -n libtdclient%{soname}
%{_libdir}/libtdclient.so.%{version}

%files -n libtdjson%{soname}
%{_libdir}/libtdjson.so.%{version}

%if %{with static}
%files static
%{_libdir}/libtd*.a
%endif

%changelog
openSUSE Build Service is sponsored by