2007-11-18 15:41:39 +00:00
#
2012-01-27 10:47:59 +00:00
# spec file for package ghc
#
2012-06-06 13:50:28 +00:00
# Copyright (c) 2011, 2012 Peter Trommler peter.trommler@ohm-hochschule.de
2012-01-27 10:47:59 +00:00
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# To bootstrap a new version of ghc, uncomment the following:
2012-06-06 17:23:36 +00:00
#%%global ghc_bootstrapping 1
#%%{?ghc_bootstrap}
2012-10-11 20:16:25 +00:00
%global without_hscolour 1
2012-05-24 11:49:13 +00:00
#%%global without_manual 1
2012-01-27 10:47:59 +00:00
%global debug_package %{nil}
Name : ghc
2012-06-06 13:50:28 +00:00
Version : 7.4.1
2012-01-27 10:47:59 +00:00
Release : 1
Group : Development/Languages/Other
2012-05-24 11:49:13 +00:00
License : BSD-3-Clause
2012-01-27 10:47:59 +00:00
Url : http://haskell.org/ghc/dist/%{version} /%{name} -%{version} -src.tar.bz2
Summary : The Glorious Glasgow Haskell Compiler
2012-10-11 20:16:25 +00:00
2012-02-19 20:48:10 +00:00
%if %{defined ghc_bootstrapping}
2012-06-06 13:50:28 +00:00
BuildRequires : ghc-compiler >= 6.12
2012-02-19 20:48:10 +00:00
%else
2012-05-26 06:47:36 +00:00
BuildRequires : ghc-compiler = %version
2012-02-19 20:48:10 +00:00
%endif
2012-06-26 16:06:48 +00:00
BuildRequires : ghc-bytestring-devel
2012-05-24 11:49:13 +00:00
BuildRequires : ghc-containers-devel
2012-06-26 16:06:48 +00:00
BuildRequires : ghc-directory-devel
2012-05-24 11:49:13 +00:00
BuildREquires : ghc-haskell98-devel
2012-06-26 16:06:48 +00:00
BuildRequires : ghc-pretty-devel
BuildRequires : ghc-process-devel
2012-10-11 20:16:25 +00:00
# These are needed so OBS will keep those packages
# Alternatively a Keep: line could be added to prjconf
%if 0%{?opensuse_bs}
BuildRequires : ghc-filepath-devel
BuildRequires : ghc-unix-devel
BuildRequires : ghc-array-devel
BuildRequires : ghc-old-locale-devel
BuildRequires : ghc-old-time-devel
BuildRequires : ghc-time-devel
BuildRequires : ghc-binary-devel
BuildRequires : ghc-deepseq-devel
%if %{undefined without_hscolour}
BuildRequires : ghc-containers
BuildRequires : ghc-base
BuildRequires : ghc-haskell98
BuildRequires : ghc-array
BuildRequires : ghc-time
BuildRequires : ghc-process
BuildRequires : ghc-directory
BuildRequires : ghc-unix
BuildRequires : ghc-old-time
BuildRequires : ghc-old-locale
BuildRequires : ghc-filepath
BuildRequires : ghc-deepseq
%endif
%endif
2012-06-26 16:06:48 +00:00
BuildRequires : ghc-rpm-macros >= 0.91
BuildRequires : gmp-devel
BuildRequires : libffi-devel
BuildRequires : ncurses-devel
2012-05-24 11:49:13 +00:00
BuildRequires : gcc
BuildRequires : pkg-config
BuildRequires : autoconf
2012-06-03 15:38:23 +00:00
BuildRequires : automake
2012-01-27 10:47:59 +00:00
BuildRequires : glibc-devel
%if %{undefined without_manual}
2012-05-24 11:49:13 +00:00
BuildRequires : libxslt
BuildRequires : docbook-xsl-stylesheets
BuildRequires : docbook-utils
2009-10-28 20:32:21 +00:00
%endif
2012-01-27 10:47:59 +00:00
%if %{undefined without_haddock} && %{undefined without_hscolour}
2012-05-24 11:49:13 +00:00
BuildRequires : hscolour
2012-01-11 22:02:10 +00:00
%endif
2012-01-27 10:47:59 +00:00
PreReq : update-alternatives
2012-06-03 15:38:23 +00:00
Requires : ghc-compiler = %{version} -%{release}
Requires : ghc-libraries = %{version} -%{release}
Requires : ghc-ghc-devel = %{version} -%{release}
2012-06-06 13:50:28 +00:00
Source : http://haskell.org/ghc/dist/%{version} /%{name} -%{version} -src.tar.bz2
2012-10-13 13:11:56 +00:00
# PATCH-FIX-UPSTREAM ghc-use-system-libffi.patch peter.trommler@ohm-hochschule.de - See Haskell trac #4496 and #5743
2012-06-06 13:50:28 +00:00
Patch : ghc-use-system-libffi.patch
2012-10-13 13:11:56 +00:00
# PATCH-FIX-UPSTREAM ghc-suse-as-needed.patch peter.trommler@ohm-hochschule.de -- temporary fix for Haskell trac #7062, ghc libraries do not work with as_needed and new-dtags both enabled
2012-06-06 13:50:28 +00:00
Patch1 : ghc-suse-as-needed.patch
# fedora patch 9: fix dynamic linking of executables using Template Haskell
Patch2 : Cabal-fix-dynamic-exec-for-TH.patch
Patch3 : ghc-6.12.1-gen_contents_index-haddock-path.patch
Patch4 : ghc-gen_contents_index-type-level.patch
2012-09-06 12:02:44 +00:00
# PATCH-FIX-UPSTREAM ghc-fix-undefined-openpty.patch peter.trommler@ohm-hochschule.de -- backport of upstream fix for #7062
Patch5 : ghc-fix-undefined-openpty.patch
# PATCH-FIX-UPSTREAM 0001-Add-missing-flag-for-respecting-EXTRA_LIBDIR.patch peter.trommler@ohm-hochschule.de -- backport of upstream fix for #7062
Patch6 : 0001-Add-missing-flag-for-respecting-EXTRA_LIBDIR.patch
2012-01-27 10:47:59 +00:00
BuildRoot : %{_tmppath} /%{name} -%{version} -build
2007-11-14 20:15:15 +00:00
%description
2012-02-20 13:22:09 +00:00
Haskell is the standard purely functional programming language; the
current language version is Haskell 98, agreed in December 1998.
2012-02-19 20:48:10 +00:00
2012-02-20 13:22:09 +00:00
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/>.
2012-01-27 10:47:59 +00:00
2012-06-03 15:38:23 +00:00
%package compiler
Summary : GHC compiler and utilities
License : BSD-3-Clause
Group : Development/Languages/Other
Requires : gcc
Requires : ghc-base-devel
Requires(post) : update-alternatives
Requires(postun) : update-alternatives
%description compiler
This package contains the GHC compiler, tools and utilities.
The GHC libraries are provided by ghc-devel.
To install all of GHC install package ghc.
2012-01-27 10:47:59 +00:00
%global ghc_version_override %{version}
2012-02-19 20:48:10 +00:00
2012-01-27 10:47:59 +00:00
%global _use_internal_dependency_generator 0
%global __find_provides %{_rpmconfigdir} /ghc-deps.sh --provides %{buildroot} %{ghclibdir}
%global __find_requires %{_rpmconfigdir} /ghc-deps.sh --requires %{buildroot} %{ghclibdir}
2012-10-13 13:11:56 +00:00
%global ghc_pkg_c_deps ghc-compiler = %{ghc_version_override} -%{release}
2012-01-27 10:47:59 +00:00
%if %{defined ghclibdir}
2012-06-26 16:06:48 +00:00
%ghc_lib_subpackage Cabal 1.14.0
%ghc_lib_subpackage array 0.4.0.0
%ghc_lib_subpackage -c gmp-devel,libffi-devel base 4.5.0.0
%ghc_lib_subpackage binary 0.5.1.0
%ghc_lib_subpackage bytestring 0.9.2.1
%ghc_lib_subpackage containers 0.4.2.1
%ghc_lib_subpackage deepseq 1.3.0.0
%ghc_lib_subpackage directory 1.1.0.2
%ghc_lib_subpackage extensible-exceptions 0.1.1.4
%ghc_lib_subpackage filepath 1.3.0.0
2012-01-27 10:47:59 +00:00
%define ghc_pkg_obsoletes ghc-bin-package-db-devel < 0.0.0.0-%{release}
2012-06-26 16:06:48 +00:00
%ghc_lib_subpackage -x ghc %{ghc_version_override}
2012-01-27 10:47:59 +00:00
%undefine ghc_pkg_obsoletes
2012-06-26 16:06:48 +00:00
%ghc_lib_subpackage haskell2010 1.1.0.1
%ghc_lib_subpackage haskell98 2.0.0.1
%ghc_lib_subpackage hoopl 3.8.7.3
%ghc_lib_subpackage hpc 0.5.1.1
%ghc_lib_subpackage old-locale 1.0.0.4
%ghc_lib_subpackage old-time 1.1.0.0
%ghc_lib_subpackage pretty 1.1.1.0
%ghc_lib_subpackage process 1.1.0.1
%ghc_lib_subpackage template-haskell 2.7.0.0
%ghc_lib_subpackage time 1.4
%ghc_lib_subpackage unix 2.5.1.0
2012-01-11 22:02:10 +00:00
%endif
2012-01-27 10:47:59 +00:00
%global version %{ghc_version_override}
2007-11-14 20:15:15 +00:00
2012-06-03 15:38:23 +00:00
%package libraries
Summary : GHC development libraries meta package
License : BSD-3-Clause
Group : Development/Libraries/Other
Requires : ghc-compiler = %{version} -%{release}
Obsoletes : ghc-devel < %{version} -%{release}
Provides : ghc-devel = %{version} -%{release}
2012-06-26 16:06:48 +00:00
Obsoletes : ghc-prof < %{version} -%{release}
Provides : ghc-prof = %{version} -%{release}
2012-06-03 15:38:23 +00:00
%{?ghc_packages_list:Requires: %(echo %{ghc_packages_list} | sed -e " s / \ ( [ ^ ] * \ ) - \ ( [ ^ ] * \ ) / g h c - \1 - d e v e l = \2 - %{release} , / g " )}
%description libraries
This is a meta-package for all the development library packages in GHC
except the ghc library, which is installed by the toplevel ghc metapackage.
2007-11-14 20:15:15 +00:00
%prep
2012-01-11 22:02:10 +00:00
%setup -q
2012-01-27 10:47:59 +00:00
rm -r ghc-tarballs/{mingw,perl}
2012-06-06 13:50:28 +00:00
%patch -p1 -b .libffi
rm -r ghc-tarballs/libffi
mkdir -p rts/dist/build
ln -s $(pkg-config --variable=includedir libffi)/*.h rts/dist/build
%patch1 -p1 -b .suse
2012-06-03 15:38:23 +00:00
%patch2 -p1 -b .orig
2012-06-06 13:50:28 +00:00
%patch3 -p1
%patch4 -p1
2012-09-06 12:02:44 +00:00
%patch5 -p1
%patch6 -p1
2012-01-26 17:15:15 +00:00
2012-01-27 10:47:59 +00:00
%build
2012-06-06 13:50:28 +00:00
# required for patch1
autoreconf -fi
2012-06-26 16:06:48 +00:00
2012-01-27 10:47:59 +00:00
# http://hackage.haskell.org/trac/ghc/wiki/Platforms
# cf https://github.com/gentoo-haskell/gentoo-haskell/tree/master/dev-lang/ghc
cat > mk/build.mk << EOF
GhcLibWays = v %{!?ghc_without_shared:dyn} %{!?without_prof:p}
%if %{defined without_haddock}
HADDOCK_DOCS = NO
%endif
%if %{defined without_manual}
BUILD_DOCBOOK_HTML = NO
%endif
%if %{defined without_hscolour}
HSCOLOUR_SRCS = NO
2012-01-11 22:02:10 +00:00
%endif
2012-01-27 10:47:59 +00:00
EOF
2008-04-01 22:04:35 +00:00
2012-01-27 10:47:59 +00:00
export CFLAGS=" $ { C F L A G S : - % o p t f l a g s } "
2012-06-26 16:06:48 +00:00
./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} \
--docdir=%{ghcdocroot} \
2012-06-06 13:50:28 +00:00
--with-gcc=%{_bindir} /gcc
2012-01-11 22:02:10 +00:00
make %{?_smp_mflags}
2007-11-14 20:15:15 +00:00
%install
2012-02-19 20:48:10 +00:00
%makeinstall
2012-01-11 22:02:10 +00:00
2012-01-27 10:47:59 +00:00
for i in %{ghc_packages_list} ; do
name=$(echo $i | sed -e " s / \ ( . * \ ) - . * / \1 / " )
ver=$(echo $i | sed -e " s / . * - \ ( . * \ ) / \1 / " )
%ghc_gen_filelists $name $ver
echo " % d o c l i b r a r i e s / $ n a m e / L I C E N S E " >> ghc-$name%{?ghc_without_shared:-devel}.files
done
2012-01-11 22:02:10 +00:00
2012-01-27 10:47:59 +00:00
%ghc_gen_filelists bin-package-db 0.0.0.0
%ghc_gen_filelists ghc %{ghc_version_override}
%ghc_gen_filelists ghc-prim 0.2.0.0
2012-06-06 13:50:28 +00:00
%ghc_gen_filelists integer-gmp 0.4.0.0
2012-01-27 10:47:59 +00:00
%define merge_filelist()\
%if %{undefined ghc_without_shared}\
cat ghc-%1.files >> ghc-%2.files\
%endif \
cat ghc-%1-devel.files >> ghc-%2-devel.files\
cp -p libraries/%1/LICENSE libraries/LICENSE.%1\
echo " % d o c l i b r a r i e s / L I C E N S E . % 1 " >> ghc-%2.files
%merge_filelist integer-gmp base
%merge_filelist ghc-prim base
%merge_filelist bin-package-db ghc
%if %{undefined ghc_without_shared}
ls $RPM_BUILD_ROOT %{ghclibdir} /libHS*.so >> ghc-base.files
sed -i -e " s | ^ $RPM_BUILD_ROOT | | g " ghc-base.files
%endif
ls -d $RPM_BUILD_ROOT %{ghclibdir} /libHS*.a $RPM_BUILD_ROOT %{ghclibdir} /package.conf.d/builtin_*.conf $RPM_BUILD_ROOT %{ghclibdir} /include >> ghc-base-devel.files
sed -i -e " s | ^ $RPM_BUILD_ROOT | | g " ghc-base-devel.files
2012-01-11 22:02:10 +00:00
# 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
2012-01-27 10:47:59 +00:00
touch ${RPM_BUILD_ROOT} %{_bindir} /$i
2012-01-11 22:02:10 +00:00
done
2012-01-27 10:47:59 +00:00
%ghc_strip_dynlinked
2012-06-26 16:06:48 +00:00
%check
2012-10-13 13:11:56 +00:00
# Actually, I took this from Jens Petersen's Fedora package
2012-06-26 16:06:48 +00:00
# stolen from ghc6/debian/rules:
# Do some very simple tests that the compiler actually works
rm -rf testghc
mkdir testghc
echo 'main = putStrLn "Foo"' > testghc/foo.hs
inplace/bin/ghc-stage2 testghc/foo.hs -o testghc/foo
[ " $ ( t e s t g h c / f o o ) " = " F o o " ]
# doesn't seem to work inplace:
#[ "$(inplace/bin/runghc testghc/foo.hs)" = "Foo" ]
rm testghc/*
echo 'main = putStrLn "Foo"' > testghc/foo.hs
inplace/bin/ghc-stage2 testghc/foo.hs -o testghc/foo -O2
[ " $ ( t e s t g h c / f o o ) " = " F o o " ]
rm testghc/*
%if %{undefined ghc_without_shared}
echo 'main = putStrLn "Foo"' > testghc/foo.hs
inplace/bin/ghc-stage2 testghc/foo.hs -o testghc/foo -dynamic
[ " $ ( t e s t g h c / f o o ) " = " F o o " ]
rm testghc/*
%endif
2012-06-03 15:38:23 +00:00
%post compiler
2012-01-27 10:47:59 +00:00
# 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
2007-11-14 20:15:15 +00:00
2012-06-03 15:38:23 +00:00
%preun compiler
2007-11-14 20:15:15 +00:00
if test " $ 1 " = 0; then
update-alternatives --remove runhaskell %{_bindir} /runghc
2012-01-27 10:47:59 +00:00
update-alternatives --remove hsc2hs %{_bindir} /hsc2hs-ghc
2007-11-14 20:15:15 +00:00
fi
2012-01-27 10:47:59 +00:00
%files
2012-01-11 22:02:10 +00:00
%defattr (-,root,root,-)
2012-06-03 15:38:23 +00:00
%doc LICENSE
%files compiler
%defattr (-,root,root,-)
2012-01-23 08:37:41 +00:00
%doc ANNOUNCE HACKING LICENSE README
2012-01-27 10:47:59 +00:00
%{_bindir} /ghc
%{_bindir} /ghc-%{version}
%{_bindir} /ghc-pkg
%{_bindir} /ghc-pkg-%{version}
%{_bindir} /ghci
%{_bindir} /ghci-%{version}
%{_bindir} /hp2ps
%{_bindir} /hpc
%ghost %attr (755,root,root) %{_bindir} /hsc2hs
%{_bindir} /hsc2hs-ghc
%{_bindir} /runghc
%ghost %attr (755,root,root) %{_bindir} /runhaskell
%{_bindir} /runhaskell-ghc
%dir %{ghclibdir}
2012-06-06 13:50:28 +00:00
%{ghclibdir} /settings
2012-01-27 10:47:59 +00:00
%{ghclibdir} /ghc
%{ghclibdir} /ghc-pkg
%ifnarch %{unregisterised_archs}
%{ghclibdir} /ghc-split
2012-01-26 17:15:15 +00:00
%endif
2012-01-27 10:47:59 +00:00
%{ghclibdir} /ghc-usage.txt
%{ghclibdir} /ghci-usage.txt
%{ghclibdir} /hsc2hs
%dir %{ghclibdir} /package.conf.d
%ghost %{ghclibdir} /package.conf.d/package.cache
%{ghclibdir} /runghc
%{ghclibdir} /template-hsc.h
%{ghclibdir} /unlit
2012-02-19 20:48:10 +00:00
%dir %{ghcdocroot}
2012-01-27 10:47:59 +00:00
%dir %{ghcdocbasedir}
%dir %{ghcdocbasedir} /libraries
2012-06-06 13:50:28 +00:00
%{_mandir} /man1/ghc.*
2012-01-27 10:47:59 +00:00
%if %{undefined without_haddock}
%{_bindir} /haddock
%{_bindir} /haddock-ghc-%{version}
%{ghclibdir} /html
%{ghclibdir} /latex
%{ghclibdir} /haddock
%if %{undefined without_manual}
%{ghcdocbasedir} /haddock
%{ghcdocbasedir} /users_guide
2012-01-11 22:02:10 +00:00
%endif
2012-01-27 10:47:59 +00:00
%{ghcdocbasedir} /libraries/frames.html
%{ghcdocbasedir} /libraries/gen_contents_index
%{ghcdocbasedir} /libraries/hscolour.css
%{ghcdocbasedir} /libraries/ocean.css
%{ghcdocbasedir} /libraries/prologue.txt
%{ghcdocbasedir} /index.html
%ghost %{ghcdocbasedir} /libraries/doc-index*.html
%ghost %{ghcdocbasedir} /libraries/haddock-util.js
%ghost %{ghcdocbasedir} /libraries/index*.html
%ghost %{ghcdocbasedir} /libraries/minus.gif
%ghost %{ghcdocbasedir} /libraries/plus.gif
2012-01-11 22:02:10 +00:00
%endif
2007-11-14 20:15:15 +00:00
2012-06-03 15:38:23 +00:00
%files libraries
%defattr (-,root,root,-)
%doc LICENSE
2007-11-14 20:15:15 +00:00
%changelog