mirror of
https://github.com/Syping/dtranslatebot.git
synced 2024-11-22 05:40:23 +01:00
rpmspec: add suse support
This commit is contained in:
parent
6764c9c2f3
commit
24c14efce2
1 changed files with 29 additions and 22 deletions
|
@ -4,6 +4,14 @@
|
|||
%global cmake %{?cmake3}
|
||||
%global cmake_build %{?cmake3_build}
|
||||
%global cmake_install %{?cmake3_install}
|
||||
%global cmake_suffix 3
|
||||
%global toolset_prefix devtoolset-9-
|
||||
%endif
|
||||
%if 0%{?rhel} && 0%{?rhel} == 8
|
||||
%global toolset_prefix gcc-toolset-9-
|
||||
%endif
|
||||
%if 0%{?suse_version} && 0%{?suse_version} < 1600
|
||||
%global toolset_version 9
|
||||
%endif
|
||||
|
||||
Name: dtranslatebot
|
||||
|
@ -17,30 +25,21 @@ Source1: %{name}.json
|
|||
Source2: %{name}.service
|
||||
Source3: %{name}.sysusersd
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: perl
|
||||
BuildRequires: perl-IPC-Cmd
|
||||
%if 0%{?rhel} && 0%{?rhel} < 8
|
||||
BuildRequires: cmake3 >= 3.16
|
||||
BuildRequires: devtoolset-9-annobin
|
||||
BuildRequires: devtoolset-9-gcc-c++
|
||||
%else
|
||||
%if 0%{?rhel} && 0%{?rhel} == 8
|
||||
BuildRequires: cmake >= 3.16
|
||||
BuildRequires: gcc-toolset-9-annobin
|
||||
BuildRequires: gcc-toolset-9-gcc-c++
|
||||
%else
|
||||
BuildRequires: cmake >= 3.16
|
||||
BuildRequires: annobin
|
||||
BuildRequires: gcc-c++
|
||||
%endif
|
||||
%endif
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
BuildRequires: %{?toolset_prefix}annobin
|
||||
%if 0%{?rhel} && 0%{?rhel} < 9
|
||||
BuildRequires: epel-rpm-macros-systemd
|
||||
%endif
|
||||
%endif
|
||||
BuildRequires: cmake%{?cmake_suffix}
|
||||
BuildRequires: %{?toolset_prefix}gcc%{?toolset_version}-c++
|
||||
BuildRequires: make
|
||||
BuildRequires: perl(IPC::Cmd)
|
||||
BuildRequires: systemd-rpm-macros
|
||||
%{?systemd_requires}
|
||||
%{?sysusers_requires_compat}
|
||||
%systemd_requires
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
%sysusers_requires_compat
|
||||
%endif
|
||||
|
||||
%description
|
||||
dtranslatebot is a Discord Bot which translate incoming Discord messages to Discord webhooks.
|
||||
|
@ -51,13 +50,16 @@ dtranslatebot is a Discord Bot which translate incoming Discord messages to Disc
|
|||
%build
|
||||
%if 0%{?rhel} && 0%{?rhel} < 8
|
||||
source /opt/rh/devtoolset-9/enable
|
||||
%else
|
||||
%endif
|
||||
%if 0%{?rhel} && 0%{?rhel} == 8
|
||||
source /opt/rh/gcc-toolset-9/enable
|
||||
%endif
|
||||
%endif
|
||||
%cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
%if 0%{?toolset_version}
|
||||
-DCMAKE_C_COMPILER=gcc-%{toolset_version} \
|
||||
-DCMAKE_CXX_COMPILER=g++-%{toolset_version} \
|
||||
%endif
|
||||
-DWITH_DPP_STATIC_BUNDLE=TRUE \
|
||||
-DWITH_SYSTEMD=TRUE
|
||||
%cmake_build
|
||||
|
@ -70,7 +72,12 @@ install -p -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service
|
|||
install -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysusersdir}/%{name}.conf
|
||||
|
||||
%pre
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
%sysusers_create_compat %{SOURCE3}
|
||||
%endif
|
||||
%if 0%{?suse_version}
|
||||
%sysusers_create_package %{name} %{SOURCE3}
|
||||
%endif
|
||||
|
||||
%post
|
||||
%systemd_post %{name}.service
|
||||
|
|
Loading…
Reference in a new issue