ghc/ghc.spec

333 lines
11 KiB
RPMSpec

# Copyright (c) 2007-2009 Herbert Graeber
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments to herbert@links2linux.de
# norootforbuild
%bcond_without prof
%bcond_without shared
%bcond_without doc
Name: ghc
Version: 6.12.3
Release: 0
Summary: The Glasgow Haskell Compilation system
Summary(de): Das Glasgow-Haskell-Compilation-System
License: BSD3
Group: Development/Languages/Other
Source0: http://haskell.org/ghc/dist/%{version}/%{name}-%{version}-src.tar.bz2
Patch1: ghc-6.12.1-gen_contents_index-haddock-path.patch
URL: http://haskell.org/ghc/
Provides: haddock = 2.5.0, haddock-doc = 2.5.0
Obsoletes: haddock < 2.5.0, haddock-doc < 2.5.0
Requires(pre): update-alternatives
Requires(posttrans): glibc-locale
ExclusiveArch: %{ix86} x86_64
%if %{with shared}
Requires: %{name}-libs = %{version}-%{release}
%endif
Requires: gmp-devel
Requires: update-alternatives
Requires: glibc-locale
BuildRequires: ghc >= 5.0
%if %{suse_version} <= 1110
BuildRequires: happy >= 1.15
BuildRequires: alex >= 2.0
%else
BuildRecommends: happy >= 1.15
BuildRecommends: alex >= 2.0
%endif
BuildRequires: ncurses-devel
BuildRequires: gmp-devel
BuildRequires: libxslt
BuildRequires: sgml-skel
BuildRequires: docbook-xsl-stylesheets
BuildRequires: docbook-utils
BuildRequires: update-alternatives
BuildRequires: fdupes
BuildRequires: ghc-rpm-macros
Provides: haskell_compiler
Provides: ghc-array-devel = 0.3.0.1
Provides: ghc-base-devel = 3.0.3.2
Provides: ghc-base-devel = 4.2.0.2
Provides: ghc-bin-package-db-devel
Provides: ghc-bytestring-devel = 0.9.1.7
Provides: ghc-Cabal-devel = 1.8.0.6
Provides: ghc-containers-devel = 0.3.0.0
Provides: ghc-directory-devel = 1.0.1.1
Provides: ghc-dph-base-devel = 0.4.0
Provides: ghc-dph-bench-devel = 0.1
Provides: ghc-dph-common-devel = 0.4.0
Provides: ghc-dph-prim-interface-devel = 0.4.0
Provides: ghc-dph-prim-par-devel = 0.4.0
Provides: ghc-dph-prim-seq-devel = 0.4.0
Provides: ghc-extensible-exceptions-devel = 0.1.1.1
Provides: ghc-filepath-devel = 1.1.0.4
Provides: ghc-prim-devel = 0.2.0.0
Provides: ghc-haskell98-devel = 1.0.1.1
Provides: ghc-hpc-devel = 0.5.0.5
Provides: ghc-integer-gmp-devel = 0.2.0.1
Provides: ghc-integer-simple-devel = 0.1.0.0
Provides: ghc-old-locale-devel = 1.0.0.2
Provides: ghc-old-time-devel = 1.0.0.5
Provides: ghc-pretty-devel = 1.0.1.1
Provides: ghc-process-devel = 1.0.1.3
Provides: ghc-random-devel = 1.0.0.2
Provides: ghc-syb-devel = 0.1.0.2
Provides: ghc-template-haskell-devel = 2.4.0.1
Provides: ghc-time-devel = 1.1.4
Provides: ghc-unix-devel = 2.4.0.2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Prefix: /usr
%description
Haskell is the standard purely functional programming language; the
current language version is Haskell 98, agreed in December 1998.
GHC is a state-of-the-art programming suite for Haskell. Included is
an optimising compiler generating good code for a variety of
platforms, together with an interactive system for convenient, quick
development. The distribution includes space and time profiling
facilities, a large collection of libraries, and support for various
language extensions, including concurrency, exceptions, and foreign
language interfaces (C, C++, etc).
A wide variety of Haskell related resources (tutorials, libraries,
specifications, documentation, compilers, interprbeters, references,
contact information, links to research groups) are available from the
Haskell home page at <http://www.haskell.org/>.
%if %{with prof}
%package prof
Summary: Profiling libraries for GHC
Group: Development/Libraries/Other
Requires: ghc = %{version}-%{release}
Provides: ghc-prof = %{version}
Provides: ghc-array-prof = 0.3.0.1
Provides: ghc-base-prof = 3.0.3.2
Provides: ghc-base-prof = 4.2.0.2
Provides: ghc-bin-package-db-prof
Provides: ghc-bytestring-prof = 0.9.1.7
Provides: ghc-Cabal-prof = 1.8.0.6
Provides: ghc-containers-prof = 0.3.0.0
Provides: ghc-directory-prof = 1.0.1.1
Provides: ghc-dph-base-prof = 0.4.0
Provides: ghc-dph-bench-prof = 0.1
Provides: ghc-dph-common-prof = 0.4.0
Provides: ghc-dph-prim-interface-prof = 0.4.0
Provides: ghc-dph-prim-par-prof = 0.4.0
Provides: ghc-dph-prim-seq-prof = 0.4.0
Provides: ghc-extensible-exceptions-prof = 0.1.1.1
Provides: ghc-filepath-prof = 1.1.0.4
Provides: ghc-prim-prof = 0.2.0.0
Provides: ghc-haskell98-prof = 1.0.1.1
Provides: ghc-hpc-prof = 0.5.0.4
Provides: ghc-integer-gmp-prof = 0.2.0.1
Provides: ghc-integer-simple-prof = 0.1.0.0
Provides: ghc-old-locale-prof = 1.0.0.2
Provides: ghc-old-time-prof = 1.0.0.5
Provides: ghc-pretty-prof = 1.0.1.1
Provides: ghc-process-prof = 1.0.1.3
Provides: ghc-random-prof = 1.0.0.2
Provides: ghc-syb-prof = 0.1.0.2
Provides: ghc-template-haskell-prof = 2.4.0.1
Provides: ghc-time-prof = 1.1.4
Provides: ghc-unix-prof = 2.4.0.2
%description prof
Profiling libraries for Glorious Glasgow Haskell Compilation System (GHC).
They should be installed when GHC's profiling subsystem is needed.
%endif
%if %{with shared}
%package libs
Summary: Shared libraries for GHC
Group: Development/Libraries
%description libs
Shared libraries for Glorious Glasgow Haskell Compilation System (GHC).
%endif
%package doc
Summary: Documentation for GHC
Group: Development/Languages/Other
%if 0%{suse_version} > 1110
BuildArch: noarch
%endif
Requires: ghc = %{version}-%{release}
Requires(posttrans): %{name} = %{version}-%{release}
Provides: ghc-array-doc = 0.3.0.1
Provides: ghc-base-doc = 3.0.3.2
Provides: ghc-base-doc = 4.2.0.2
Provides: ghc-bin-package-db-doc
Provides: ghc-bytestring-doc = 0.9.1.6
Provides: ghc-Cabal-doc = 1.8.0.4
Provides: ghc-containers-doc = 0.3.0.0
Provides: ghc-directory-doc = 1.0.1.1
Provides: ghc-dph-base-doc = 0.4.0
Provides: ghc-dph-bench-doc = 0.1
Provides: ghc-dph-common-doc = 0.4.0
Provides: ghc-dph-prim-interface-doc = 0.4.0
Provides: ghc-dph-prim-par-doc = 0.4.0
Provides: ghc-dph-prim-seq-doc = 0.4.0
Provides: ghc-extensible-exceptions-doc = 0.1.1.1
Provides: ghc-filepath-doc = 1.1.0.4
Provides: ghc-prim-doc = 0.2.0.0
Provides: ghc-haskell98-doc = 1.0.1.1
Provides: ghc-hpc-doc = 0.5.0.5
Provides: ghc-integer-gmp-doc = 0.2.0.1
Provides: ghc-integer-simple-doc = 0.1.0.0
Provides: ghc-old-locale-doc = 1.0.0.2
Provides: ghc-old-time-doc = 1.0.0.5
Provides: ghc-pretty-doc = 1.0.1.1
Provides: ghc-process-doc = 1.0.1.3
Provides: ghc-random-doc = 1.0.0.2
Provides: ghc-syb-doc = 0.1.0.2
Provides: ghc-template-haskell-doc = 2.4.0.1
Provides: ghc-time-doc = 1.1.4
Provides: ghc-unix-doc = 2.4.0.1
%description doc
Preformatted documentation for the Glorious Glasgow Haskell Compilation System
(GHC) and its libraries. It should be installed if you like to have local
access to the documentation in PostScript and HTML format. Alternatively,
the documentation is available online at
http://haskell.org/ghc/documentation.html
# the debuginfo subpackage is currently empty anyway, so don't generate it
%define debug_package %{nil}
%define __spec_install_post /usr/lib/rpm/brp-compress
%prep
%setup -q
%patch1 -p1
%build
export CFLAGS="${CFLAGS:-%optflags}"
echo "GhcLibWays = v %{?with_prof:p} %{?with_shared:dyn}" >> mk/build.mk
echo "SRC_CC_OPTS+=-pthread" >> mk/build.mk
echo "SRC_HC_OPTS+=-optl-pthread" >> mk/build.mk
%if %{without doc}
echo "HADDOCK_DOCS = NO" >> mk/build.mk
%endif
%if %{without manual}
echo "BUILD_DOCBOOK_HTML = NO" >> mk/build.mk
%endif
./configure --prefix=%{_prefix} --exec-prefix=%{_exec_prefix} --bindir=%{_bindir} \
--sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} --datadir=%{_datadir} \
--includedir=%{_includedir} --libdir=%{_libdir} --libexecdir=%{_libexecdir} \
--localstatedir=%{_localstatedir} --sharedstatedir=%{_sharedstatedir} \
--mandir=%{_mandir} %{?with_shared:--enable-shared}
make %{?_smp_mflags}
%install
%makeinstall
SRC_TOP=$PWD
pushd ${RPM_BUILD_ROOT}
find .%{_libdir}/%{name}-%{version} -maxdepth 1 -type d ! -name 'include' \
! -name 'package.conf.d' -fprintf $SRC_TOP/rpm-lib-dir.files "%%%%dir %%p\n"
find .%{_libdir}/%{name}-%{version} -type d -fprintf $SRC_TOP/rpm-dev-dir.files "%%%%dir %%p\n"
find .%{_libdir}/%{name}-%{version} \
\( -name 'libHS*-ghc%{version}.so' -fprintf $SRC_TOP/rpm-lib.files "%%%%attr(755,root,root) %%p\n" \) -o \
\( \( -name '*.p_hi' -o -name '*_p.a' \) -fprint $SRC_TOP/rpm-prof.files \) -o \
\( \( -name '*.hi' -o -name '*.dyn_hi' -o -name 'libHS*.a' -o -name 'HS*.o' -o \
-name '*.h' -o -name '*.conf' -o -type f -not -name 'package.cache' \) -fprint $SRC_TOP/rpm-base.files \)
%if %{with doc}
mv .%{_datadir}/doc/%{name}/html .%{_datadir}/doc/%{name}/html-tmp
mv .%{_datadir}/doc/%{name}/html-tmp/* .%{_datadir}/doc/%{name}
rmdir .%{_datadir}/doc/%{name}/html-tmp
find .%{_datadir}/doc/%{name}/* -type d ! -name libraries ! -name src > $SRC_TOP/rpm-doc.files
%endif
popd
sed -i -e "s|\.%{_prefix}|%{_prefix}|" rpm-*.files
cat rpm-lib-dir.files rpm-lib.files > rpm-libs.files
cat rpm-dev-dir.files rpm-base.files > rpm-ghc.files
# these are handled as alternatives
for i in hsc2hs runhaskell; do
if [ -x ${RPM_BUILD_ROOT}%{_bindir}/$i-ghc ]; then
rm ${RPM_BUILD_ROOT}%{_bindir}/$i
else
mv ${RPM_BUILD_ROOT}%{_bindir}/$i{,-ghc}
fi
done
%if %{with doc}
%fdupes ${RPM_BUILD_ROOT}/%{_datadir}/doc/%{name}
%endif
%post
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
%posttrans
%{_bindir}/ghc-pkg recache
%posttrans doc
%ghc_reindex_haddock
%post doc
%ghc_reindex_haddock
%postun doc
if [ "$1" -eq 0 ] ; then
%ghc_reindex_haddock
fi
%files -f rpm-ghc.files
%defattr(-,root,root,-)
%doc ANNOUNCE HACKING LICENSE README
%{_bindir}/*
%config %verify(not md5 mtime size) %{_libdir}/%{name}-%{version}/package.conf.d/package.cache
%{_mandir}/man1/ghc.*
%if %{with doc}
%files doc -f rpm-doc.files
%defattr(-,root,root,-)
%dir %{_datadir}/doc/%{name}
%dir %{_datadir}/doc/%{name}/libraries
%{_datadir}/doc/%{name}/index.html
%{_datadir}/doc/%{name}/libraries/frames.html
%{_datadir}/doc/%{name}/libraries/gen_contents_index
%{_datadir}/doc/%{name}/libraries/hscolour.css
%{_datadir}/doc/%{name}/libraries/prologue.txt
%ghost %{_datadir}/doc/%{name}/libraries/doc-index*.html
%ghost %{_datadir}/doc/%{name}/libraries/haddock.css
%ghost %{_datadir}/doc/%{name}/libraries/haddock-util.js
%ghost %{_datadir}/doc/%{name}/libraries/haskell_icon.gif
%ghost %{_datadir}/doc/%{name}/libraries/index*.html
%ghost %{_datadir}/doc/%{name}/libraries/minus.gif
%ghost %{_datadir}/doc/%{name}/libraries/plus.gif
%endif
%if %{with shared}
%files libs -f rpm-libs.files
%defattr(-,root,root,-)
%endif
%if %{with prof}
%files prof -f rpm-prof.files
%defattr(-,root,root,-)
%endif
%changelog