File zerotier-one.spec of Package zerotier-one

Name:          zerotier-one
Version:       1.10.1
Release:       1%{?dist}
Summary:       ZeroTier is a software defined networking layer for Earth

License:       Business Source License 1.1
URL:           https://github.com/zerotier/ZeroTierOne
Source0:       https://github.com/zerotier/ZeroTierOne/archive/%{version}/%{name}-%{version}.tar.gz
Source1:       vendor.tar.xz
Source2:       cargo_config

BuildRequires: cargo
BuildRequires: cargo-packaging
BuildRequires: execstack
BuildRequires: gcc-c++
BuildRequires: groff
BuildRequires: http-parser-devel
BuildRequires: libjson-c-devel
BuildRequires: libopenssl-devel
BuildRequires: nodejs18
BuildRequires: ruby3.1-rubygem-ronn
BuildRequires: rust
BuildRequires: sqlite-devel

%{?systemd_requires}
BuildRequires: systemd

%description
ZeroTier is a software defined networking layer for Earth.

It can be used for on-premise network virtualization, as a peer to peer VPN
for mobile teams, for hybrid or multi-data-center cloud deployments, or just
about anywhere else secure software defined virtual networking is useful.

ZeroTier One is our OS-level client service. It allows Mac, Linux, Windows,
FreeBSD, and soon other types of clients to join ZeroTier virtual networks
like conventional VPNs or VLANs. It can run on native systems, VMs, or
containers (Docker, OpenVZ, etc.).

%prep
mkdir .cargo
cp %{SOURCE2} .cargo/config
%setup -q -n ZeroTierOne-%{version}
%setup -q -D -n ZeroTierOne-%{version}/zeroidc -a 1
%setup -q -D -n ZeroTierOne-%{version} -T

%build
make \
    CXXFLAGS="$RPM_OPT_FLAGS"\
    CFLAGS="$RPM_OPT_FLAGS"\
    LDFLAGS="$RPM_LD_FLAGS"\
    ZT_USE_MINIUPNPC=1\
    ZT_ENABLE_CLUSTER=1\
    ZT_ENABLE_NETWORK_CONTROLLER=1\
    %{?_smp_mflags}\
    one\
    manpages

%install
make install DESTDIR=$RPM_BUILD_ROOT
execstack -c $RPM_BUILD_ROOT%{_sbindir}/*

mkdir -p $RPM_BUILD_ROOT%{_unitdir}
cp debian/zerotier-one.service $RPM_BUILD_ROOT%{_unitdir}/%{name}.service

%check
make \
    CXXFLAGS="$RPM_OPT_FLAGS"\
    CFLAGS="$RPM_OPT_FLAGS"\
    LDFLAGS="$RPM_LD_FLAGS"\
    ZT_USE_MINIUPNPC=1\
    ZT_ENABLE_CLUSTER=1\
    ZT_ENABLE_NETWORK_CONTROLLER=1\
    %{?_smp_mflags}\
    selftest
./zerotier-selftest

%pre
%service_add_pre zerotier-one.service

%post
%service_add_post zerotier-one.service

%preun
%systemd_preun zerotier-one.service

%postun
%systemd_postun_with_restart zerotier-one.service

%files
%{_sbindir}/*
%{_mandir}/man1/*
%{_mandir}/man8/*
%{_unitdir}/%{name}.service
# compatibility symlinks to binaries
%dir %{_sharedstatedir}/%{name}
%{_sharedstatedir}/%{name}/*

%doc AUTHORS.md README.md
%license COPYING

%changelog
openSUSE Build Service is sponsored by