File openfortivpn.spec of Package openfortivpn

%define realname openfortivpn
%define srcext   tar.bz2

%define openssl_req_ver 0.9.8

%if 0%{?suse_version} >= 1230 || 0%{?rhel} >= 7
%bcond_without systemd
%else
%bcond_with systemd
%endif

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

# Common info
Name:          %{realname}
Version:       0
Release:       wiz%{?extraver:0.}1%{?dist}
License:       GPL-3.0
Group:         Productivity/Networking/Security
URL:           https://github.com/adrienverge/openfortivpn
Summary:       Client for PPP+SSL VPN tunnel services

# Install-time parameters
Requires:      ppp
Requires:      openresolv

# Packages needed to define _unitdir
%if %{with systemd}
BuildRequires: systemd-devel
BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(systemd)
Requires:      systemd
%endif

# Build-time parameters
BuildRequires: autoconf automake libtool
BuildRequires: pkg-config
BuildRequires: openresolv
BuildRequires: pkgconfig(libssl)    >= %{openssl_req_ver}
BuildRequires: pkgconfig(libcrypto) >= %{openssl_req_ver}
BuildRoot:     %{_tmppath}/%{name}-root
Source:        %{realname}-%{version}%{?extraver}.%{srcext}

%description
openfortivpn is a client for PPP+SSL VPN tunnel services. It spawns a pppd
process and operates the communication between the gateway and this process.

It is compatible with Fortinet VPNs.

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}
test -x configure || autoreconf --install

%build
_CFLAGS='%{optflags} %{?gcc_lto}'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,-z,now -Wl,-z,relro %{?gcc_lto}'
%configure \
  --with-pppd=%{_sbindir}/pppd \
  --enable-proc \
  --with-resolvconf \
  --enable-resolvconf \
  CFLAGS="$_CFLAGS" \
  LDFLAGS="$_LDFLAGS"
%{__make} %{?_smp_mflags}

%install
%{__make} install DESTDIR=%{buildroot}

%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%files
%defattr(-,root,root)
%doc CHANGELOG.md LICENSE LICENSE.OpenSSL README.md
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/config
%{_bindir}/%{name}
%{_datadir}/%{name}
%if %{with systemd}
%{_unitdir}/openfortivpn@.service
%endif
%doc %{_mandir}/man1/%{name}.1*

%changelog
openSUSE Build Service is sponsored by