%global forgeurl https://github.com/XTLS/Xray-core %global version 24.12.18 %global commit a7909f8671bbc813c1e10a22ac4d3d5505e90368 %global date 20241224 %global debug_package %{nil} %global gomodulesmode GO111MODULE=on %forgemeta Name: xray Version: %{forgeversion} Release: %{autorelease} Summary: Transport for traffic masquerading with XTLS License: MPL-2.0 URL: https://xtls.github.io/en/ Source0: %{forgesource} Source1: %{name}@.service Source2: %{name}.howto BuildRequires: git-core BuildRequires: golang-bin BuildRequires: go-rpm-macros BuildRequires: systemd-rpm-macros %description Xray provides a transport for traffic masquerading with XTLS. This allows to circumvent censorship and data discrimination. %prep %forgesetup %build export GOPROXY="https://proxy.golang.org,direct" export GOFLAGS="-trimpath" export GO_LDFLAGS="-s -w" %gobuild -o %{name} ./main %install install -p -d -m 700 %{buildroot}%{_sysconfdir}/%{name} install -p -D -m 644 -t %{buildroot}%{_unitdir} %{SOURCE1} install -p -D -m 755 -t %{buildroot}%{_bindir} %{name} install -p -D -m 644 -t %{buildroot}%{_pkgdocdir} %{SOURCE2} README.md %post for UNIT in $(systemctl -P Id show %{name}@\*.service) do %systemd_post ${UNIT} done %preun for UNIT in $(systemctl -P Id show %{name}@\*.service) do %systemd_preun ${UNIT} done %postun for UNIT in $(systemctl -P Id show %{name}@\*.service) do %systemd_postun_with_restart ${UNIT} done %files %license LICENSE %doc %{_pkgdocdir} %{_sysconfdir}/* %{_unitdir}/* %{_bindir}/*