File ghc-mod.spec of Package ghc-mod

#
# spec file for package ghc-mod
#
# Copyright (c) 2015 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 ghc-mod

%bcond_with tests

Name:           ghc-mod 
Version:        5.5.0.0
Release:        0
Summary:        Happy Haskell Programming
License:        AGPL-3.0+ and BSD-3-Clause
Group:          Development/Languages/Other

Url:            https://hackage.haskell.org/package/%{name}
Source0:        https://hackage.haskell.org/package/%{name}-%{version}/%{name}-%{version}.tar.gz

BuildRoot:      %{_tmppath}/%{name}-%{version}-build

BuildRequires:  ghc-Cabal-devel
BuildRequires:  ghc-rpm-macros
# Begin cabal-rpm deps:
BuildRequires:  chrpath
BuildRequires:  ghc-async-devel
BuildRequires:  ghc-cabal-helper-devel
BuildRequires:  ghc-cereal-devel
BuildRequires:  ghc-containers-devel
BuildRequires:  ghc-data-default-devel
BuildRequires:  ghc-deepseq-devel
BuildRequires:  ghc-directory-devel
BuildRequires:  ghc-djinn-ghc-devel
BuildRequires:  ghc-extra-devel
BuildRequires:  ghc-fclabels-devel
BuildRequires:  ghc-filepath-devel
BuildRequires:  ghc-ghc-devel
BuildRequires:  ghc-ghc-paths-devel
BuildRequires:  ghc-ghc-syb-utils-devel
BuildRequires:  ghc-haskell-src-exts-devel
BuildRequires:  ghc-hlint-devel
BuildRequires:  ghc-io-choice-devel
BuildRequires:  ghc-monad-control-devel
BuildRequires:  ghc-monad-journal-devel
BuildRequires:  ghc-mtl-devel
BuildRequires:  ghc-old-time-devel
BuildRequires:  ghc-optparse-applicative-devel
BuildRequires:  ghc-pipes-devel
BuildRequires:  ghc-pretty-devel
BuildRequires:  ghc-process-devel
BuildRequires:  ghc-safe-devel
BuildRequires:  ghc-split-devel
BuildRequires:  ghc-syb-devel
BuildRequires:  ghc-temporary-devel
BuildRequires:  ghc-text-devel
BuildRequires:  ghc-time-devel
BuildRequires:  ghc-transformers-base-devel
BuildRequires:  ghc-transformers-devel
%if %{with tests}
BuildRequires:  ghc-doctest-devel
BuildRequires:  ghc-hspec-devel
%endif
Suggests:       emacs-haskel-mode
# End cabal-rpm deps

%description
The ghc-mod command is a backend command to enrich Haskell programming on
editors including Emacs, Vim, and Sublime. The ghc-mod command is based on
ghc-mod library which is a wrapper of GHC API. This package includes the
ghc-mod command, the ghc-mod library, and Emacs front-end (for historical
reasons). For more information, please see its home page.


%package -n ghc-%{name}
Summary:        Haskell %{name} library
Group:          System/Libraries

%description -n ghc-%{name}
This package provides the Haskell %{name} shared library.


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

%description -n ghc-%{name}-devel
This package provides the Haskell %{name} library development files.


%prep
%setup -q

%build
%define cabal_configure_options --libexecdir=%{_libexecdir}
%ghc_lib_build

%install
%ghc_lib_install
%ghc_fix_dynamic_rpath %{pkg_name} ghc-modi
mkdir -p %{buildroot}%{_sysconfdir}/profile.d
touch %{buildroot}%{_sysconfdir}/profile.d/ghc-mod.sh
touch %{buildroot}%{_sysconfdir}/profile.d/ghc-mod.csh
echo 'export cabal_helper_libexecdir=%{_libexecdir}' > %{buildroot}%{_sysconfdir}/profile.d/ghc-mod.sh
echo 'setenv cabal_helper_libexecdir %{_libexecdir}' > %{buildroot}%{_sysconfdir}/profile.d/ghc-mod.csh

rm %{buildroot}%{_datadir}/%{name}-%{version}/LICENSE
rm %{buildroot}%{_datadir}/%{name}-%{version}/COPYING.AGPL3
rm %{buildroot}%{_datadir}/%{name}-%{version}/COPYING.BSD3

%check
%if %{with tests}
%cabal test
%endif

%post -n ghc-%{name}-devel
%ghc_pkg_recache

%postun -n ghc-%{name}-devel
%ghc_pkg_recache

%files
%defattr(-,root,root,-)
%doc LICENSE COPYING.AGPL3 COPYING.BSD3
%{_bindir}/%{name}
%{_bindir}/ghc-modi
%{_datadir}/%{name}-%{version}
%config %{_sysconfdir}/profile.d/ghc-mod.sh
%config %{_sysconfdir}/profile.d/ghc-mod.csh

%files -n ghc-%{name} -f ghc-%{name}.files
%defattr(-,root,root,-)

%files -n ghc-%{name}-devel -f ghc-%{name}-devel.files
%defattr(-,root,root,-)

%changelog
openSUSE Build Service is sponsored by