Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > 64f1baa282f8f4ebd059cea1102e21f4 > files > 4

ghc-7.4.2-2.mga3.src.rpm

# In order to get ghc from scratch on a system we need two phases
# first with bootstrap = 1, it installs the new ghc binaries
# then with bootstrap = 0, we can compile from the sources
%define bootstrap 0

# ghc does not output dwarf format so debuginfo is not useful
%global debug_package %{nil}


%define name    ghc
%define version 7.4.2
%define release %mkrel 2

Summary: Glasgow Haskell Compilation system
Name:    %{name}
Version: %{version}
Release: %{release}
Source0: http://www.haskell.org/ghc/dist/%{version}/ghc-%{version}-src.tar.bz2
#Source1: http://www.haskell.org/ghc/dist/%{name}-%{version}-i386-unknown-linux.tar.bz2
#Source2: http://www.haskell.org/ghc/dist/%{name}-%{version}-x86_64-unknown-linux.tar.bz2
# (fedora) use system libffi
Patch1: ghc-use-system-libffi.patch
# (fedora) add libffi include dir to ghc wrapper for archs using gcc/llc
Patch2: ghc-wrapper-libffi-include.patch
License: BSD style
Group:   Development/Other
Url:     http://haskell.org/ghc/
%if %{bootstrap}
Requires(pre):   gmp-devel
Requires(preun): gmp-devel
%define _requires_exceptions libgmp.so.*$
%else
BuildRequires: ghc
BuildRequires: xslt
BuildRequires: xsltproc
BuildRequires: ncurses-devel
BuildRequires: readline-devel
BuildRequires: gmp-devel
BuildRequires: libffi-devel
# ghci does not start if gmp-devel is not installed
Requires: gmp-devel
%endif
# The bootstrap allow only this arch
ExclusiveArch: %ix86 x86_64
# haddock is now contained in this package (Anssi 03/2012):
Obsoletes: haddock < 2.8

%description
GHC is a state-of-the-art programming suite for Haskell, a purely
functional programming language.  It includes an optimizing 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).

%package doc
Summary: Documentation for the Glasgow Haskell Compiler
Group:   Documentation
Requires: %{name} = %{version}

%description doc
Documentation for the Glasgow Haskell Compiler

%package -n ghc-prof
Summary:    Profiling libraries for GHC
Group:      Development/Other
Requires:   %{name} = %{version}

%description -n ghc-prof
Profiling libraries for Glorious Glasgow Haskell Compilation System
(GHC).  They should be installed when GHC's profiling subsystem is
needed.

%prep
%setup -q
%apply_patches

%if %{bootstrap}
%ifarch %ix86
%setup -q -T -D -a 1
%endif
%ifarch x86_64
%setup -q -T -D -a 2
%endif
cd ../
rm -rf ghc-%{version}-src
mv ghc-%{version} ghc-%{version}-src
mv ghc-%{version}-src/ghc-%{version} ghc-%{version}
cd ghc-%{version}
cp /bin/pwd utils/ghc-pwd/dist/build/tmp/ghc-pwd
%else # no bootstrap
%endif

%build
%if %{bootstrap}
rm -rf %{buildroot}
mkdir -p %{buildroot}%{_libdir}
ln -s %{_libdir}/libgmp.so.10.0.3 %{buildroot}%{_libdir}/libgmp.so.3
export LD_LIBRARY_PATH=%{buildroot}%{_libdir}:$LD_LIBRARY_PATH
%configure build_cpu='%{_arch}' build_os='linux' \
           target_cpu='%{_arch}' target_os='linux' \
           host_cpu='%{_arch}' host_os='linux'
%else
./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} \
   --infodir=%{_infodir}

# documentation fails for some reason
cat > mk/build.mk << EOF
BUILD_DOCBOOK_PS = NO
BUILD_DOCBOOK_PDF = NO
EOF
make -j4
%endif

%install

%if %{bootstrap}
mkdir -p %{buildroot}%{_libdir}
ln -s %{_libdir}/libgmp.so.10.0.3 %{buildroot}%{_libdir}/libgmp.so.3
export LD_LIBRARY_PATH=%{buildroot}%{_libdir}:$LD_LIBRARY_PATH
%endif

%makeinstall_std


# Collecting all ghc files (from Fedora)
SRC_TOP=$PWD
rm -f rpm-*.files
( cd %{buildroot}
  find .%{_libdir} \( -type f \( -name '*.p_hi' -o -name '*_p.a' \) -fprint $SRC_TOP/rpm-prof.files \) -o \( -type f -not -name 'package.conf' -fprint $SRC_TOP/rpm-ghc.files \)
  sed -i '/%{_lib}$/d' $SRC_TOP/rpm-ghc.files
)

# make paths absolute (filter "./usr" to "/usr")
perl -pi -e "s|\.%{_prefix}|%{_prefix}|" rpm-*.files



# Hack to make ghc work (since the binary is linked to an old version of gmp)
%if %{bootstrap}
%pre
ln -s %{_libdir}/libgmp.so.10.0.3 %{_libdir}/libgmp.so.3
%endif

%if %{bootstrap}
%preun
rm -f %{_libdir}/libgmp.so.3
%endif

%files -f rpm-ghc.files
%{_bindir}/*
%dir %{_libdir}/ghc-%{version}
%doc LICENSE README
%{_mandir}/man1/*


%files prof -f rpm-prof.files

%files doc
%doc %_docdir/ghc/*


%changelog

* Sat Jan 12 2013 umeabot <umeabot> 7.4.2-2.mga3
+ Revision: 351526
- Mass Rebuild - https://wiki.mageia.org/en/Feature:Mageia3MassRebuild

* Wed Jan 09 2013 malo <malo> 7.4.2-1.mga3
+ Revision: 343660
- revert to stable version 7.4.2

* Wed Dec 26 2012 pterjan <pterjan> 7.6.1-2.mga3
+ Revision: 335288
- Add Fedora patches to use system libffi, this has the side effect of no longer providing libffi.so which was breaking many other packages

* Mon Oct 01 2012 malo <malo> 7.6.1-1.mga3
+ Revision: 301200
- update to 7.6.1
- update RPM group

* Sun Apr 22 2012 malo <malo> 7.0.4-4.mga2
+ Revision: 232696
- add requires on gmp-devel (fix crash of ghci, bug #5427)

* Fri Mar 16 2012 anssi <anssi> 7.0.4-3.mga2
+ Revision: 223576
- obsolete haddock which is now contained in ghc package (fixes upgrade
  file conflict issues)

* Sat Feb 11 2012 nanardon <nanardon> 7.0.4-2.mga2
+ Revision: 207147
- don't list file twice
- set exclusivearch as porting it to another arch will need specific work
- use existing macro instead if/else
- replace i586 by all i386 based arch

* Sat Feb 11 2012 malo <malo> 7.0.4-1.mga2
+ Revision: 207094
- fix doc file list
- adding xsltproc as BR
- ncursesw is not supported
- adding make -j4 to accelerate
- using ncursesw instead of ncurses
- missing BuildRequires
- Completing bootstraping. Thanks to kamil, Mandriva and Fedora specs.

* Fri Feb 10 2012 malo <malo> 7.0.4-0.1.mga2
+ Revision: 206859
- fixing doc package file list
- imported package ghc