%global _build_id_links none %global debug_package %{nil} %global upstream_version 1.13.0-alpha.11-reF1nd %global software_name sing-box %ifarch x86_64 %define ARCH amd64 %endif %ifarch aarch64 %define ARCH arm64 %endif Name: %{software_name}-ref1nd Version: 1.13.0.alpha.11.reF1nd Release: 1%{?dist} Summary: The universal proxy platform. License: GPLv3 or later URL: https://sing-box.sagernet.org/ Source0: https://github.com/reF1nd/sing-box/archive/refs/tags/v%{upstream_version}.tar.gz BuildRequires: git, curl, tar, gcc, make, golang Provides: %{software_name} = %{version}-%{release} Conflicts: %{software_name} Obsoletes: %{name} < %{version}-%{release} %description The universal proxy platform. %package bash-completion Summary: Bash completion for %{name} Requires: %{name} = %{version}-%{release} Requires: bash-completion Supplements: (%{name} and bash-completion) Conflicts: %{software_name}-bash-completion Obsoletes: %{name}-bash-completion < %{version}-%{release} %description bash-completion Bash command line completion support for %{name}. %package zsh-completion Summary: Zsh completion for %{name} Requires: %{name} = %{version}-%{release} Requires: zsh Supplements: (%{name} and zsh) Conflicts: %{software_name}-zsh-completion Obsoletes: %{name}-zsh-completion < %{version}-%{release} %description zsh-completion Zsh command line completion support for %{name}. %package fish-completion Summary: Fish completion for %{name} Requires: fish Supplements: (%{name} and fish) Conflicts: %{software_name}-fish-completion Obsoletes: %{name}-fish-completion < %{version}-%{release} %description fish-completion Fish command line completion support for %{name}. %prep %setup -q -n %{software_name}-%{upstream_version} %build _tags=with_gvisor,with_quic,with_wireguard,with_utls,with_tailscale,with_clash_api,with_acme,with_dhcp CGO_ENABLED=1 go build \ -v \ -trimpath \ -buildmode=pie \ -mod=readonly \ -modcacherw \ -tags "$_tags" \ -ldflags " -X \"github.com/sagernet/sing-box/constant.Version=%{upstream_version}\" -s -w -buildid=" \ ./cmd/%{software_name} sed -i "/^\[Service\]$/a StateDirectory=%{software_name}" release/config/%{software_name}.service sed -i "/^\[Service\]$/a StateDirectory=%{software_name}-%i" release/config/%{software_name}@.service sed -i "/^\[Service\]$/a User=%{software_name}" release/config/%{software_name}*.service echo "u %{software_name} - \"Sing-box Service\" - -" > "release/config/%{software_name}.sysusers" install -d completions ./%{software_name} completion bash > completions/bash ./%{software_name} completion fish > completions/fish ./%{software_name} completion zsh > completions/zsh echo -n \ '// Allow sing-box to set domain and default-route polkit.addRule(function(action, subject) { if ((action.id == "org.freedesktop.resolve1.set-domains" || action.id == "org.freedesktop.resolve1.set-default-route" || action.id == "org.freedesktop.resolve1.set-dns-servers") && subject.user == "sing-box") { return polkit.Result.YES; } });' > release/config/%{software_name}.rules %install install -Dsm755 %{software_name} -t %{buildroot}%{_bindir} install -Dm644 "release/config/config.json" -t %{buildroot}%{_sysconfdir}/%{software_name} install -Dm644 "release/config/%{software_name}.service" -t %{buildroot}/usr/lib/systemd/system install -Dm644 "release/config/%{software_name}@.service" -t %{buildroot}/usr/lib/systemd/system install -Dm644 "release/config/%{software_name}.sysusers" %{buildroot}/usr/lib/sysusers.d/%{software_name}.conf install -Dm644 "release/config/%{software_name}.rules" %{buildroot}%{_datadir}/polkit-1/rules.d/%{software_name}.rules install -Dm644 "completions/bash" %{buildroot}%{_datadir}/bash-completion/completions/%{name} install -Dm644 "completions/fish" %{buildroot}%{_datadir}/fish/vendor_completions.d/%{name}.fish install -Dm644 "completions/zsh" %{buildroot}%{_datadir}/zsh/site-functions/_%{name} install -dm755 %{buildroot}%{_datadir}/%{software_name} %files %license LICENSE %{_bindir}/%{software_name} %dir %{_sysconfdir}/%{software_name} %config(noreplace) %{_sysconfdir}/%{software_name}/config.json /usr/lib/systemd/system/%{software_name}*.service /usr/lib/sysusers.d/%{software_name}.conf %dir %{_datadir}/polkit-1/rules.d %{_datadir}/polkit-1/rules.d/%{software_name}.rules %dir %{_datadir}/%{software_name} %files fish-completion %{_datadir}/fish/vendor_completions.d/%{name}.fish %files zsh-completion %{_datadir}/zsh/site-functions/_%{name} %files bash-completion %{_datadir}/bash-completion/completions/%{name} %changelog * Sat Aug 16 2025 Sim0n - 1.13.0-alpha.2-reF1nd - Change config file install behavior * Sat Aug 16 2025 Sim0n - 1.13.0-alpha.2-reF1nd - Bump version - Change default config file name * Thu Aug 14 2025 Sim0n - 1.13.0-alpha.1-reF1nd - Bump version * Tue Aug 12 2025 Sim0n - 1.12.1-reF1nd - Bump version * Mon Aug 04 2025 Sim0n - 1.12.0-reF1nd1 - Add golang to BuildRequires and remove manual go download. - Add gcc and make to BuildRequires for CGO support. * Fri Aug 01 2025 Sim0n - 1.12.0.rc.3.reF1nd-1 - Initial package release