File matrix-bot.spec of Package matrix-bot

# generated by cabal-rpm-2.3.2
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Haskell/

%bcond ghc_prof 1
%bcond haddock 1

%global github_author unclechu
%global github_project matrix-multipurpose-bot

%global pkg_name matrix-bot
%global pkgver %{pkg_name}-%{version}
%define ghc_html_pkg_dir %{ghc_html_libraries_dir}/%{pkg_name}-0.0.0.0

%{?haskell_setup}

Name:           %{pkg_name}
Version:        0.1.0
Release:        1%{?dist}
Summary:        Matrix multipurpose bot

License:        GPL-3.0-only
URL:            https://github.com/%{github_author}/%{github_project}
# Begin cabal-rpm sources:
Source0:        %{url}/archive/v%{version}/%{github_project}-%{version}.tar.gz
# End cabal-rpm sources
Source1:        matrix-bot.service
Source2:        matrix-bot@.service
Source3:        matrix-bot.sysusers

BuildRequires:  systemd-rpm-macros
# Begin cabal-rpm deps:
BuildRequires:  ghc-rpm-macros
BuildRequires:  ghc-Cabal-devel
BuildRequires:  ghc-QuickCheck-devel
BuildRequires:  ghc-aeson-devel
BuildRequires:  ghc-attoparsec-devel
BuildRequires:  ghc-base-devel
BuildRequires:  ghc-base64-devel
BuildRequires:  ghc-binary-devel
BuildRequires:  ghc-bytestring-devel
BuildRequires:  ghc-containers-devel
BuildRequires:  ghc-directory-devel
BuildRequires:  ghc-fast-logger-devel
BuildRequires:  ghc-free-devel
BuildRequires:  ghc-http-client-devel
BuildRequires:  ghc-http-client-tls-devel
BuildRequires:  ghc-http-types-devel
BuildRequires:  ghc-lens-devel
BuildRequires:  ghc-monad-logger-devel
BuildRequires:  ghc-mtl-devel
BuildRequires:  ghc-optparse-applicative-devel
BuildRequires:  ghc-safe-exceptions-devel
BuildRequires:  ghc-servant-devel
BuildRequires:  ghc-servant-client-devel
BuildRequires:  ghc-servant-client-core-devel
BuildRequires:  ghc-text-devel
BuildRequires:  ghc-time-devel
BuildRequires:  ghc-transformers-devel
BuildRequires:  ghc-unliftio-devel
BuildRequires:  ghc-unliftio-core-devel
BuildRequires:  ghc-uuid-devel
BuildRequires:  ghc-wai-devel
%if %{with ghc_prof}
BuildRequires:  ghc-QuickCheck-prof
BuildRequires:  ghc-aeson-prof
BuildRequires:  ghc-attoparsec-prof
BuildRequires:  ghc-base-prof
BuildRequires:  ghc-base64-prof
BuildRequires:  ghc-binary-prof
BuildRequires:  ghc-bytestring-prof
BuildRequires:  ghc-containers-prof
BuildRequires:  ghc-directory-prof
BuildRequires:  ghc-fast-logger-prof
BuildRequires:  ghc-free-prof
BuildRequires:  ghc-http-client-prof
BuildRequires:  ghc-http-client-tls-prof
BuildRequires:  ghc-http-types-prof
BuildRequires:  ghc-lens-prof
BuildRequires:  ghc-monad-logger-prof
BuildRequires:  ghc-mtl-prof
BuildRequires:  ghc-optparse-applicative-prof
BuildRequires:  ghc-safe-exceptions-prof
BuildRequires:  ghc-servant-prof
BuildRequires:  ghc-servant-client-prof
BuildRequires:  ghc-servant-client-core-prof
BuildRequires:  ghc-text-prof
BuildRequires:  ghc-time-prof
BuildRequires:  ghc-transformers-prof
BuildRequires:  ghc-unliftio-prof
BuildRequires:  ghc-unliftio-core-prof
BuildRequires:  ghc-uuid-prof
BuildRequires:  ghc-wai-prof
%endif
BuildRequires:  help2man
# End cabal-rpm deps

%description
Matrix multipurpose bot.


%package -n ghc-%{name}
Summary:        Haskell %{name} library

%description -n ghc-%{name}
This package provides the Haskell %{name} shared library.


%package -n ghc-%{name}-devel
Summary:        Haskell %{name} library development files
Provides:       ghc-%{name}-static = %{version}-%{release}
Provides:       ghc-%{name}-static%{?_isa} = %{version}-%{release}
%if %{defined ghc_version}
Requires:       ghc-compiler = %{ghc_version}
%endif
Requires:       ghc-%{name}%{?_isa} = %{version}-%{release}

%description -n ghc-%{name}-devel
This package provides the Haskell %{name} library development files.


%if %{with haddock}
%package -n ghc-%{name}-doc
Summary:        Haskell %{name} library documentation
BuildArch:      noarch
Requires:       ghc-filesystem

%description -n ghc-%{name}-doc
This package provides the Haskell %{name} library documentation.
%endif


%if %{with ghc_prof}
%package -n ghc-%{name}-prof
Summary:        Haskell %{name} profiling library
Requires:       ghc-%{name}-devel%{?_isa} = %{version}-%{release}
Supplements:    (ghc-%{name}-devel and ghc-prof)

%description -n ghc-%{name}-prof
This package provides the Haskell %{name} profiling library.
%endif


%prep
# Begin cabal-rpm setup:
%autosetup -n %{github_project}-%{version} -p1
# End cabal-rpm setup


%build
# Begin cabal-rpm build:
%ghc_lib_build
# End cabal-rpm build


%install
# Begin cabal-rpm install
%ghc_lib_install

set noclobber
mkdir -p %{buildroot}%{bash_completions_dir}
mkdir -p %{buildroot}%{fish_completions_dir}
mkdir -p %{buildroot}%{zsh_completions_dir}
%{buildroot}%{_bindir}/%{name} --bash-completion-script %{name} | sed s/filenames/default/ > %{buildroot}%{bash_completions_dir}/%{name}
%{buildroot}%{_bindir}/%{name} --fish-completion-script %{name} > %{buildroot}%{fish_completions_dir}/%{name}
%{buildroot}%{_bindir}/%{name} --zsh-completion-script %{name} | sed s/filenames/default/ > %{buildroot}%{zsh_completions_dir}/_%{name}

mkdir -p %{buildroot}%{_mandir}/man1/
help2man --no-info --version-string=0.0.0.0 %{buildroot}%{_bindir}/%{name} > %{buildroot}%{_mandir}/man1/%{name}.1
# End cabal-rpm install

install -d -m 710 %{buildroot}%{_sysconfdir}/matrix-bot
install -d -m 710 %{buildroot}%{_sharedstatedir}/matrix-bot
install -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/matrix-bot.service
install -D -m 644 %{SOURCE2} %{buildroot}%{_unitdir}/matrix-bot@.service
install -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysusersdir}/matrix-bot.conf


%pre
%sysusers_create_compat %{SOURCE3}


%post
%systemd_post matrix-bot.service


%preun
%systemd_preun matrix-bot.service


%postun
%systemd_postun_with_restart matrix-bot.service


%files
# Begin cabal-rpm files:
%license LICENSE
%doc README.md
%{_bindir}/%{name}
%{bash_completions_dir}/%{name}
%{fish_completions_dir}/%{name}
%{zsh_completions_dir}/_%{name}
%{_mandir}/man1/%{name}.1*
# End cabal-rpm files
%dir %attr(0710,root,matrix-bot) %{_sysconfdir}/matrix-bot
%ghost %attr(0640,root,matrix-bot) %{_sysconfdir}/matrix-bot/auth
%ghost %attr(0640,root,matrix-bot) %{_sysconfdir}/matrix-bot/conf
%dir %attr(0710,matrix-bot,matrix-bot) %{_sharedstatedir}/matrix-bot
%{_unitdir}/matrix-bot.service
%{_unitdir}/matrix-bot@.service
%{_sysusersdir}/matrix-bot.conf


%files -n ghc-%{name} -f ghc-%{name}.files
# Begin cabal-rpm files:
%license LICENSE
# End cabal-rpm files


%files -n ghc-%{name}-devel -f ghc-%{name}-devel.files
%doc README.md


%if %{with haddock}
%files -n ghc-%{name}-doc -f ghc-%{name}-doc.files
%license LICENSE
%endif


%if %{with ghc_prof}
%files -n ghc-%{name}-prof -f ghc-%{name}-prof.files
%endif