#
# spec file for package cabal-plan
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global pkg_name cabal-plan
%global pkgver %{pkg_name}-%{version}
Name: %{pkg_name}
Version: 0.7.3.0
Release: 0
Summary: Library and utility for processing cabal's plan.json file
License: GPL-2.0-or-later
URL: https://hackage.haskell.org/package/%{name}
Source0: https://hackage.haskell.org/package/%{name}-%{version}/%{name}-%{version}.tar.gz
Source1: https://hackage.haskell.org/package/%{name}-%{version}/revision/2.cabal#/%{name}.cabal
BuildRequires: chrpath
BuildRequires: ghc-Cabal-devel
BuildRequires: ghc-aeson-devel
BuildRequires: ghc-aeson-prof
BuildRequires: ghc-ansi-terminal-devel
BuildRequires: ghc-ansi-terminal-prof
BuildRequires: ghc-async-devel
BuildRequires: ghc-async-prof
BuildRequires: ghc-base-compat-devel
BuildRequires: ghc-base-compat-prof
BuildRequires: ghc-base-devel
BuildRequires: ghc-base-prof
BuildRequires: ghc-base16-bytestring-devel
BuildRequires: ghc-base16-bytestring-prof
BuildRequires: ghc-bytestring-devel
BuildRequires: ghc-bytestring-prof
BuildRequires: ghc-containers-devel
BuildRequires: ghc-containers-prof
BuildRequires: ghc-directory-devel
BuildRequires: ghc-directory-prof
BuildRequires: ghc-filepath-devel
BuildRequires: ghc-filepath-prof
BuildRequires: ghc-mtl-devel
BuildRequires: ghc-mtl-prof
BuildRequires: ghc-optics-core-devel
BuildRequires: ghc-optics-core-prof
BuildRequires: ghc-optparse-applicative-devel
BuildRequires: ghc-optparse-applicative-prof
BuildRequires: ghc-parsec-devel
BuildRequires: ghc-parsec-prof
BuildRequires: ghc-process-devel
BuildRequires: ghc-process-prof
BuildRequires: ghc-rpm-macros
BuildRequires: ghc-semialign-devel
BuildRequires: ghc-semialign-prof
BuildRequires: ghc-singleton-bool-devel
BuildRequires: ghc-singleton-bool-prof
BuildRequires: ghc-text-devel
BuildRequires: ghc-text-prof
BuildRequires: ghc-these-devel
BuildRequires: ghc-these-prof
BuildRequires: ghc-topograph-devel
BuildRequires: ghc-topograph-prof
BuildRequires: ghc-transformers-devel
BuildRequires: ghc-transformers-prof
BuildRequires: ghc-vector-devel
BuildRequires: ghc-vector-prof
ExcludeArch: %{ix86}
%description
This package provides a library (see "Cabal.Plan") for decoding 'plan.json'
files as well as the simple tool 'cabal-plan' for extracting and pretty
printing the information contained in the 'plan.json' file.
'plan.json' files are generated by
[cabal](https://hackage.haskell.org/package/cabal-install)'s [Nix-style local
builds](http://cabal.readthedocs.io/en/latest/nix-local-build.html) and contain
detailed information about the build/install plan computed by the cabal solver.
== 'cabal-plan' utility
The 'cabal-plan' executable (enabled via the 'exe' cabal flag) provides various
operations:
[info] Show basic report of dependency tree [show] Dump 'PlanJson'
data-structure via 'Show' instance [tred] Show dependency tree as a graph
[diff] Diff two install plans [list-bins] List all binaries [list-bin] List
single binary (useful for scripting, e.g. 'cabal list-bin exe:cabal-plan')
[fingerprint] Print SHA256 sums of dependencies' source tarballs and cabal
files [dot] Generate graph of dependencies in '.dot' format [topo] Print plan
topologically sorted [license-report] Generate license report for a component
(only available when built with 'license-report' flag enabled); see
<src/example/cabal-plan.md report example for cabal-plan>
(<src/example/cabal-plan.html Pandoc rendered HTML>)
See also ["New things in Haskell package QA"
Blogpost](https://oleg.fi/gists/posts/2018-01-08-haskell-package-qa.html) for a
description of the 'topo' and 'dot' operations as well as how to enable
tab-completion.
%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
Requires: ghc-%{name} = %{version}-%{release}
Requires: ghc-compiler = %{ghc_version}
Requires(post): ghc-compiler = %{ghc_version}
Requires(postun): ghc-compiler = %{ghc_version}
%description -n ghc-%{name}-devel
This package provides the Haskell %{name} library development files.
%package -n ghc-%{pkg_name}-doc
Summary: Haskell %{pkg_name} library documentation
Requires: ghc-filesystem
BuildArch: noarch
%description -n ghc-%{pkg_name}-doc
This package provides the Haskell %{pkg_name} library documentation.
%package -n ghc-%{pkg_name}-prof
Summary: Haskell %{pkg_name} profiling library
Requires: ghc-%{pkg_name}-devel = %{version}-%{release}
Supplements: (ghc-%{pkg_name}-devel and ghc-prof)
%description -n ghc-%{pkg_name}-prof
This package provides the Haskell %{pkg_name} profiling library.
%prep
%autosetup
cp -p %{SOURCE1} %{name}.cabal
cabal-tweak-dep-ver base "^>=4.18.0.0" "< 5"
cabal-tweak-dep-ver bytestring "^>=0.11.1.0" "< 1"
cabal-tweak-dep-ver text "^>=2.0.1" "< 3"
%build
%define cabal_configure_options -fexe
%ghc_lib_build
%install
%ghc_lib_install
%ghc_fix_rpath %{pkg_name}-%{version}
%post -n ghc-%{name}-devel
%ghc_pkg_recache
%postun -n ghc-%{name}-devel
%ghc_pkg_recache
%files
%license LICENSE.GPLv2
%license LICENSE.GPLv3
%doc ChangeLog.md example
%{_bindir}/%{name}
%files -n ghc-%{name} -f ghc-%{name}.files
%license LICENSE.GPLv2
%license LICENSE.GPLv3
%files -n ghc-%{name}-devel -f ghc-%{name}-devel.files
%doc ChangeLog.md example
%files -n ghc-%{pkg_name}-doc -f ghc-%{pkg_name}-doc.files
%license LICENSE.GPLv2
%license LICENSE.GPLv3
%files -n ghc-%{pkg_name}-prof -f ghc-%{pkg_name}-prof.files
%changelog