File sstp-client.spec of Package sstp-client

#
# spec file for package sstp-client
#
# 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/
#


%global ppp_version %(rpmquery ppp --qf '%{version}')
%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif
%define  major  0
%define  lname  libsstp_api
Name:           sstp-client
Version:        1.0.19
Release:        0
Summary:        Secure Socket Tunneling Protocol (SSTP) Client
License:        GPL-2.0-or-later
Group:          Productivity/Networking/Security
URL:            https://gitlab.com/sstp-project/sstp-client
Source0:        https://gitlab.com/sstp-project/sstp-client/-/releases/%{version}/downloads/dist-gzip/%{name}-%{version}.tar.gz
Source1:        sstpc.tmpfiles
BuildRequires:  automake
BuildRequires:  libtool
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(libevent) >= 2.0.10
BuildRequires:  pkgconfig(libopenssl)
BuildRequires:  ppp-devel >= 2.4.9
Requires:       ppp
Requires(pre):  shadow

%description
SSTP-Client is an SSTP client for Linux. It can be used to establish a SSTP
connection to a Windows 2008 Server. This software is similar commandline
and configuration as the pptp-client software.
SSTP-Client features:
 * Connect to Microsoft RAS network using SSTP
 * Use HTTPS with strong encryption over port 443
 * Asynchronous HDLC frame support
 * Integration with pon/poff with various distributions

%package -n %{lname}-%{major}
Summary:        The libsstp library
Group:          System/Libraries

%description -n %{lname}-%{major}
This package contains the libsstp library.

%package devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{lname}-%{major} = %{version}-%{release}

%description devel
This package contains the necessary header files for %{name} development
This package is required to compile plugin's for %{name}.

%prep
%autosetup

%build
%configure \
    --with-libevent=2 \
    --with-runtime-dir=%{_rundir}/sstpc \
    --with-pppd-plugin-dir=%{_libdir}/pppd/%{ppp_version} \
    --disable-static
%make_build

%install
%make_install
install -Dm 0644 %{SOURCE1} %{buildroot}/%{_tmpfilesdir}/sstpc.conf
rm -rvf %{buildroot}/%{_datadir}/doc/%{name}
find %{buildroot} -type f -name "*.la" -delete -print

%pre
getent group sstpc >/dev/null || groupadd -r sstpc
getent passwd sstpc >/dev/null || useradd -r -g sstpc -d %{_rundir}/sstpc -s /bin/false \
    -c "Secure Socket Tunneling Protocol (SSTP) Client" sstpc

%post
%tmpfiles_create %{_tmpfilesdir}/sstpc.conf

%post -n %{lname}-%{major} -p /sbin/ldconfig
%postun -n %{lname}-%{major} -p /sbin/ldconfig

%files
%doc AUTHORS ChangeLog DEVELOPERS NEWS README TODO USING *.example
%{_sbindir}/sstpc
%dir %{_libdir}/pppd/%{ppp_version}
%{_libdir}/pppd/%{ppp_version}/sstp-pppd-plugin.so
%{_mandir}/man?/sstpc.?%{?ext_man}
%ghost %attr(750,sstpc,sstpc) %dir %{_rundir}/sstpc
%{_tmpfilesdir}/sstpc.conf
%license COPYING

%files -n %{lname}-%{major}
%{_libdir}/%{lname}-%{major}.so

%files devel
%dir %{_includedir}/%{name}
%{_includedir}/%{name}/sstp-api.h
%{_libdir}/%{lname}.so
%{_libdir}/pkgconfig/%{name}-1.0.pc

%changelog
openSUSE Build Service is sponsored by