c06fa7c
# https://fedoraproject.org/wiki/Packaging:Haskell
c06fa7c
2172611
%bcond_with tests
3144a96
%bcond_without static
3144a96
3144a96
%global binname cabal
2172611
953ac91
Name:           cabal-install
953ac91
# part of haskell-platform
f31c83e
Version:        1.18.1.0
e2ca96a
Release:        1%{?dist}
c06fa7c
Summary:        Command-line interface for Cabal and Hackage
953ac91
953ac91
License:        BSD
953ac91
URL:            http://hackage.haskell.org/package/%{name}
c06fa7c
Source0:        http://hackage.haskell.org/package/%{name}-%{version}/%{name}-%{version}.tar.gz
c06fa7c
Source1:        cabal-install.sh
c06fa7c
Patch0:         cabal-install-quieter-selfupgrade.patch
1a02f86
Patch1:         cabal-install-no-network-uri.patch
c06fa7c
953ac91
BuildRequires:  ghc-Cabal-devel
953ac91
BuildRequires:  ghc-rpm-macros
c06fa7c
# Begin cabal-rpm deps:
953ac91
BuildRequires:  ghc-HTTP-devel
c06fa7c
BuildRequires:  ghc-array-devel
2172611
BuildRequires:  ghc-bytestring-devel
c06fa7c
BuildRequires:  ghc-containers-devel
c06fa7c
BuildRequires:  ghc-directory-devel
c06fa7c
BuildRequires:  ghc-filepath-devel
c06fa7c
BuildRequires:  ghc-mtl-devel
c06fa7c
BuildRequires:  ghc-network-devel
c06fa7c
BuildRequires:  ghc-pretty-devel
c06fa7c
BuildRequires:  ghc-process-devel
953ac91
BuildRequires:  ghc-random-devel
2172611
BuildRequires:  ghc-stm-devel
953ac91
BuildRequires:  ghc-time-devel
c06fa7c
BuildRequires:  ghc-unix-devel
c06fa7c
BuildRequires:  ghc-zlib-devel
2172611
%if %{with tests}
2172611
BuildRequires:  ghc-HUnit-devel
2172611
BuildRequires:  ghc-QuickCheck-devel
2172611
BuildRequires:  ghc-test-framework-devel
2172611
BuildRequires:  ghc-test-framework-hunit-devel
2172611
BuildRequires:  ghc-test-framework-quickcheck2-devel
2172611
%endif
c06fa7c
# End cabal-rpm deps
953ac91
Requires:       ghc-compiler
4b0ce3c
# for /etc/bash_completion.d/
4b0ce3c
Requires:       filesystem
4b0ce3c
# for /etc/profile.d/
4b0ce3c
Requires:       setup
e2ca96a
Obsoletes:      cabal-dev < 0.9.2-5
3144a96
%if %{with static}
3144a96
Requires:       %{name}-common = %{version}-%{release}
3144a96
Requires(post): %{_sbindir}/update-alternatives
3144a96
Requires(postun): %{_sbindir}/update-alternatives
3144a96
%endif
953ac91
953ac91
%description
953ac91
The 'cabal' command-line program simplifies the process of managing Haskell
363a2f7
software by automating the fetching, configuration, compilation and
953ac91
installation of Haskell libraries and programs from Hackage.
953ac91
953ac91
3144a96
%if %{with static}
3144a96
%package common
3144a96
Summary:        Common files for %{name}
3144a96
3144a96
%description common
3144a96
This provides the common files for %{name}.
3144a96
3144a96
3144a96
%package static
3144a96
Summary:        Static Haskell build
3144a96
Requires:       %{name}-common = %{version}-%{release}
3144a96
Requires(post): %{_sbindir}/update-alternatives
3144a96
Requires(postun): %{_sbindir}/update-alternatives
3144a96
3144a96
%description static
3144a96
This provides a build with Haskell libraries statically linked.
3144a96
%endif
3144a96
3144a96
953ac91
%prep
953ac91
%setup -q
c06fa7c
%patch0 -p1 -b .orig
1a02f86
%patch1 -p1 -b .orig
1a02f86
1a02f86
cabal-tweak-flag network-uri False
953ac91
953ac91
953ac91
%build
3144a96
%if %{with static}
3144a96
%define ghc_without_dynamic 1
3144a96
%ghc_bin_build
3144a96
mv dist/build/%{binname}/%{binname}{,.static}
3144a96
%undefine ghc_without_dynamic
3144a96
%endif
953ac91
%ghc_bin_build
953ac91
953ac91
953ac91
%install
953ac91
%ghc_bin_install
3144a96
%if %{with static}
3144a96
mv %{buildroot}%{_bindir}/%{binname}{,.dynamic}
3144a96
install dist/build/%{binname}/%{binname}.static %{buildroot}%{_bindir}
3144a96
touch %{buildroot}%{_bindir}/%{binname}
3144a96
rm %{buildroot}%{_pkgdocdir}/LICENSE
3144a96
%endif
953ac91
953ac91
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d
953ac91
cp -p bash-completion/cabal $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d
953ac91
953ac91
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
953ac91
install -pm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
953ac91
953ac91
2172611
%check
2172611
%if %{with tests}
2172611
%cabal test
2172611
%endif
2172611
2172611
3144a96
%if %{with static}
32d1ea8
# avoid rpm ghost keeping pre-alternatives binary around
3144a96
%pre
3144a96
if [ $1 -gt 1 ] ; then
3144a96
  if [ -f %{_bindir}/%{binname} -a ! -L %{_bindir}/%{binname} ]; then
3144a96
      rm %{_bindir}/%{binname}
3144a96
  fi
3144a96
fi
3144a96
3144a96
3144a96
%post
3144a96
%{_sbindir}/update-alternatives --install %{_bindir}/%{binname} \
32d1ea8
  %{name} %{_bindir}/%{binname}.dynamic 70
3144a96
3144a96
3144a96
%postun
3144a96
if [ $1 -eq 0 ] ; then
32d1ea8
  %{_sbindir}/update-alternatives --remove %{name} %{_bindir}/%{binname}.dynamic
32d1ea8
fi
32d1ea8
32d1ea8
32d1ea8
# avoid rpm ghost keeping pre-alternatives binary around
32d1ea8
%pre static
32d1ea8
if [ $1 -gt 1 ] ; then
32d1ea8
  if [ -f %{_bindir}/%{binname} -a ! -L %{_bindir}/%{binname} ]; then
32d1ea8
      rm %{_bindir}/%{binname}
32d1ea8
  fi
3144a96
fi
3144a96
3144a96
3144a96
%post static
3144a96
%{_sbindir}/update-alternatives --install %{_bindir}/%{binname} \
32d1ea8
  %{name} %{_bindir}/%{binname}.static 30
3144a96
3144a96
3144a96
%postun static
3144a96
if [ $1 -eq 0 ] ; then
32d1ea8
  %{_sbindir}/update-alternatives --remove %{name} %{_bindir}/%{binname}.static
3144a96
fi
3144a96
%endif
3144a96
3144a96
953ac91
%files
3144a96
%if %{with static}
3144a96
%ghost %{_bindir}/%{binname}
3144a96
%{_bindir}/%{binname}.dynamic
3144a96
%else
3144a96
%doc LICENSE README
953ac91
%{_bindir}/cabal
4b0ce3c
%config(noreplace) %{_sysconfdir}/bash_completion.d/cabal
4b0ce3c
%config(noreplace) %{_sysconfdir}/profile.d/cabal-install.sh
3144a96
%endif
3144a96
3144a96
3144a96
%if %{with static}
3144a96
%files common
3144a96
%doc LICENSE README
3144a96
%config(noreplace) %{_sysconfdir}/bash_completion.d/cabal
3144a96
%config(noreplace) %{_sysconfdir}/profile.d/cabal-install.sh
3144a96
3144a96
3144a96
%files static
3144a96
%ghost %{_bindir}/%{binname}
3144a96
%{_bindir}/%{binname}.static
3144a96
%endif
953ac91
953ac91
953ac91
%changelog
f31c83e
* Wed May 13 2015 Jens Petersen <petersen@redhat.com> - 1.18.1.0-1
f31c83e
- security version update for upload command
f31c83e
1a02f86
* Thu Apr  2 2015 Jens Petersen <petersen@redhat.com> - 1.18.0.8-1
1a02f86
- update to 1.18.0.8
1a02f86
2172611
* Thu Aug  7 2014 Jens Petersen <petersen@redhat.com> - 1.18.0.5-1
2172611
- update to 1.18.0.5
e2ca96a
- obsolete cabal-dev
3144a96
- add static and common subpackages
2172611
d947564
* Tue Jul  8 2014 Jens Petersen <petersen@redhat.com> - 1.16.0.2-35
d947564
- f21 rebuild
363a2f7
f71a3e0
* Fri Apr 18 2014 Jens Petersen <petersen@redhat.com> - 1.16.0.2-34
f71a3e0
- bump release over haskell-platform
f71a3e0
4b0ce3c
* Thu Apr 17 2014 Jens Petersen <petersen@redhat.com> - 1.16.0.2-32
4b0ce3c
- mark bash_completion.d and profile.d files as config (#1069062)
f71a3e0
- require filesystem and setup to own the sysconfig dirs (#1069062)
4b0ce3c
c06fa7c
* Mon Feb 24 2014 Jens Petersen <petersen@redhat.com> - 1.16.0.2-31
c06fa7c
- update to 1.16.0.2
c06fa7c
- split out of haskell-platform (#1069062)
c06fa7c
- only show cabal-install upgrade notice for verbose
c06fa7c
953ac91
* Tue May  8 2012 Jens Petersen <petersen@redhat.com> - 0.14.0-1
953ac91
- update to 0.14.0 release
953ac91
953ac91
* Tue Mar 20 2012 Jens Petersen <petersen@redhat.com> - 0.13.3-0.1
953ac91
- update to latest darcs
953ac91
953ac91
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.10.2-7
953ac91
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
953ac91
953ac91
* Wed Dec 28 2011 Jens Petersen <petersen@redhat.com> - 0.10.2-6
953ac91
- rebuild for haskell-platform-2011.4.0.0
953ac91
953ac91
* Fri Dec 16 2011 Jens Petersen <petersen@redhat.com> - 0.10.2-5
953ac91
- bring back requires ghc-compiler (Stanislav Ochotnicky, #760461)
953ac91
953ac91
* Thu Oct 20 2011 Marcela Mašláňová <mmaslano@redhat.com> - 0.10.2-4.2
953ac91
- rebuild with new gmp without compat lib
953ac91
953ac91
* Mon Oct 10 2011 Peter Schiffer <pschiffe@redhat.com> - 0.10.2-4.1
953ac91
- rebuild with new gmp
953ac91
953ac91
* Tue Jun 21 2011 Jens Petersen <petersen@redhat.com> - 0.10.2-4
953ac91
- ghc_arches replaces ghc_excluded_archs
953ac91
953ac91
* Mon Jun 20 2011 Jens Petersen <petersen@redhat.com> - 0.10.2-3
953ac91
- BR ghc-Cabal-devel and use ghc_excluded_archs
953ac91
- drop ghc requires to allow local ghc
953ac91
953ac91
* Wed May 25 2011 Jens Petersen <petersen@redhat.com> - 0.10.2-2
953ac91
- add ppc64
953ac91
953ac91
* Fri Mar 11 2011 Jens Petersen <petersen@redhat.com> - 0.10.2-1
953ac91
- update to 0.10.2
953ac91
953ac91
* Thu Mar 10 2011 Fabio M. Di Nitto <fdinitto@redhat.com> - 0.9.6-0.2
953ac91
- Enable build on sparcv9
953ac91
953ac91
* Tue Feb 15 2011 Jens Petersen <petersen@redhat.com> - 0.9.6-0.1
953ac91
- update to 0.9.6 pre snapshot
953ac91
953ac91
* Tue Feb 15 2011 Jens Petersen <petersen@redhat.com> - 0.9.5-0.5
953ac91
- rebuild for haskell-platform-2011.1 updates
953ac91
953ac91
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.5-0.4
953ac91
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
953ac91
953ac91
* Sun Jan 23 2011 Jens Petersen <petersen@redhat.com> - 0.9.5-0.3
953ac91
- update to cabal2spec-0.22.4
953ac91
- BR ghc-devel
953ac91
953ac91
* Sun Dec  5 2010 Jens Petersen <petersen@redhat.com> - 0.9.5-0.2
953ac91
- rebuild with HTTP-4000.1.1
953ac91
953ac91
* Thu Nov 25 2010 Jens Petersen <petersen@redhat.com> - 0.9.5-0.1
953ac91
- update to current 0.9.5 snapshot
953ac91
953ac91
* Fri Jul 16 2010 Jens Petersen <petersen@redhat.com> - 0.8.2-1
953ac91
- update to 0.8.2 for haskell-platform-2010.2.0.0
953ac91
953ac91
* Sun Jun 27 2010 Jens Petersen <petersen@redhat.com> - 0.8.0-5
953ac91
- sync cabal2spec-0.22.1
953ac91
953ac91
* Wed May 19 2010 Jens Petersen <petersen@redhat.com> - 0.8.0-4
953ac91
- append ~/.cabal/bin to PATH (if dir exists) with new
953ac91
  /etc/profile.d/cabal-install.sh (#509699)
953ac91
953ac91
* Tue Apr 27 2010 Jens Petersen <petersen@redhat.com> - 0.8.0-3
953ac91
- rebuild against ghc-6.12.2
953ac91
953ac91
* Tue Mar 23 2010 Jens Petersen <petersen@redhat.com> - 0.8.0-2
953ac91
- rebuild against HTTP-4000.0.9 for haskell-platform-2010.1.0.0
953ac91
953ac91
* Mon Jan 11 2010 Jens Petersen <petersen@redhat.com> - 0.8.0-1
953ac91
- update to 0.8.0 for ghc-6.12.1
953ac91
- add dynamic bcond
953ac91
- drop redundant buildroot and its install cleaning
953ac91
953ac91
* Wed Sep 16 2009 Jens Petersen <petersen@redhat.com> - 0.6.2-6
953ac91
- really rebuild
953ac91
953ac91
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.2-5
953ac91
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
953ac91
953ac91
* Sun May 17 2009 Jens Petersen <petersen@redhat.com> - 0.6.2-4
953ac91
- buildrequires ghc-rpm-macros (cabal-0.16)
953ac91
953ac91
* Sun Apr 26 2009 Jens Petersen <petersen@redhat.com> - 0.6.2-3
953ac91
- rebuild against ghc-6.10.2
953ac91
953ac91
* Fri Feb 27 2009 Jens Petersen <petersen@redhat.com> - 0.6.2-2
953ac91
- update for cabal2spec-0.11:
953ac91
- use global
953ac91
- fix source url
953ac91
- add ix86 and alpha archs
953ac91
953ac91
* Mon Feb 23 2009 Jens Petersen <petersen@redhat.com> - 0.6.2-1
953ac91
- update to 0.6.2 release
953ac91
953ac91
* Mon Feb  9 2009 Jens Petersen <petersen@redhat.com> - 0.6.0-3
953ac91
- fix source url
953ac91
953ac91
* Wed Jan  7 2009 Jens Petersen <petersen@redhat.com> - 0.6.0-2
953ac91
- add bash completion file
953ac91
- update cabal build macro
953ac91
953ac91
* Tue Nov 11 2008 Jens Petersen <petersen@redhat.com> - 0.6.0-1
953ac91
- initial package for Fedora