%global pkg_name network
%global pkgver %{pkg_name}-%{version}
%bcond_with tests

Name:           ghc-%{pkg_name}
Version:        3.2.7.0
Release:        1
Summary:        Low-level networking interface
License:        BSD-3-Clause
URL:            https://hackage.haskell.org/package/%{pkg_name}
Source0:        https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
BuildRequires:  ghc-Cabal-devel
BuildRequires:  ghc-base-devel
BuildRequires:  ghc-base-prof
BuildRequires:  ghc-bytestring-devel
BuildRequires:  ghc-bytestring-prof
BuildRequires:  ghc-deepseq-devel
BuildRequires:  ghc-deepseq-prof
BuildRequires:  ghc-directory-devel
BuildRequires:  ghc-directory-prof
BuildRequires:  ghc-rpm-macros
ExcludeArch:    %{ix86}
%if %{with tests}
BuildRequires:  ghc-HUnit-devel
BuildRequires:  ghc-HUnit-prof
BuildRequires:  ghc-QuickCheck-devel
BuildRequires:  ghc-QuickCheck-prof
BuildRequires:  ghc-hspec-devel
BuildRequires:  ghc-hspec-prof
BuildRequires:  ghc-temporary-devel
BuildRequires:  ghc-temporary-prof
%endif

%description
This package provides a low-level networking interface.

=== High-Level Packages Other packages provide higher level interfaces:

* connection * hookup * network-simple

=== Extended Packages 'network' seeks to provide a cross-platform core for
networking. As such some APIs live in extended libraries. Packages in the
'network' ecosystem are often prefixed with 'network-'.

==== 'network-bsd' In 'network-3.0.0.0' the 'Network.BSD' module was split off
into its own package, 'network-bsd-3.0.0.0'.

==== 'network-uri' In 'network-2.6' the 'Network.URI' module was split off into
its own package, 'network-uri-2.6'. If you're using the 'Network.URI' module
you can automatically get it from the right package by adding this to your
'.cabal' file:

> library > build-depends: network-uri-flag.

%package devel
Summary:        Haskell %{pkg_name} library development files
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.

%package -n ghc-%{pkg_name}-help
Summary:        Haskell %{pkg_name} library documentation
BuildArch:      noarch

%description -n ghc-%{pkg_name}-help
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 -n %{pkg_name}-%{version}

%build
%ghc_lib_build

%install
%ghc_lib_install

%check
%cabal_test

%post devel
%ghc_pkg_recache

%postun devel
%ghc_pkg_recache

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

%files devel -f %{name}-devel.files
%doc CHANGELOG.md README.md examples

%files -n ghc-%{pkg_name}-help -f ghc-%{pkg_name}-help.files
%license LICENSE

%files -n ghc-%{pkg_name}-prof -f ghc-%{pkg_name}-prof.files

%changelog
* Thu Nov 28 2024 zhangyuting <zhangyuting@kylinos.cn> 3.2.7.0-1
- Update version to 3.2.7.0
- Using nested bracket for gracefulClose.
- Fix memory leak in getaddrinfo and make it async exception safe.
- Make call to c_free async exception safe.

* Tue Aug 22 2023 Lin Runze <lrzlin@163.com> 3.1.4.0-1
- Initial packaging (Version 3.1.4.0)