%global proj_name SagerNet Name: sing-box Version: 1.14.4 Release: 1%{?dist} Summary: The universal proxy platform. License: GPL-3.0-or-later URL: https://github.com/%{proj_name}/%{name} Source0: https://github.com/%{proj_name}/%{name}/archive/v%{version}/%{name}-v%{version}.tar.gz Source1: https://github.com/%{proj_name}/sing-geoip/releases/latest/download/geoip.db Source2: https://github.com/%{proj_name}/sing-geosite/releases/latest/download/geosite.db Source3: sing-box.sysusers Patch0: 0001-Systemd-unit-file-optimization.patch BuildRequires: golang >= 1.25.5 BuildRequires: git BuildRequires: gcc BuildRequires: systemd-units BuildRequires: systemd-rpm-macros %{?sysusers_requires_compat} Requires: systemd-units Requires: sing-box-geo %description The universal proxy platform. %package geo Summary: The geoip data file. BuildArch: noarch %description geo The geo database file. %global debug_package %{nil} %global source_date_epoch_from_changelog 0 %prep %setup -q -n %{name}-%{version} %autopatch -p1 %build %define tags with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,with_ ccm,with_ocm,with_cloudflared,with_naive_outbound,with_usbip,with_openvpn,with_openconnect,badlinkname,tf ogo_checklinkname0 export DEFAULT_LDFLAGS="-X runtime.godebugDefault=multipathtcp=0,tlssha1=1 -checklinkname=0" export GO_LDFLAGS="-X 'github.com/sagernet/sing-box/constant.Version=%{version}' ${DEFAULT_LDFLAGS}" go build -v -o sing-box -buildmode=pie -compiler gc -gcflags -trimpath -ldflags ${GO_LDFLAGS} -tags %{tags} ./cmd/sing-box %install install -m 0755 -vd %{buildroot}%{_bindir} install -m 0755 -vp %{name} %{buildroot}%{_bindir}/${name} install -m 0755 -vd %{buildroot}%{_datadir}/%{name} install -m 0755 -vd %{buildroot}%{_sysconfdir}/%{name} install -m 0755 -vd %{buildroot}%{_localstatedir}/log/%{name} install -m 0755 -vd %{buildroot}%{_sysusersdir} install -m 0755 -vd %{buildroot}%{_unitdir} install -m 0755 -vd %{buildroot}%{_sharedstatedir}/%{name} install -m 0644 -vp release/config/%{name}.service %{buildroot}%{_unitdir}/%{name}.service install -m 0644 -vp release/config/%{name}@.service %{buildroot}%{_unitdir}/%{name}@.service install -m 0644 -vp release/config/config.json %{buildroot}%{_sysconfdir}/%{name}/config.json install -m 0644 -vp %{SOURCE3} %{buildroot}%{_sysusersdir}/%{name}.conf install -m 0644 -vp %{SOURCE1} %{buildroot}%{_datadir}/%{name}/geoip.db install -m 0644 -vp %{SOURCE2} %{buildroot}%{_datadir}/%{name}/geosite.db %pre %sysusers_create_compat %{SOURCE3} %post if [ -d %{_sharedstatedir}/%{name} ]; then chown -R sagernet:sagernet %{_sharedstatedir}/%{name} fi %files %defattr(-,root,root,-) %license LICENSE %{_bindir}/%{name} %attr(-, root, root) %{_unitdir}/%{name}.service %attr(-, root, root) %{_unitdir}/%{name}@.service %{_sysusersdir}/%{name}.conf %config(noreplace) %{_sysconfdir}/%{name}/config.json %{_sharedstatedir}/%{name} %files geo %{_datadir}/%{name}/geoip.db %{_datadir}/%{name}/geosite.db %changelog %autochangelog