2024-03-12 09:40:58 +01:00
|
|
|
%global _lto_cflags %{?_lto_cflags} -ffat-lto-objects
|
2024-03-14 03:30:45 +01:00
|
|
|
|
|
|
|
%if 0%{?rhel} && 0%{?rhel} < 8
|
|
|
|
%global cmake %{?cmake3}
|
|
|
|
%global cmake_build %{?cmake3_build}
|
|
|
|
%global cmake_install %{?cmake3_install}
|
2024-03-20 21:43:08 +01:00
|
|
|
%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
|
2024-03-14 03:30:45 +01:00
|
|
|
%endif
|
2024-03-12 09:40:58 +01:00
|
|
|
|
|
|
|
Name: dtranslatebot
|
|
|
|
Version: 0.2.0
|
|
|
|
Release: 1%{?dist}
|
|
|
|
Summary: Discord Translation Bot
|
|
|
|
License: BSD-2-Clause
|
|
|
|
URL: https://github.com/Syping/%{name}
|
2024-03-14 03:30:45 +01:00
|
|
|
Source0: %{name}-%{version}.tar.gz
|
2024-03-12 10:15:51 +01:00
|
|
|
Source1: %{name}.json
|
|
|
|
Source2: %{name}.service
|
|
|
|
Source3: %{name}.sysusersd
|
2024-03-12 09:40:58 +01:00
|
|
|
|
2024-03-20 21:43:08 +01:00
|
|
|
%if 0%{?fedora} || 0%{?rhel}
|
|
|
|
BuildRequires: %{?toolset_prefix}annobin
|
2024-03-14 03:30:45 +01:00
|
|
|
%if 0%{?rhel} && 0%{?rhel} < 9
|
2024-03-12 09:40:58 +01:00
|
|
|
BuildRequires: epel-rpm-macros-systemd
|
|
|
|
%endif
|
2024-03-20 21:43:08 +01:00
|
|
|
%endif
|
|
|
|
BuildRequires: cmake%{?cmake_suffix}
|
|
|
|
BuildRequires: %{?toolset_prefix}gcc%{?toolset_version}-c++
|
|
|
|
BuildRequires: make
|
|
|
|
BuildRequires: perl(IPC::Cmd)
|
2024-03-12 09:40:58 +01:00
|
|
|
BuildRequires: systemd-rpm-macros
|
2024-03-20 21:43:08 +01:00
|
|
|
%systemd_requires
|
|
|
|
%if 0%{?fedora} || 0%{?rhel}
|
|
|
|
%sysusers_requires_compat
|
|
|
|
%endif
|
2024-03-12 09:40:58 +01:00
|
|
|
|
|
|
|
%description
|
|
|
|
dtranslatebot is a Discord Bot which translate incoming Discord messages to Discord webhooks.
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -q
|
|
|
|
|
|
|
|
%build
|
2024-03-14 03:30:45 +01:00
|
|
|
%if 0%{?rhel} && 0%{?rhel} < 8
|
|
|
|
source /opt/rh/devtoolset-9/enable
|
2024-03-20 21:43:08 +01:00
|
|
|
%endif
|
2024-03-14 03:30:45 +01:00
|
|
|
%if 0%{?rhel} && 0%{?rhel} == 8
|
2024-03-12 09:40:58 +01:00
|
|
|
source /opt/rh/gcc-toolset-9/enable
|
|
|
|
%endif
|
2024-03-14 03:30:45 +01:00
|
|
|
%cmake \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
2024-03-20 21:43:08 +01:00
|
|
|
%if 0%{?toolset_version}
|
|
|
|
-DCMAKE_C_COMPILER=gcc-%{toolset_version} \
|
|
|
|
-DCMAKE_CXX_COMPILER=g++-%{toolset_version} \
|
|
|
|
%endif
|
2024-03-14 03:30:45 +01:00
|
|
|
-DWITH_DPP_STATIC_BUNDLE=TRUE \
|
|
|
|
-DWITH_SYSTEMD=TRUE
|
|
|
|
%cmake_build
|
2024-03-12 09:40:58 +01:00
|
|
|
|
|
|
|
%install
|
|
|
|
%cmake_install
|
|
|
|
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}
|
2024-03-12 10:15:51 +01:00
|
|
|
install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/%{name}.json
|
|
|
|
install -p -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service
|
|
|
|
install -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysusersdir}/%{name}.conf
|
2024-03-12 09:40:58 +01:00
|
|
|
|
|
|
|
%pre
|
2024-03-20 21:43:08 +01:00
|
|
|
%if 0%{?fedora} || 0%{?rhel}
|
2024-03-12 10:15:51 +01:00
|
|
|
%sysusers_create_compat %{SOURCE3}
|
2024-03-20 21:43:08 +01:00
|
|
|
%endif
|
|
|
|
%if 0%{?suse_version}
|
|
|
|
%sysusers_create_package %{name} %{SOURCE3}
|
|
|
|
%endif
|
2024-03-12 09:40:58 +01:00
|
|
|
|
|
|
|
%post
|
|
|
|
%systemd_post %{name}.service
|
|
|
|
|
|
|
|
%preun
|
|
|
|
%systemd_preun %{name}.service
|
|
|
|
|
|
|
|
%postun
|
|
|
|
%systemd_postun_with_restart %{name}.service
|
|
|
|
|
|
|
|
%files
|
|
|
|
%{_bindir}/%{name}
|
|
|
|
%{_unitdir}/%{name}.service
|
|
|
|
%{_sysusersdir}/%{name}.conf
|
2024-03-12 10:15:51 +01:00
|
|
|
%config(noreplace) %attr(0640,root,%{name}) %{_sysconfdir}/%{name}.json
|
2024-03-12 09:40:58 +01:00
|
|
|
%dir %attr(0750,%{name},%{name}) %{_localstatedir}/lib/%{name}
|