File daed.spec of Package daed
#
# spec file for package daed
#
# 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/
#
Name: daed
Version: 0.9.0
Release: 0
Summary: A modern web dashboard for dae
License: MIT
Group: Productivity/Networking/Web/Proxy
URL: https://github.com/daeuniverse/daed
Source0: %{name}-full-src.zip
Source1: web.zip
Source2: logo.tar.gz
Source100: daed.rpmlintrc
BuildRequires: update-desktop-files
BuildRequires: clang
BuildRequires: unzip
BuildRequires: pnpm
BuildRequires: nodejs >= 18
BuildRequires: go >= 1.22
BuildRequires: systemd-rpm-macros
Requires: v2ray-rules-dat
%description
In order to improve the traffic split performance as much as
possible, dae runs the transparent proxy and traffic split suite in
the Linux kernel by eBPF. Therefore, dae has the opportunity to make
the direct traffic bypass the forwarding by proxy application and
achieve true direct traffic through. Under such a magic trick, there
is almost no performance loss and additional resource consumption
for direct traffic.
%prep
mkdir -p %{_builddir}/%{name}-%{version}
cd %{_builddir}/%{name}-%{version}
/usr/bin/unzip -qq %{S:0}
/usr/bin/unzip -qq %{S:1}
mv web dist
tar -zxf %{S:2} -C %{_builddir}
%build
cd %{_builddir}/%{name}-%{version}
export GOFLAGS="-buildmode=pie -trimpath -modcacherw"
export CFLAGS="-fno-stack-protector"
sed -i '/^## Begin Git Submodules/,/## End Web$/d' Makefile
make VERSION=%{version}
# Desktop File
cat > daed.desktop <<EOF
[Desktop Entry]
Version=1.0
Terminal=false
Type=Application
Name=daed
GenericName=high-performance proxy tool
GenericName[zh_CN]=高性能代理工具
Comment=A high-performance proxy tool based on eBPF
Comment[zh_CN]=一个基于eBPF的高性能代理工具
Categories=Network;
Keywords=Internet;VPN;Proxy;
Exec=xdg-open "http://127.0.0.1:2023"
Icon=daed.png
EOF
%install
cd %{_builddir}/%{name}-%{version}
install -Dm 755 daed %{buildroot}%{_bindir}/daed
# config
install -d %{buildroot}%{_sysconfdir}/daed
# systemd
install -d %{buildroot}%{_unitdir}
install -Dm 644 install/daed.service %{buildroot}%{_unitdir}/
install -d %{buildroot}%{_sbindir}/
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcdaed
install -d %{buildroot}%{_datadir}/%{name}
# desktop
install -Dm 755 %{name}.desktop %{buildroot}/%{_datadir}/applications/%{name}.desktop
%suse_update_desktop_file %{name}
# icon
for size in 16 24 32 48 64 128 256 512 1024; do
install -Dm 644 %{_builddir}/logo/${size}x${size}.png \
%{buildroot}%{_datadir}/icons/hicolor/${size}x${size}/apps/%{name}.png
done
%pre
%service_add_pre daed.service
%post
%service_add_post daed.service
%{__ln_s} -f %{_datadir}/v2ray-rules-dat/geoip.dat %{_datadir}/%{name}/geoip.dat
%{__ln_s} -f %{_datadir}/v2ray-rules-dat/geosite.dat %{_datadir}/%{name}/geosite.dat
%preun
%service_del_preun daed.service
%postun
%service_del_postun daed.service
# only removed on uninstall, and not upgrade, downgrade, or reinstall
case "$1" in
0)
%{__rm} -f %{_datadir}/%{name}/geoip.dat
%{__rm} -f %{_datadir}/%{name}/geosite.dat
;;
esac
%files
#license LICENSE
#doc README.md docs/getting-started.md
%{_bindir}/daed
%dir %{_sysconfdir}/daed
%{_unitdir}/daed.service
%{_sbindir}/rcdaed
%dir %{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/*
# geoData
%dir %{_datadir}/%{name}
%ghost %{_datadir}/%{name}/geosite.dat
%ghost %{_datadir}/%{name}/geoip.dat
%changelog