# Generated by go2rpm 1.18.0 %bcond check 1 %global debug_package %{nil} # https://github.com/sagernet/sing-box %global goipath github.com/sagernet/sing-box Version: 1.12.12 %global tag v1.12.12 %gometa -L -f Name: sing-box Release: %autorelease Summary: The universal proxy platform # Generated by go-vendor-tools License: Apache-2.0 AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND CC0-1.0 AND GPL-3.0-only AND ISC AND MIT AND MPL-2.0 AND Unlicense URL: %{gourl} Source0: %{gosource} # Generated by go-vendor-tools Source1: %{archivename}-vendor.tar.bz2 Source2: go-vendor-tools.toml Source3: https://github.com/sagernet/sing-geoip/releases/latest/download/geoip.db Source4: https://github.com/sagernet/sing-geosite/releases/latest/download/geosite.db Source5: sing-box.sysusers %if 0%{?fedora} >= 38 Patch: 0001-Systemd-unit-file-optimization.patch %else Patch0: 0001-Systemd-unit-file-optimization.patch %endif BuildRequires: go-vendor-tools 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. %prep %goprep -A %setup -q -T -D -a1 %{forgesetupargs} %autopatch -p1 %generate_buildrequires %go_vendor_license_buildrequires -c %{S:2} %build %define tags with_gvisor,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale %define tags_go118 with_gvisor,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,with_v2ray_api,with_grpc %define tags_go120 with_quic %if 0%{?fedora} >= 38 || 0%{?rhel} >= 8 %define tags %{tags_go118},%{tags_go120} %else %define tags %{tags_go118} %endif %global gomodulesmode GO111MODULE=on export GO_LDFLAGS="-X 'github.com/sagernet/sing-box/constant.Version=%{version}-%{release}' -s -w -buildid=" %gobuild -o %{gobuilddir}/bin/sing-box -tags %{tags} ./cmd/sing-box %install %go_vendor_license_install -c %{S:2} install -m 0755 -vd %{buildroot}%{_bindir} 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 -p -m 0755 %{gobuilddir}/bin/sing-box %{buildroot}/%{_bindir}/%{name} install -p -m 0644 release/config/%{name}.service %{buildroot}/%{_unitdir}/%{name}.service install -p -m 0644 release/config/%{name}@.service %{buildroot}/%{_unitdir}/%{name}@.service install -p -m 0644 release/config/config.json %{buildroot}%{_sysconfdir}/%{name}/config.json install -p -m 0644 %{SOURCE5} %{buildroot}%{_sysusersdir}/%{name}.conf install -p -m 0644 %{SOURCE3} %{buildroot}%{_datadir}/%{name}/geoip.db install -p -m 0644 %{SOURCE4} %{buildroot}%{_datadir}/%{name}/geosite.db %check %go_vendor_license_check -c %{S:2} %pre %sysusers_create_compat %{SOURCE5} %post chown -R sagernet:sagernet %{_sharedstatedir}/%{name} %files -f %{go_vendor_license_filelist} %license vendor/modules.txt %doc docs README.md common/ja3/README.md transport/simple-obfs/README.md %{_bindir}/sing-box %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