File ghc-network-uri-flag.spec of Package ghc-network-uri-flag

#
# spec file for package ghc-network-uri-flag
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


%global pkg_name network-uri-flag
Name:           ghc-%{pkg_name}
Version:        0.1
Release:        0
Summary:        Pseudo-package encapsulating flag(network-uri) Cabal boilerplate
License:        BSD-3-Clause
Group:          Development/Libraries/Haskell
URL:            https://hackage.haskell.org/package/%{pkg_name}
Source0:        https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
Source1:        https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/2.cabal#/%{pkg_name}.cabal
BuildRequires:  ghc-Cabal-devel
BuildRequires:  ghc-network-devel
BuildRequires:  ghc-network-uri-devel
BuildRequires:  ghc-rpm-macros

%description
This empty package does not provide any modules; its sole purpose is to provide
the 'network-uri' Cabal flag logic below so you don't have to include that
boilerplate in your '.cabal' file.

> flag network-uri > description: Get Network.URI from the network-uri package
> default: True > > library > if flag(network-uri) > build-depends: network-uri
>= 2.6, network >= 2.6 > else > build-depends: network-uri < 2.6, network < 2.6

This avoids combining 'network-uri >= 2.6' with 'network < 2.6' which both
export a name-clashing 'Network.URI' module, because in network-2.6 the
'Network.URI' module was split off from the network package into
network-uri-2.6.

In other words, the logic above makes sure that the 'Network.URI' module is
provided by either 'network-uri' or by 'network' (in the
<https://en.wikipedia.org/wiki/Exclusive_or XOR> sense).

In order to benefit from this module, simply include it in your 'build-depends'
declaration alongside 'network' and 'network-uri'.

> build-depends: > network >= 2.5 && < 2.7, > network-uri >= 2.5 && < 2.7, >
network-uri-flag == 0.1.*

/NOTE: It's almost always an error to list this package if network and
network-uri aren't both listed as well!/.

%package devel
Summary:        Haskell %{pkg_name} library development files
Group:          Development/Libraries/Haskell
Requires:       %{name} = %{version}-%{release}
Requires:       ghc-compiler = %{ghc_version}
Requires(post): ghc-compiler = %{ghc_version}
Requires(postun): ghc-compiler = %{ghc_version}

%description devel
This package provides the Haskell %{pkg_name} library development
files.

%prep
%setup -q -n %{pkg_name}-%{version}
cp -p %{SOURCE1} %{pkg_name}.cabal

%build
%ghc_lib_build_without_haddock

%install
%ghc_lib_install

%post devel
%ghc_pkg_recache

%postun devel
%ghc_pkg_recache

%files -f %{name}.files
%doc LICENSE

%files devel -f %{name}-devel.files
%doc ChangeLog.md

%changelog
openSUSE Build Service is sponsored by