File yggdrasil-go.spec of Package yggdrasil-go
#
# spec file for package yggdrasil-go
#
# Copyright (c) 2021 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 appname yggdrasil
Name: %{appname}-go
Version: 0.5.13
Release: 0
Summary: An experiment in scalable routing as an encrypted IPv6 overlay network
License: LGPL-3.0-only
URL: https://yggdrasil-network.github.io/
Source: %{name}-%{version}.tar.zst
Source1: vendor.tar.zstd
BuildRequires: fdupes
BuildRequires: go >= 1.24
BuildRequires: go-md2man
BuildRequires: golang-packaging
BuildRequires: shadow
BuildRequires: zstd
ExcludeArch: s390
%{?systemd_requires}
%description
Yggdrasil is an early-stage implementation of a fully end-to-end encrypted IPv6 network. It is lightweight, self-arranging,
supported on multiple platforms and allows pretty much any IPv6-capable application to communicate securely with other Yggdrasil nodes.
Yggdrasil does not require you to have IPv6 Internet connectivity - it also works over IPv4.
Although Yggdrasil shares many similarities with cjdns, it employs a different routing algorithm based on a globally-agreed spanning
tree and greedy routing in a metric space, and aims to implement some novel local backpressure routing techniques. In theory,
Yggdrasil should scale well on networks with internet-like topologies.
%prep
%setup -q
%setup -q -T -D -a 1
%build
export PKGNAME="%{name}"
export PKGVER="%{version}"
export CGO_ENABLED=1
go build \
-mod=vendor \
-buildmode=pie \
-ldflags "-s -w -X main.version=%{version}" \
./cmd/%{appname} ;
go build \
-mod=vendor \
-buildmode=pie \
-ldflags "-s -w -X main.version=%{version}" \
./cmd/%{appname}ctl ;
%install
# Install the binary.
install -D -m 0755 %{appname} "%{buildroot}/%{_bindir}/%{appname}"
install -D -m 0755 %{appname}ctl "%{buildroot}/%{_bindir}/%{appname}ctl"
install -m 0644 -D contrib/systemd/%{appname}.service %{buildroot}%{_unitdir}/%{appname}.service
mkdir -p %{buildroot}%{_sbindir}
ln -sf service %{buildroot}%{_sbindir}/rc%{appname}
# Build the man page.
go-md2man -in README.md -out %{name}.1
# Install the man page.
install -D -m 0644 %{name}.1 "%{buildroot}/%{_mandir}/man1/%{name}.1"
rm %{name}.1
%fdupes %{buildroot}
%pre
getent group %{appname} >/dev/null || groupadd -r %{appname}
%service_add_pre %{appname}.service
%post
%service_add_post %{appname}.service
%preun
%service_del_preun %{appname}.service
%postun
%service_del_postun %{appname}.service
%files
%license LICENSE
%doc {CHANGELOG,README}.md
%{_bindir}/%{appname}
%{_bindir}/%{appname}ctl
%{_sbindir}/rcyggdrasil
%{_unitdir}/%{appname}.service
%{_mandir}/man1/%{name}*.1%{?ext_man}
%changelog