File openiked.spec of Package openiked

#
# spec file for package openiked
#
# Copyright (c) 2026 SUSE LLC and contributors
# Copyright (c) 2022-2024 Alexander Naumov <alexander_naumov@opensuse.org>
#
# 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/
#


Name:           openiked
Version:        7.4
Release:        0
Summary:        Internet Key Exchange version 2 (IKEv2) daemon
License:        ISC
URL:            https://github.com/openiked/openiked-portable
Source0:        https://ftp.openbsd.org/pub/OpenBSD/OpenIKED/%{name}-%{version}.tar.gz
Source1:        https://ftp.openbsd.org/pub/OpenBSD/OpenIKED/%{name}-%{version}.tar.gz.asc
Source2:        https://ftp.openbsd.org/pub/OpenBSD/OpenIKED/%{name}.asc#/%{name}.keyring
Source3:        %{name}.service
Source4:        %{name}-keygen.service
Source5:        %{name}-keygen.target
Source6:        %{name}-keygen
Source7:        %{name}.sysusers
BuildRequires:  bison
BuildRequires:  cmake >= 3.12
BuildRequires:  gcc-c++
BuildRequires:  sysuser-tools
BuildRequires:  pkgconfig(libevent)
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(systemd)
%{?systemd_ordering}
%{?sysusers_requires}

%description
OpenIKED is a FREE implementation of the Internet Key Exchange (IKEv2)
protocol which performs mutual authentication and which establishes and
maintains IPsec VPN security policies and associations (SAs) between peers.

%prep
%autosetup

%build
%sysusers_generate_pre %{SOURCE7} %{name} %{name}.conf
%cmake -DCMAKE_SHARED_LINKER_FLAGS="%{?build_ldflags} -Wl,--as-needed"
%cmake_build

%install
%cmake_install

#install our own unit files
install -Dpm0644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service
install -Dpm0644 %{SOURCE4} %{buildroot}%{_unitdir}/%{name}-keygen.service
install -Dpm0644 %{SOURCE5} %{buildroot}%{_unitdir}/%{name}-keygen.target
install -Dpm0755 %{SOURCE6} %{buildroot}%{_libexecdir}/%{name}/%{name}-keygen

%pre -f %{name}.pre
%service_add_pre %{name}.service %{name}-keygen.service %{name}-keygen.target

%post
%service_add_post %{name}.service %{name}-keygen.service %{name}-keygen.target

%preun
%service_del_preun %{name}.service %{name}-keygen.service %{name}-keygen.target

%postun
%service_del_postun %{name}.service %{name}-keygen.service %{name}-keygen.target

%files
%license LICENSE
%doc README.md
%dir %{_distconfdir}/ssl
%{_distconfdir}/iked.conf
%{_distconfdir}/ssl/ikeca.cnf
%{_distconfdir}/ssl/ikex509v3.cnf
%{_libexecdir}/%{name}
%{_mandir}/man?/ikectl.?%{?ext_man}
%{_mandir}/man?/iked.?%{?ext_man}
%{_mandir}/man?/iked.conf.?%{?ext_man}
%{_sbindir}/ikectl
%{_sbindir}/iked
%{_unitdir}/%{name}-keygen.service
%{_unitdir}/%{name}-keygen.target
%{_unitdir}/%{name}.service

%changelog
openSUSE Build Service is sponsored by