cabal-rpm/cabal-rpm.spec
2023-07-23 15:09:06 +08:00

122 lines
3.7 KiB
RPMSpec

# generated by cabal-rpm-2.1.2 --stream hackage
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Haskell/
%bcond_without manpage
Name: cabal-rpm
Version: 2.1.1
Release: %autorelease
Summary: RPM packaging tool for Haskell Cabal-based packages
License: GPL-3.0-or-later
Url: https://hackage.haskell.org/package/%{name}
# Begin cabal-rpm sources:
Source0: https://hackage.haskell.org/package/%{name}-%{version}/%{name}-%{version}.tar.gz
Source1: https://hackage.haskell.org/package/%{name}-%{version}/%{name}.cabal#/%{name}-%{version}.cabal
# End cabal-rpm sources
# tweaked to add cblrpm
Source3: bash_completion
# Begin cabal-rpm deps:
BuildRequires: dos2unix
BuildRequires: ghc-rpm-macros
BuildRequires: ghc-Cabal-devel
BuildRequires: ghc-base-devel
BuildRequires: ghc-bytestring-devel
BuildRequires: ghc-directory-devel
BuildRequires: ghc-extra-devel
BuildRequires: ghc-filepath-devel
BuildRequires: ghc-http-client-devel
BuildRequires: ghc-http-client-tls-devel
BuildRequires: ghc-http-conduit-devel
BuildRequires: ghc-optparse-applicative-devel
BuildRequires: ghc-process-devel
BuildRequires: ghc-simple-cabal-devel
BuildRequires: ghc-simple-cmd-devel
BuildRequires: ghc-simple-cmd-args-devel
BuildRequires: ghc-time-devel
BuildRequires: ghc-unix-devel
# End cabal-rpm deps
%if %{with manpage}
BuildRequires: pandoc
%endif
Obsoletes: cabal2spec < 0.26
Provides: cblrpm = %{version}-%{release}
Requires: cabal-install
Requires: dos2unix
Requires: ghc-rpm-macros
Requires: rpm-build
## for spectool
#Requires: rpmdevtools
# for repoquery
%if 0%{?fedora} || 0%{?rhel} > 7
Requires: dnf-plugins-core
%else
Requires: yum-utils
%endif
# for rpmdev-bumpspec
Requires: rpmdevtools
Requires: wget
%description
This package provides a RPM packaging tool for Haskell Cabal-based packages.
cabal-rpm has commands to generate a RPM spec file and srpm for a package.
It can rpmbuild packages, yum/dnf install their dependencies, prep packages,
and install them. There are commands to list package dependencies and missing
dependencies. The diff command compares the current spec file with a freshly
generated one, the update command updates the spec file to latest version from
Stackage or Hackage, and the refresh command updates the spec file to the
current cabal-rpm packaging. It also handles Hackage revisions of packages.
Standalone packages can also be made, built with cabal-install.
%prep
# Begin cabal-rpm setup:
%setup -q
dos2unix -k -n %{SOURCE1} %{name}.cabal
# End cabal-rpm setup
%build
# Begin cabal-rpm build:
%ghc_bin_build
# End cabal-rpm build
%if %{with manpage}
pandoc -s -t man man/cabal-rpm.1.md > man/cabal-rpm.1
%endif
%install
# Begin cabal-rpm install
%ghc_bin_install
mkdir -p %{buildroot}%{_datadir}/bash-completion/completions/
%{buildroot}%{_bindir}/%{name} --bash-completion-script %{name} | sed s/filenames/default/ > %{buildroot}%{_datadir}/bash-completion/completions/%{name}
# End cabal-rpm install
install -p -m 0644 -D %{SOURCE3} %{buildroot}%{_datadir}/bash-completion/completions/%{name}
ln -s %{name} %{buildroot}%{_datadir}/bash-completion/completions/cblrpm
%if %{with manpage}
install -p -m 0644 -D man/%{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1
ln -s %{name}.1 %{buildroot}%{_mandir}/man1/cblrpm.1
%endif
ln -s %{name} %{buildroot}%{_bindir}/cblrpm
%files
# Begin cabal-rpm files:
%license COPYING
%doc ChangeLog README.md TODO
%{_bindir}/%{name}
%{_datadir}/bash-completion/completions/%{name}
# End cabal-rpm files
%{_bindir}/cblrpm
%{_datadir}/bash-completion/completions/cblrpm
%{_mandir}/man1/%{name}.1*
%{_mandir}/man1/cblrpm.1*
%changelog
%autochangelog