%global rel_ver 24.10.16 %global rel_cnt 1 #global git_ver git4140bcd %global git_rel_cnt 0.1 %define debug_package %{nil} %global goipath github.com/xtls %if 0%{?fedora} <= 30 || 0%{?el7} %global build_folder $GO_BUILD_PATH %else %global build_folder %{gobuilddir} %global extractdir0 %{name}-%{rel_ver}%{?git_ver:.%{git_ver}} %endif %bcond_with latest Name: xray Version: %{rel_ver} Release: %{?git_ver:%{git_rel_cnt}.%{git_ver}}%{!?git_ver:%{rel_cnt}}%{?dist} Summary: Project X originates from XTLS protocol, provides a set of network tools such as Xray-core and Xray-flutter. License: MIT URL: https://github.com/XTLS/Xray-core Source0: Xray-core-%{?git_ver:%{rel_ver}.%{git_ver}.tar.xz}%{!?git_ver:%{rel_ver}.tar.gz} Source1: xray@.service # Upstream Merged Patch1: 0001-README.md-Add-wulabing-xray_docker-to-Docker.patch Patch2: 0002-WireGuard-config-Replace-kernelMode-with-noKernelTun.patch Patch3: 0003-Transport-Remove-GUN-an-alias-of-gRPC.patch Patch4: 0004-Config-Prefer-newer-alias-REALITY-target-RAW.patch Patch5: 0005-README.md-Only-list-secure-web-panels-3884.patch #Customized Patch Patch6: 0006-DNS-matcher-return-regexp-before-domains.patch Patch7: 0007-Ignore-invalid-domains.patch Patch8: 0008-Skip-IPv4-IPv6-query-if-the-domain-is-set-to-query-I.patch BuildRequires: curl BuildRequires: go-srpm-macros BuildRequires: golang >= 1.22 #el7/el8 Provided by https://packages.endpointdev.com/rhel/$releasever/main/$basearch BuildRequires: git-core >= 2.0 %if 0%{?fedora} <= 30 || 0%{?el7} BuildRequires: go-compilers-golang-compiler %else BuildRequires: go-rpm-macros %endif %if 0%{?fedora} < 30 || 0%{?el7} BuildRequires: systemd %else BuildRequires: systemd-rpm-macros %endif Requires: shadow-utils %description Project V is a set of network tools that help you to build your own computer network %prep rm -rf %{name}-%{rel_ver}%{?git_ver:.%{git_ver}} %setup -q -D -T -c -n %{name}-%{rel_ver}%{?git_ver:.%{git_ver}} -a 0 mv Xray-core-%{rel_ver}%{?git_ver:.%{git_ver}} xray-core sed -i -e 's|\(^.*version.*=\).*$|\1 \"%{version}%{?git_ver:.%{git_ver}}\"|g' xray-core/core/core.go pushd xray-core %if 0%{?epel} %patch1 -p1 %patch2 -p1 %patch3 -p1 %patch4 -p1 %patch5 -p1 %patch6 -p1 %patch7 -p1 %patch8 -p1 %else %patch 1 -p1 %patch 2 -p1 %patch 3 -p1 %patch 4 -p1 %patch 5 -p1 %patch 6 -p1 %patch 7 -p1 %patch 8 -p1 %endif popd %build %if 0%{?fedora} <= 30 || 0%{?el7} %gobuildroot %else %goprep -v -e %{name}-%{rel_ver}%{?git_ver:.%{git_ver}} %endif %undefine version curl -L https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat -o geoip.dat curl -L https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat -o geosite.dat curl -L https://github.com/ToutyRater/V2Ray-SiteDAT/raw/master/geofiles/h2y.dat -o h2y.dat %if %{with latest} #env GOPATH=%{build_folder} go get -insecure -v -d -t github.com/xtls/xray-core/main #env GOPATH=%{build_folder} go get -insecure -v -d -t github.com/xtls/xray-core/core %gobuild -o _bin/xray github.com/xtls/xray-core/main %else pushd xray-core %define gomodulesmode GO111MODULE=on export GOPATH=%{build_folder} export GOPROXY="https://proxy.golang.org,direct" export GOSUMDB="sum.golang.org" %gobuild -o ../_bin/xray ./main popd %endif %install mkdir -p %{buildroot}%{_bindir} install -s -m 755 _bin/xray %{buildroot}%{_bindir} install -d %{buildroot}%{_sysconfdir}/%{name} install -d %{buildroot}%{_var}/log/%{name} install -d %{buildroot}%{_datadir}/%{name} install -d %{buildroot}%{_unitdir} install -d %{buildroot}%{_sysconfdir}/%{name} install -d %{buildroot}%{_localstatedir}/log/%{name} install -m644 %{SOURCE1} %{buildroot}%{_unitdir}/xray@.service install -m644 geoip.dat %{buildroot}%{_datadir}/%{name}/geoip.dat install -m644 geosite.dat %{buildroot}%{_datadir}/%{name}/geosite.dat install -m644 h2y.dat %{buildroot}%{_datadir}/%{name}/h2y.dat mkdir -p %{buildroot}%{_tmpfilesdir} echo "d /run/xray 0755 root root -" > %{buildroot}%{_tmpfilesdir}/%{name}.conf %post if ! getent group xray > /dev/null 2>&1; then /usr/sbin/groupadd -r -g 33333 xray fi /usr/sbin/usermod -G xray -a root %postun # Only remove groups when uninstall if [ $1 = 0 ]; then if getent group xray > /dev/null 2>&1; then /usr/sbin/usermod -G xray -r root /usr/sbin/groupdel -f xray fi fi %clean export GOPATH=%{build_folder} go clean -modcache %files %license xray-core/LICENSE %doc xray-core/README.md %{_bindir}/xray %attr(0755, root, root) %dir %{_sysconfdir}/%{name} %attr(0755, root, root) %dir %{_var}/log/%{name} %attr(0644, root, root) %{_datadir}/%{name}/geoip.dat %attr(0644, root, root) %{_datadir}/%{name}/geosite.dat %attr(0644, root, root) %{_datadir}/%{name}/h2y.dat %attr(0644, root, root) %{_tmpfilesdir}/%{name}.conf %attr(-, root, root) %{_localstatedir}/log/%{name} %attr(-, root, root) %{_unitdir}/%{name}@.service %changelog * Fri Oct 25 2024 Tomas Chang - 24.10.16-1 - Update to latest release * Sun Sep 08 2024 Tomas Chang - 24.9.7-1 - Update to latest release * Thu Aug 08 2024 Tomas Chang - 1.8.23-1 - Update to latest release * Mon Jul 22 2024 Tomas Chang - 1.8.21-1 - Update to latest release * Wed Jul 17 2024 Tomas Chang - 1.8.19-1 - Update to latest release * Mon Jun 03 2024 Tomas Chang - 1.8.13-1 - Update to latest release * Tue Apr 30 2024 Tomas Chang - 1.8.11-1 - Update to latest release * Wed Apr 03 2024 Tomas Chang - 1.8.10-1 - Update to latest release * Mon Mar 11 2024 Tomas Chang - 1.8.9-1 - Update to latest release * Fri Mar 01 2024 Tomas Chang - 1.8.8-1 - Update to latest release * Fri Jan 12 2024 Tomas Chang - 1.8.7-1 - Update to latest release * Mon Nov 20 2023 Tomas Chang - 1.8.6-1 - Update to latest release * Tue Aug 29 2023 Tomas Chang - 1.8.4-1 - Update to latest release * Tue Jun 20 2023 Tomas Chang - 1.8.3-1 - Update to latest release * Fri May 05 2023 Tomas Chang - 1.8.1-1 - Update to latest release * Fri Mar 10 2023 Tomas Chang - 1.8.0-1 - Update to latest release * Wed Feb 08 2023 Tomas Chang - 1.7.5-1 - Update to latest release * Thu Feb 02 2023 Tomas Chang - 1.7.3-1 - Update to latest release * Wed Dec 14 2022 Tomas Chang - 1.6.6-2 - Update to latest git * Tue Dec 13 2022 Tomas Chang - 1.6.6-1 - Update to 1.6.6 * Thu Dec 08 2022 Tomas Chang - 1.6.5-2 - Update to latest git - Update "Ignore invalid domain" patch * Tue Nov 29 2022 Tomas Chang - 1.6.5-1 - Update to latest release * Tue Nov 08 2022 Tomas Chang - 1.6.3-1 - Update to latest release * Sun Oct 30 2022 Tomas Chang - 1.6.2-1 - Update to latest release * Sat Oct 22 2022 Tomas Chang - 1.6.1-1 - Update to latest relrease * Wed Oct 19 2022 Tomas Chang - 1.6.0-2 - Update to latest git * Tue Sep 20 2022 Tomas Chang - 1.6.0-1 - Update to 1.6.0 * Wed Aug 24 2022 Tomas Chang - 1.5.9-4 - Update to latest git - Fix scriptlet * Wed Aug 24 2022 Tomas Chang - 1.5.9-3 - Update to latest git * Wed Aug 24 2022 Tomas Chang - 1.5.9-2 - Update to latest git * Mon Jul 25 2022 Tomas Chang - 1.5.9-1 - Update to latest git * Tue Jun 21 2022 Tomas Chang - 1.5.8-1 - Update to latest git * Wed Jun 08 2022 Tomas Chang - 1.5.7-1 - Update to latest git * Thu Jun 02 2022 Tomas Chang - 1.5.6-2 - Update to latest git * Tue May 31 2022 Tomas Chang - 1.5.6-1 - Update to 1.5.6 release * Mon Apr 25 2022 Tomas Chang - 1.5.5-1 - Update to 1.5.5 release * Wed Feb 09 2022 Tomas Chang - 1.5.3-1 - Update to 1.5.3 release * Thu Dec 02 2021 Tomas Chang - 1.5.1.git4fc284a-0.2 - Rebuild with golang 1.17.3 * Thu Dec 02 2021 Tomas Chang - 1.5.1.git4fc284a-0.1 - Update to latest git * Thu Sep 23 2021 Tomas Chang - 1.4.5-1 - Update to 1.4.5 release * Wed Sep 22 2021 Tomas Chang - 1.4.4-1 - Update to 1.4.4 release * Wed Sep 08 2021 Tomas Chang - 1.4.3-1 - Update to 1.4.3 release * Wed Apr 28 2021 Tomas Chang - 1.4.3.git1e3d739-0.1 - Update to latest git on Mar 28 2021 * Tue Apr 06 2021 Tomas Chang - 1.4.2-1 - Update to 1.4.2 * Sun Mar 21 2021 Tomas Chang - 1.4.1.git0470381-0.1 - Update to latest git on Mar 21 2021 * Mon Mar 15 2021 Tomas Chang - 1.4.0-1 - Update to 1.4.0 * Sun Mar 14 2021 Tomas Chang - 1.3.2.gite0526c2-0.2 - Update to latest git on Mar 14 2021 * Mon Mar 08 2021 Tomas Chang - 1.3.2.gitd7cd71b7-0.1 - Update to latest git on Mar 08 2021 * Tue Mar 02 2021 Tomas Chang - 1.3.1.gitc345d481-0.2 - Update to latest git on Mar 02 2021 * Wed Feb 24 2021 Tomas Chang - 1.3.1.git48fab4d3-0.1 - Update to latest git on Feb 24 2021 * Sun Feb 14 2021 Tomas Chang - 1.3.0-1 - Update to 1.3.0 * Wed Feb 03 2021 Tomas Chang - 1.2.4-1 - Update to 1.2.4 * Fri Jan 22 2021 Tomas Chang - 1.2.3-1 - Update to 1.2.3 * Fri Jan 15 2021 Tomas Chang - 1.2.2-1 - Update to 1.2.2 * Tue Jan 12 2021 Tomas Chang - 1.2.1-2 - Apply upstream patches - Add config dir - Add runtime folder * Mon Jan 11 2021 Tomas Chang - 1.2.1-1 - Update to 1.2.1 * Mon Jan 04 2021 Tomas Chang - 1.2.0-1 - Initial build