File ghc-yesod.spec of Package ghc-yesod
%global pkg_name yesod
%global ghc_optflags -fhide-source-paths
Name: ghc-%{pkg_name}
Version: 1.6.2.1
Release: 0
Summary: Creation of type-safe, RESTful web applications
License: MIT
URL: https://www.yesodweb.com/
Source0: %{pkg_name}-%{version}.tar.gz
# Core packaging macros for Haskell on openSUSE
BuildRequires: ghc-rpm-macros
BuildRequires: ghc-Cabal-devel
# Common dependencies for yesod library
BuildRequires: ghc-yesod-core-devel
BuildRequires: ghc-yesod-form-devel
BuildRequires: ghc-yesod-persistent-devel
BuildRequires: ghc-wai-devel
BuildRequires: ghc-wai-extra-devel
BuildRequires: ghc-warp-devel
BuildRequires: ghc-shakespeare-devel
BuildRequires: ghc-aeson-devel
BuildRequires: ghc-unliftio-devel
BuildRequires: ghc-monad-logger-devel
BuildRequires: ghc-persistent-devel
BuildRequires: ghc-yaml-devel
BuildRequires: ghc-directory-devel
BuildRequires: ghc-filepath-devel
BuildRequires: ghc-text-devel
BuildRequires: ghc-bytestring-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Yesod is a Haskell web framework for productive development of type-safe,
RESTful web applications.
%package devel
Summary: Haskell yesod library development files
Requires: %{name} = %{version}-%{release}
%description devel
This package provides the Haskell yesod development files.
%package prof
Summary: Haskell yesod profiling libraries
Requires: %{name}-devel = %{version}-%{release}
%description prof
This package provides the Yesod profiling libraries built with profiling
support enabled.
%prep
%setup -q -n %{pkg_name}-%{version}
%build
# Build the Custom Setup using the system Cabal
ghc --make -package Cabal -no-user-package-db -dynamic Setup
LANG=C.utf8 ./Setup --version
# Configure the build. We explicitly override ghc options to avoid the
# unsupported -fobject-determinism flag on newer GHC versions.
LANG=C.utf8 ./Setup configure \
--prefix=%{_prefix} \
--libdir=%{_libdir} \
--docdir=%{_datadir}/licenses/%{name} \
--libsubdir='$compiler/lib/$pkgid' \
--datasubdir='$pkgid' \
--libexecsubdir='$pkgid' \
--ghc \
--dynlibdir=%{_libdir}/ghc-%(ghc --numeric-version)/lib \
--global \
--ghc-options="%{?ghc_optflags} " \
-v \
--enable-library-profiling \
--enable-shared \
--htmldir=%{_datadir}/doc/packages/ghc-%(ghc --numeric-version)/html/libraries/%{pkg_name}-%{version} \
--global
LANG=C.utf8 ./Setup build
# Build documentation if possible; ignore errors if haddock not available
LANG=C.utf8 ./Setup haddock --html-location=%{_datadir}/doc/packages/ghc-%(ghc --numeric-version)/html || :
%install
rm -rf %{buildroot}
LANG=C.utf8 ./Setup copy --destdir=%{buildroot}
# Generate package config for ghc package database (for -devel files)
install -d %{buildroot}%{_libdir}/ghc-%(ghc --numeric-version)/package.conf.d
LANG=C.utf8 ./Setup register --gen-pkg-config=%{buildroot}%{_libdir}/ghc-%(ghc --numeric-version)/package.conf.d/%{pkg_name}.conf
%check
# No test suite defined upstream; skip.
%files
%license LICENSE* LICENSE *.LICENSE* COPYING* COPYING
%doc README* ChangeLog* CHANGELOG* *.md
%{_libdir}/ghc-*/%{pkg_name}-*/**
%files devel
%{_libdir}/ghc-*/package.conf.d/%{pkg_name}.conf
%files prof
# Profiling libraries typically have a 'p_' component directory; include if present
%{_libdir}/ghc-*/%{pkg_name}-*/p_*/**