diff options
author | sven.panne@aedion.de <unknown> | 2007-03-15 15:28:23 +0000 |
---|---|---|
committer | sven.panne@aedion.de <unknown> | 2007-03-15 15:28:23 +0000 |
commit | 1ee08bbe86b03ba74a9be309a84602b34e41cbb4 (patch) | |
tree | 67135c3c69c653111efdabb3b3a6bc9bc753671b /ghc.spec.in | |
parent | d4b95ea994e850f2c85e418b5625874fd25b0ebf (diff) | |
download | haskell-1ee08bbe86b03ba74a9be309a84602b34e41cbb4.tar.gz |
Use update-alternatives for handling generic tool names
ATTENTION: Packagers should read the following stuff carefully!
GHC, Hugs and nhc come with various tools like runhaskell or hsc2hs. On the
one hand this is quite handy, avoiding lots of tiny native packages, but OTOH
this leads to a few problems:
* The tools are not always identical in functionality.
* The tools fight for a global generic name like "/usr/bin/runhaskell".
These problems are not new and not unique to Haskell implementations, so for
*nix-based system there is a tool called update-alternatives which handles
those cases. The idea is as follows:
* Each program/man page/etc. installs itself with a very specific name
like /usr/bin/hsc2hs-ghc or /usr/share/man/man1/lua5.1.1.gz, so nothing
clashes.
* The (un-)installation scripts call update-alternatives to notify the
system about new alternatives for a generic tool/manpage/etc.
* Alternatives can be grouped together ("link groups"), so e.g. switching
from Sun's Java to Kaffe switches compiler, JRE, manpages etc. together.
Alas, this doesn't work well with the Haskell implementations yet,
because they come with different sets of tools (in addition to runFOO):
GHC: hsc2hs
Hugs: hsc2hs, cpphs
nhc: cpphs
Either these tools should be disentangled fromt the Haskell
implementations or all implementations should offer the same set.
Opinions and recommendations on this topic are highly welcome.
* This mechanism can be used to easily switch between several versions of
the same implementation, too, but we are not yet fully prepared for that.
As a first step, GHC now installs hsc2hs as 'hsc2hs-ghc' and does *not*
install runhaskell directly anymore, only runghc. hsc2hs and runhaskell are
created via update-alternatives now. What is currently missing is a mechanism
for platforms like Windows and probably Mac OS X.
Diffstat (limited to 'ghc.spec.in')
-rw-r--r-- | ghc.spec.in | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/ghc.spec.in b/ghc.spec.in index c50e8052c4..ed7a00d019 100644 --- a/ghc.spec.in +++ b/ghc.spec.in @@ -1,6 +1,6 @@ # RPM spec file for GHC -*-rpm-spec-*- # -# Copyright [1998..2004] The GHC Team +# Copyright [1998..2007] The GHC Team # # Thanks to Zoltan Vorosbaranyi <vbzoli@vbzo.li> for suggestions in # earlier versions and Pixel <pixel@mandrakesoft.com> for coding tips. @@ -21,8 +21,9 @@ Source0: http://haskell.org/ghc/dist/%{version}/ghc-%{version}-src.tar.bz Source1: http://haskell.org/ghc/dist/%{version}/ghc-%{version}-src-extralibs.tar.bz2 Packager: Sven Panne <sven.panne@aedion.de> BuildRoot: %{_tmppath}/%{name}-%{version}-build +PreReq: update-alternatives Requires: gmp, readline -BuildRequires: alex >= 2.0, happy >= 1.15, ghc >= 5, haddock, docbook-dtd, docbook-xsl-stylesheets, libxslt, libxml2, fop, xmltex, dvips, gmp, readline-devel, mesaglut-devel +BuildRequires: update-alternatives, alex >= 2.0, happy >= 1.15, ghc >= 5, haddock, docbook-dtd, docbook-xsl-stylesheets, libxslt, libxml2, fop, xmltex, dvips, gmp, readline-devel, mesaglut-devel Provides: haskell Summary: The Glasgow Haskell Compiler @@ -113,6 +114,27 @@ cd $dir %clean rm -rf ${RPM_BUILD_ROOT} +%post +# Alas, GHC, Hugs and nhc all come with different set of tools in addition to +# a runFOO: +# +# * GHC: hsc2hs +# * Hugs: hsc2hs, cpphs +# * nhc: cpphs +# +# Therefore it is currently not possible to use --slave below to form link +# groups under a single name 'runhaskell'. Either these tools should be +# disentangled from the Haskell implementations or all implementations should +# have the same set of tools. *sigh* +update-alternatives --install %{_bindir}/runhaskell runhaskell %{_bindir}/runghc 500 +update-alternatives --install %{_bindir}/hsc2hs hsc2hs %{_bindir}/hsc2hs-ghc 500 + +%preun +if test "$1" = 0; then + update-alternatives --remove runhaskell %{_bindir}/runghc + update-alternatives --remove hsc2hs %{_bindir}/hsc2hs-ghc +fi + %files -f rpm-noprof-lib-files %defattr(-,root,root) %doc docs/docbook-cheat-sheet/docbook-cheat-sheet @@ -137,9 +159,8 @@ rm -rf ${RPM_BUILD_ROOT} %{_prefix}/bin/ghcprof %{_prefix}/bin/hasktags %{_prefix}/bin/hp2ps -%{_prefix}/bin/hsc2hs +%{_prefix}/bin/hsc2hs-ghc %{_prefix}/bin/runghc -%{_prefix}/bin/runhaskell %files prof -f rpm-prof-lib-files %defattr(-,root,root) |