add a static alternative subpackage and a common subpackage

epel9
Jens Petersen 10 years ago
parent 60937716f9
commit e922f2f705

@ -1,10 +1,12 @@
# https://fedoraproject.org/wiki/Packaging:Haskell
%bcond_without static
%global pkg_name pandoc
Name: %{pkg_name}
Version: 1.12.3.3
Release: 5%{?dist}
Release: 6%{?dist}
Summary: Conversion between markup formats
License: GPLv2+
@ -54,15 +56,20 @@ BuildRequires: ghc-zip-archive-devel
BuildRequires: ghc-zlib-devel
BuildRequires: happy
# End cabal-rpm deps
%if %{with static}
Requires: %{name}-common = %{version}-%{release}
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
%endif
%description
Pandoc is a Haskell library for converting from one markup format to another,
and a command-line tool that uses this library. It can read markdown and
(subsets of) HTML, reStructuredText, LaTeX, DocBook, MediaWiki markup, Haddock
markup, OPML, and Textile, and it can write markdown, reStructuredText, HTML,
LaTeX, ConTeXt, Docbook, OPML, OpenDocument, ODT, Word docx, RTF, MediaWiki,
Textile, groff man pages, plain text, Emacs Org-Mode, AsciiDoc, EPUB (v2 and
v3), FictionBook2, and several kinds of HTML/javascript slide shows (S5, Slidy,
Pandoc is a command-line tool and also a Haskell library for converting
from one markup format to another. It can read markdown and(subsets of) HTML,
reStructuredText, LaTeX, DocBook, MediaWiki markup, Haddock markup, OPML,
and Textile, and it can write markdown, reStructuredText, HTML, LaTeX, ConTeXt,
Docbook, OPML, OpenDocument, ODT, Word docx, RTF, MediaWiki, Textile,
groff man pages, plain text, Emacs Org-Mode, AsciiDoc, EPUB (v2 and v3),
FictionBook2, and several kinds of HTML/javascript slide shows (S5, Slidy,
Slideous, DZSlides, reveal.js).
Pandoc extends standard markdown syntax with footnotes, embedded LaTeX,
@ -72,8 +79,30 @@ for those who need a drop-in replacement for Markdown.pl.
For pdf output please also install pandoc-pdf.
%if %{with static}
%package common
Summary: Common files for %{name}
%description common
This provides the common files for %{name}.
%package static
Summary: Static Haskell build
Requires: %{name}-common = %{version}-%{release}
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
%description static
This provides a build with Haskell libraries statically linked.
%endif
%package -n ghc-%{name}
Summary: Haskell %{name} library
%if %{with static}
Requires: %{name}-common = %{version}-%{release}
%endif
%description -n ghc-%{name}
This package provides the Haskell %{name} shared library.
@ -117,17 +146,70 @@ cabal-tweak-flag http-conduit False
%ifarch armv7hl
cabal_configure_extra_options=--ghc-option="-O1"
%endif
%if %{with static}
%define ghc_without_dynamic 1
%ghc_bin_build
mv dist/build/%{name}/%{name}{,.static}
%undefine ghc_without_dynamic
%endif
%ghc_lib_build
%install
%ghc_lib_install
%ghc_fix_dynamic_rpath pandoc
%if %{with static}
mv %{buildroot}%{_bindir}/%{name}{,.dynamic}
install dist/build/%{name}/%{name}.static %{buildroot}%{_bindir}
touch %{buildroot}%{_bindir}/%{name}
rm %{buildroot}%{_pkgdocdir}/COPYING
%endif
rm %{buildroot}%{_datadir}/%{name}-%{version}/{BUGS,COPYRIGHT,INSTALL,README,changelog}
ln -s pandoc %{buildroot}%{_bindir}/hsmarkdown
%ghc_fix_dynamic_rpath pandoc
%if %{with static}
# avoid rpm ghost keeping pre-alternatives binary around
%pre
if [ $1 -gt 1 ] ; then
if [ -f %{_bindir}/%{name} -a ! -L %{_bindir}/%{name} ]; then
rm %{_bindir}/%{name}
fi
fi
%post
%{_sbindir}/update-alternatives --install %{_bindir}/%{name} \
%{name} %{_bindir}/%{name}.dynamic 70
%postun
if [ $1 -eq 0 ] ; then
%{_sbindir}/update-alternatives --remove %{name} %{_bindir}/%{name}.dynamic
fi
# avoid rpm ghost keeping pre-alternatives binary around
%pre static
if [ $1 -gt 1 ] ; then
if [ -f %{_bindir}/%{name} -a ! -L %{_bindir}/%{name} ]; then
rm %{_bindir}/%{name}
fi
fi
%post static
%{_sbindir}/update-alternatives --install %{_bindir}/%{name} \
%{name} %{_bindir}/%{name}.static 30
%postun static
if [ $1 -eq 0 ] ; then
%{_sbindir}/update-alternatives --remove %{name} %{_bindir}/%{name}.static
fi
%endif
%post -n ghc-%{name}-devel
@ -139,15 +221,31 @@ ln -s pandoc %{buildroot}%{_bindir}/hsmarkdown
%files
%if %{with static}
%ghost %{_bindir}/%{name}
%{_bindir}/%{name}.dynamic
%else
%doc BUGS COPYING COPYRIGHT README* changelog
%attr(755,root,root) %{_bindir}/%{name}
%endif
%files pdf
%if %{with static}
%files common
%doc BUGS COPYING COPYRIGHT README* changelog
%attr(-,root,root) %{_bindir}/hsmarkdown
%{_datadir}/%{name}-%{version}
%attr(644,root,root) %{_mandir}/man1/pandoc.1*
%attr(644,root,root) %{_mandir}/man5/*
%files pdf
%files static
%ghost %{_bindir}/%{name}
%{_bindir}/%{name}.static
%endif
%files -n ghc-%{name} -f ghc-%{name}.files
@ -158,6 +256,9 @@ ln -s pandoc %{buildroot}%{_bindir}/hsmarkdown
%changelog
* Thu Dec 11 2014 Jens Petersen <petersen@redhat.com> - 1.12.3.3-6
- add a static alternative subpackage and a common subpackage
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.12.3.3-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

Loading…
Cancel
Save