File libhimmelblau.spec of Package libhimmelblau

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

%{!?python_sitearch:  %global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}

Name:           libhimmelblau
Version:        0.2.6+git.18.af3c614
Release:        0
Summary:	Samba Library for Azure Entra ID Authentication
License:        LGPL-3.0-or-later
Group:          Productivity/Networking/Samba
URL:            https://gitlab.com/samba-team/libhimmelblau
Source:         libhimmelblau-%{version}.tar.bz2
Source1:	vendor.tar.zst
BuildRequires:  cargo-c
BuildRequires:  cargo-packaging
BuildRequires:  clang-devel
BuildRequires:  libclang13
BuildRequires:  libopenssl-3-devel
BuildRequires:  python3-devel
BuildRequires:  python3-maturin
BuildRequires:  patchelf
ExclusiveArch:  %{rust_tier1_arches}
Requires(post): /sbin/ldconfig
Requires(postun):/sbin/ldconfig

%description
A Rust library implementing the MSAL (Microsoft Authentication Library)
specifications for ClientApplication and PublicClientApplication classes,
following Microsoft’s API Reference. Additionally, it includes the [MS-DRS]
enrollment protocol and certain [MS-OAPXBC] functionalities, offering
capabilities not present in Microsoft's official libraries.

%package -n libhimmelblau0
Summary:        Samba himmelblau library
Group:          System/Libraries

%description -n libhimmelblau0
A Rust library implementing the MSAL (Microsoft Authentication Library)
specifications for ClientApplication and PublicClientApplication classes,
following Microsoft’s API Reference. Additionally, it includes the [MS-DRS]
enrollment protocol and certain [MS-OAPXBC] functionalities, offering
capabilities not present in Microsoft's official libraries.

%package devel
Summary:        Development files for libhimmelblau
Group:          Development/Libraries/C and C++
Requires:       libhimmelblau0 = %{version}

%description devel
This package contains the libraries and header files needed to
develop programs which make use of libhimmelblau.

%package -n python3-himmelblau
Summary:        Python3 bindings for the Himmelblau library
Group:          Development/Libraries/Python

%description -n python3-himmelblau
This package contains the Python3 bindings for the Himmelblau library.

%prep
%autosetup -a1

%build
cargo cbuild --offline --release
maturin build --strip --release --offline --target-dir=./target/build

%install
install -D -d -m 0755 %{buildroot}/%{_libdir}/pkgconfig
install -D -d -m 0755 %{buildroot}/%{_libdir}
install -D -d -m 0755 %{buildroot}/%{_includedir}/%{name}
cargo cinstall \
	--release \
	--destdir=%{buildroot} \
	--pkgconfigdir=%{_libdir}/pkgconfig \
	--libdir=%{_libdir} \
	--includedir=%{_includedir} \
	--offline
strip %{buildroot}/%{_libdir}/libhimmelblau.so.*
rm -rf %{buildroot}/%{_libdir}/libhimmelblau.a
install -D -d -m 0755 %{buildroot}/%{python_sitearch}
install -m 0644 ./target/build/release/libhimmelblau.so %{buildroot}/%{python_sitearch}/himmelblau.so
strip %{buildroot}/%{python_sitearch}/himmelblau.so

%postun -n libhimmelblau0
/sbin/ldconfig

%post -n libhimmelblau0
/sbin/ldconfig

%check
%{cargo_test}

%files -n libhimmelblau0
%license LICENSE
%doc README.md DESIGN.md
%{_libdir}/libhimmelblau.so.*

%files devel
%dir %{_includedir}/himmelblau
%{_libdir}/libhimmelblau.so
%{_includedir}/himmelblau/himmelblau.h
%{_libdir}/pkgconfig/himmelblau.pc

%files -n python3-himmelblau
%{python_sitearch}/himmelblau.so

%changelog

openSUSE Build Service is sponsored by