allow parallel minor collections too
[ghc.git] / ghc.spec.in
1 # RPM spec file for GHC -*-rpm-spec-*-
2 #
3 # Copyright [1998..2007] The GHC Team
4 #
5 # Thanks to Zoltan Vorosbaranyi <vbzoli@vbzo.li> for suggestions in
6 # earlier versions and Pixel <pixel@mandrakesoft.com> for coding tips.
7 #
8 # This file is subject to the same free software license as GHC.
9
10 %define name ghc
11 %define version @ProjectVersion@
12 %define release @release@
13
14 Name: %{name}
15 Version: %{version}
16 Release: %{release}
17 License: BSD-like
18 Group: Development/Languages/Haskell
19 URL: http://haskell.org/ghc/
20 Source0: http://haskell.org/ghc/dist/%{version}/ghc-%{version}-src.tar.bz2
21 Source1: http://haskell.org/ghc/dist/%{version}/ghc-%{version}-src-extralibs.tar.bz2
22 Packager: Sven Panne <sven.panne@aedion.de>
23 BuildRoot: %{_tmppath}/%{name}-%{version}-build
24 PreReq: update-alternatives
25 Requires: gmp, readline
26 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
27 Provides: haskell
28 Summary: The Glasgow Haskell Compiler
29
30 %description
31 Haskell is the standard lazy purely functional programming language.
32 The current language version is Haskell 98, agreed in December 1998,
33 with a revised version published in January 2003.
34
35 GHC is a state-of-the-art programming suite for Haskell. Included is
36 an optimising compiler generating good code for a variety of
37 platforms, together with an interactive system for convenient, quick
38 development. The distribution includes space and time profiling
39 facilities, a large collection of libraries, and support for various
40 language extensions, including concurrency, exceptions, and foreign
41 language interfaces (C, C++, whatever).
42
43 A wide variety of Haskell related resources (tutorials, libraries,
44 specifications, documentation, compilers, interpreters, references,
45 contact information, links to research groups) are available from the
46 Haskell home page at http://haskell.org/.
47
48 Authors:
49 --------
50 Krasimir Angelov <ka2_mail@yahoo.com>
51 Manuel Chakravarty <chak@cse.unsw.edu.au>
52 Koen Claessen <koen@cs.chalmers.se>
53 Robert Ennals <Robert.Ennals@cl.cam.ac.uk>
54 Sigbjorn Finne <sof@galconn.com>
55 Gabrielle Keller <keller@cvs.haskell.org>
56 Marcin Kowalczyk <qrczak@knm.org.pl>
57 Jeff Lewis <jeff@galconn.com>
58 Ian Lynagh <igloo@earth.li>
59 Simon Marlow <simonmar@microsoft.com>
60 Sven Panne <sven.panne@aedion.de>
61 Ross Paterson <ross@soi.city.ac.uk>
62 Simon Peyton Jones <simonpj@microsoft.com>
63 Don Stewart <dons@cse.unsw.edu.au>
64 Volker Stolz <stolz@i2.informatik.rwth-aachen.de>
65 Wolfgang Thaller <wolfgang.thaller@gmx.net>
66 Andrew Tolmach <apt@cs.pdx.edu>
67 Keith Wansbrough <Keith.Wansbrough@cl.cam.ac.uk>
68 Michael Weber <michael.weber@post.rwth-aachen.de>
69 plus a dozen helping hands...
70
71 %package prof
72 Requires: ghc = %{version}-%{release}
73 Summary: Profiling libraries for GHC
74 Group: Development/Libraries
75
76 %description prof
77 Profiling libraries for Glorious Glasgow Haskell Compilation System
78 (GHC). They should be installed when GHC's profiling subsystem is
79 needed.
80
81 %prep
82 %setup -b1
83
84 %build
85 test -f configure || sh boot
86 ./configure --prefix=%{_prefix} --mandir=%{_mandir}
87
88 # Don't install these tools, we'll use update-alternatives below.
89 touch mk/build.mk
90 echo "NO_INSTALL_RUNHASKELL=YES" >>mk/build.mk
91 echo "NO_INSTALL_HSC2HS=YES" >>mk/build.mk
92
93 make %{?jobs:-j%jobs}
94 make html
95 # Alas, we don't pass make options/arguments down to "libraries", so let's redo make here...
96 make -C libraries HADDOCK_DOCS=YES
97 ( cd libraries/Cabal && docbook2html doc/Cabal.xml --output doc/Cabal )
98 make -C docs/ext-core ps
99 make -C docs/storage-mgt ps
100
101 %install
102 # This is a cruel hack: There seems to be no way to install the Haddock
103 # documentation into the build directory, because DESTDIR is alway prepended.
104 # Furthermore, rpm removes the target documentation directory before the doc
105 # macros are processed. Therefore we have to copy things back into safety... :-P
106 # The right thing would be being able to install directly into the build tree.
107 make DESTDIR=${RPM_BUILD_ROOT} docdir=%{_datadir}/doc/packages/%{name} HADDOCK_DOCS=YES install install-docs
108 mkdir html-docs
109 cp -a ${RPM_BUILD_ROOT}%{_datadir}/doc/packages/%{name}/{index.html,libraries} html-docs
110 # Use version-less hsc2hs out of the way, we use update-alternatives.
111 mv ${RPM_BUILD_ROOT}%{_prefix}/bin/hsc2hs ${RPM_BUILD_ROOT}%{_prefix}/bin/hsc2hs-ghc
112
113 # generate the file list for lib/ _excluding_ all files needed for profiling
114 # only
115 #
116 # * generating file lists in a BUILD_ROOT spec is a bit tricky: the file list
117 # has to contain complete paths, _but_ without the BUILD_ROOT, we also do
118 # _not_ want have directory names in the list; furthermore, we have to make
119 # sure that any leading / is removed from %{_prefix}/lib, as find has to
120 # interpret the argument as a relative path; however, we have to include the
121 # leading / again in the final file list (otherwise, rpm complains)
122 # * isn't there an easier way to do all this?
123 #
124 dir=`pwd`
125 cd ${RPM_BUILD_ROOT}
126 libdir=`echo %{_prefix}/lib | sed 's|^/||'`
127 find $libdir ! -type d ! -name '*.p_hi' ! -name '*_p.a' -print | sed 's|^|/|' > $dir/rpm-noprof-lib-files
128 find $libdir ! -type d \( -name '*.p_hi' -or -name '*_p.a' \) -print | sed 's|^|/|' > $dir/rpm-prof-lib-files
129 cd $dir
130
131 %clean
132 rm -rf ${RPM_BUILD_ROOT}
133
134 %post
135 # Alas, GHC, Hugs and nhc all come with different set of tools in addition to
136 # a runFOO:
137 #
138 # * GHC: hsc2hs
139 # * Hugs: hsc2hs, cpphs
140 # * nhc: cpphs
141 #
142 # Therefore it is currently not possible to use --slave below to form link
143 # groups under a single name 'runhaskell'. Either these tools should be
144 # disentangled from the Haskell implementations or all implementations should
145 # have the same set of tools. *sigh*
146 update-alternatives --install %{_bindir}/runhaskell runhaskell %{_bindir}/runghc 500
147 update-alternatives --install %{_bindir}/hsc2hs hsc2hs %{_bindir}/hsc2hs-ghc 500
148
149 %preun
150 if test "$1" = 0; then
151 update-alternatives --remove runhaskell %{_bindir}/runghc
152 update-alternatives --remove hsc2hs %{_bindir}/hsc2hs-ghc
153 fi
154
155 %files -f rpm-noprof-lib-files
156 %defattr(-,root,root)
157 %doc docs/docbook-cheat-sheet/docbook-cheat-sheet
158 %doc ANNOUNCE
159 %doc LICENSE
160 %doc README
161 %doc docs/comm
162 %doc docs/ext-core/core.ps
163 %doc docs/storage-mgt/ldv.ps
164 %doc docs/storage-mgt/rp.ps
165 %doc docs/storage-mgt/sm.ps
166 %doc docs/users_guide/users_guide
167 %doc libraries/Cabal/doc/Cabal
168 %doc html-docs/*
169 %{_mandir}/man1/ghc.1*
170 %{_prefix}/bin/ghc
171 %{_prefix}/bin/ghc-%{version}
172 %{_prefix}/bin/ghc-pkg
173 %{_prefix}/bin/ghc-pkg-%{version}
174 %{_prefix}/bin/ghci
175 %{_prefix}/bin/ghci-%{version}
176 %{_prefix}/bin/ghcprof
177 %{_prefix}/bin/hasktags
178 %{_prefix}/bin/hp2ps
179 %{_prefix}/bin/hpc
180 %{_prefix}/bin/hsc2hs-ghc
181 %{_prefix}/bin/hsc2hs-%{version}
182 %{_prefix}/bin/runghc
183
184 %files prof -f rpm-prof-lib-files
185 %defattr(-,root,root)