Qv2ray/makespec/qv2ray.spec.in
Yuxiang Zhu 93cbea496f Add spec file and Makefile for RPM build on Fedora Copr
Adds RPM packaging support on [Fedora Copr](https://copr.fedorainfracloud.org/).
Currently only tested with Fedora 30+.
Supporting for other distributions like RHEL/CentOS/Suse/OpenSuse requires some dependencies that are not in their official repos so it is not covered in this PR.

Build RPMs locally:

``` bash
dnf install -y git mock make
make -f .copr/Makefile srpm  # build source RPM
make -f .copr/Makefile rpm  # build binary RPM
```

This makefile uses [Mock](https://github.com/rpm-software-management/mock) to build RPMs in a chroot environment. To use a chroot differed from your build distribution, use `RPM_BUILDROOT=<chroot-name>` Makefile variable.

For example, build against Fedora 32 on a CentOS 8 machine:

```bash
make -f .copr/Makefile rpm RPM_BUILDROOT=fedora-32-$(uname -m)
```

Example build: https://copr.fedorainfracloud.org/coprs/yux/v2ray/build/1329864/
2020-04-07 16:42:12 +08:00

57 lines
1.1 KiB
RPMSpec

%if 0%{?rhel}
%global use_system_grpc 0
%else
%global use_system_grpc 1
%endif
Name: @NAME@
Version: @VERSION@
Release: @RELEASE@
Summary: A Qt frontend for V2Ray, written in c++.
License: GPLv3
URL: https://github.com/Qv2ray/Qv2ray
Source0: @SOURCE0@
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: qt5-qtbase-devel
BuildRequires: qt5-qttools-devel
BuildRequires: protobuf-compiler
BuildRequires: protobuf-devel
%if 0%{?use_system_grpc}
BuildRequires: grpc-devel
BuildRequires: grpc-plugins
%endif
%description
A Qt based cross-platform GUI fontend for V2Ray.
%prep
%setup -q -n @NAME_VERSION@
%build
%cmake -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_LIBQVB:BOOL=OFF -DEMBED_TRANSLATIONS:BOOL=ON .
%make_build
%install
rm -rf "$RPM_BUILD_ROOT"
%make_install
install -D LICENSE "$RPM_BUILD_ROOT"/%{_datadir}/licenses/qv2ray/LICENSE
install -D README.md "$RPM_BUILD_ROOT"/%{_docdir}/qv2ray/README.md
%files
%license LICENSE
%doc README.md
%{_bindir}/qv2ray
%{_datadir}/icons/*
%{_datadir}/applications/*
%{_datadir}/metainfo/*
%changelog