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