%global debug_package %{nil} Name: v2ray Summary: v2ray Golang server/cilent Version: 4.28.2 Release: 1%{?dist} URL: https://github.com/v2ray/v2ray-core License: MIT Source0: %{URL}/archive/v%{version}.tar.gz#/%{name}-v%{version}.tar.gz Source1: https://github.com/v2ray/domain-list-community/releases/latest/download/dlc.dat Source2: https://github.com/v2ray/geoip/releases/latest/download/geoip.dat # BuildRequires: compiler(go-compiler) BuildRequires: git BuildRequires: wget %if 0%{?fedora} > 29 BuildRequires: compiler(go-compiler) BuildRequires: systemd-rpm-macros %else BuildRequires: golang %define _unitdir /usr/lib/systemd/system %endif %define gobuild(o:) %{expand: export LDFLAGS="-s -w" %global _dwz_low_mem_die_limit 0 env CGO_ENABLED=0 CGO_LDFLAGS= go build -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**}; } %description A platform for building proxies to bypass network restrictions. %prep %setup -q -n %{name}-core-%{version} %if 0%{?fedora} >= 31 sed 's/^Type=simple/#Type=simple/;s/^#Type=exec/Type=exec/' -i release/config/systemd/system/* %endif # sed -i '/^CapabilityBoundingSet/a\Environment=V2RAY_LOCATION_ASSET=%%{_datarootdir}/v2ray' release/config/systemd/* sed -i 's|/usr/local/bin/v2ray|%{_bindir}/v2ray|g' release/config/systemd/system/* sed -i 's|/usr/local/etc/v2ray/|/etc/v2ray/|g' release/config/systemd/system/* %build export GOPATH=$(pwd)/_build mkdir -p $(pwd)/%{_target_platform} export OUT=$(pwd)/%{_target_platform} sed -i "s/^[ \t]\+codename.\+$/\tcodename = \"Karuboniru\"/;s/^[ \t]\+build.\+$/\tbuild = \"On Copr\"/;" core.go pushd main %gobuild -o $OUT/v2ray popd pushd infra/control/main %gobuild -o $OUT/v2ctl popd %install install -m 0755 -vd %{buildroot}%{_bindir} install -m 0755 -vd %{buildroot}%{_datarootdir}/v2ray/ install -m 0755 -vd %{buildroot}%{_unitdir}/ install -m 0755 -vp %{_target_platform}/v2ray %{buildroot}%{_bindir} install -m 0755 -vp %{_target_platform}/v2ctl %{buildroot}%{_bindir} install -m 0644 -vp release/config/systemd/system/* %{buildroot}%{_unitdir}/ install -m 0644 -vp %{S:1} %{buildroot}%{_datarootdir}/v2ray/geosite.dat install -m 0644 -vp %{S:2} %{buildroot}%{_datarootdir}/v2ray/geoip.dat %if 0%{?fedora} > 29 %post %systemd_post v2ray.service %systemd_post v2ray@.service %preun %systemd_preun v2ray.service # disable --now seems don't work here. if [ $1 -eq 0 ] && [ -x /usr/bin/systemctl ] ; then # Package removal, not upgrade /usr/bin/systemctl --no-reload stop v2ray@*.service || : /usr/bin/systemctl --no-reload disable v2ray@.service || : fi %postun %systemd_postun_with_restart v2ray.service %systemd_postun_with_restart v2ray@*.service %else %post systemctl daemon-reload systemctl try-restart v2ray %endif %files %defattr(-,root,root,-) %dir %{_datarootdir}/v2ray %{_bindir}/v2* %{_datarootdir}/v2ray/* %{_unitdir}/%{name}@.service %{_unitdir}/%{name}.service %changelog * Fri Sep 18 2020 Qiyu Yan - 4.28.2-1 - update to 4.28.2 upstream release * Sat Aug 08 2020 Qiyu Yan - 4.27.0-1 - update to 4.27.0 upstream release * Sun Jul 19 2020 Qiyu Yan - 4.26.0-1 - update to 4.26.0 upstream release * Sat Jul 04 2020 Qiyu Yan - 4.25.1-2 - Fix unit files * Mon Jun 29 2020 Qiyu Yan - 4.25.1-1 - Update to 4.25.1 upstream release * Mon Jun 29 2020 Qiyu Yan - 4.25.0-3 - Use upstream Unit files * Tue Jun 23 2020 Qiyu Yan - 4.25.0-2 - update unit files * Sat Jun 20 2020 Qiyu Yan - 4.25.0-1 - update to 4.25.0 upstream * Fri Jun 12 2020 Qiyu Yan - 4.24.2-2 - Rebuilt