@ -2,32 +2,20 @@
%define build_prof 1
%define build_doc 1
# Fixing packaging problems can be a tremendous pain because it
# generally requires a complete rebuild, which takes hours. To offset
# the misery, do a complete build once using "rpmbuild -bc", then copy
# your built tree to a directory of the same name suffixed with
# ".built", using "cp -al". Finally, set this variable, and it will
# copy the already-built tree into place during build instead of
# actually doing the build.
#
# Obviously, this can only work if you leave the build section
# completely untouched between builds.
%define package_debugging 0
Name: ghc
Version: 6.8.3
Release: 4 %{?dist}
Release: 5%{?dist}
Summary: Glasgow Haskell Compilation system
# See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=239713
ExcludeArch: alpha ppc64
License: BSD
Group: Development/Languages
Source0: http://www.haskell.org/ghc/dist/stable/dist /ghc-%{version}-src.tar.bz2
Source1: http://www.haskell.org/ghc/dist/stable/dist /ghc-%{version}-src-extralibs.tar.bz2
Source0: http://www.haskell.org/ghc/dist/%{version}/ghc-%{version}-src.tar.bz2
Source1: http://www.haskell.org/ghc/dist/%{version}/ghc-%{version}-src-extralibs.tar.bz2
Source2: ghc-rpm-macros.ghc
Patch0: ghc-6.8.3-libraries-config.patch
URL: http://haskell.org/ghc/
Requires: chkconfig, gcc, gmp-devel, readline-devel
Requires: gcc, gmp-devel, readline-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Obsoletes: ghc682, ghc681, ghc661, ghc66
BuildRequires: ghc, happy, sed
@ -75,85 +63,51 @@ you like to have local access to the documentation in HTML format.
# 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 -n %{name}-%{version} -b1
%patch0 -p1 -b .hdkl
%patch0 -p1 -b .0-haddock~
%build
%if %{package_debugging}
cd ..
rm -rf %{name}-%{version}
cp -al %{name}-%{version}.built %{name}-%{version}
cd %{name}-%{version}
exit 0
%endif
%if !%{build_prof}
echo "GhcLibWays=" >> mk/build.mk
echo "GhcRTSWays=thr debug" >> mk/build.mk
%endif
HaddockCmd=%{_bindir}/haddock-0.9 \
./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}
cat <<HADDOCK_PATH_HACK >> mk/build.mk
docdir := %{_docdir}/%{name}-%{version}
htmldir := \$(docdir)
dvidir := \$(docdir)
pdfdir := \$(docdir)
psdir := \$(docdir)
HADDOCK_PATH_HACK
# drop truncated copy of header (#222865)
rm libraries/network/include/Typeable.h
make %{_smp_mflags} all libexecdir=%{_libexecdir}
%if %{build_doc}
echo "XMLDocWays = html" >> mk/build.mk
echo "HADDOCK_DOCS = YES" >> mk/build.mk
%endif
export HaddockCmd=%{_bindir}/haddock-0.9
# workaround ghc configure script hysteria about archs
%define _target_platform %{_build}
%configure
make %{_smp_mflags}
make %{_smp_mflags} -C libraries
%if %{build_doc}
make %{_smp_mflags} html
make %{_smp_mflags} -C libraries HADDOCK_DOCS=YES
( cd libraries/Cabal && docbook2html doc/Cabal.xml --output doc/Cabal )
%endif
%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=${RPM_BUILD_ROOT} libdir=%{_libdir}/%{name}-%{version} \
libexecdir=%{_libexecdir}/%{name}-%{version} install
pushd ${RPM_BUILD_ROOT}/%{_libexecdir}/%{name}-%{version}
strip cgprof ghc-%{version} ghc-pkg.bin hsc2hs-bin unlit
popd
pushd ${RPM_BUILD_ROOT}/%{_libdir}/%{name}-%{version}
for i in ../../libexec/%{name}-%{version}/*; do
ln -s $i .
done
popd
make DESTDIR=${RPM_BUILD_ROOT} install
%if %{build_doc}
make DESTDIR=${RPM_BUILD_ROOT} XMLDocWays="html" HADDOCK_DOCS=YES install-docs
if [ -d ${RPM_BUILD_ROOT}/%{_docdir}/%{name}/libraries ]; then
mv ${RPM_BUILD_ROOT}/%{_docdir}/%{name}/libraries \
${RPM_BUILD_ROOT}/%{_docdir}/%{name}-%{version}
fi
cp libraries/*.html ${RPM_BUILD_ROOT}/%{_docdir}/%{name}-%{version}/libraries
make DESTDIR=${RPM_BUILD_ROOT} install-docs
%endif
# install rpm macros
mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm/macros.ghc
mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm
cp -p %{SOURCE2} ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm/macros.ghc
SRC_TOP=$PWD
rm -f rpm-*-filelist rpm-*.files
( cd $RPM_BUILD_ROOT
find .%{_libdir}/%{name}-%{version} .%{_libexecdir}/%{name}-%{version} \( -type d -fprintf $SRC_TOP/rpm-dir.files "%%%%dir %%p\n" \) -o \( -type f \( -name '*.p_hi' -o -name '*_p.a' \) -fprint $SRC_TOP/rpm-prof.files \) -o \( -not -name 'package.conf' -fprint $SRC_TOP/rpm-lib.files \)
find .%{_libdir}/%{name}-%{version} \( -type d -fprintf $SRC_TOP/rpm-dir.files "%%%%dir %%p\n" \) -o \( -type f \( -name '*.p_hi' -o -name '*_p.a' \) -fprint $SRC_TOP/rpm-prof.files \) -o \( -not -name 'package.conf' -fprint $SRC_TOP/rpm-lib.files \)
)
# make paths absolute (filter "./usr" to "/usr")
@ -167,7 +121,8 @@ cat rpm-dir.files rpm-prof.files > rpm-prof-filelist
# create package.conf.old
touch $RPM_BUILD_ROOT%{_libdir}/ghc-%{version}/package.conf.old
mv ${RPM_BUILD_ROOT}%{_bindir}/hsc2hs ${RPM_BUILD_ROOT}%{_bindir}/hsc2hs-ghc
# these are handled as alternatives
rm ${RPM_BUILD_ROOT}%{_bindir}/{hsc2hs,runhaskell}
%clean
rm -rf $RPM_BUILD_ROOT
@ -216,12 +171,25 @@ fi
%if %{build_doc}
%files doc
%defattr(-,root,root,-)
%{_docdir}/%{name}-%{version}
%{_docdir}/%{name}
%endif
%changelog
* Wed Sep 17 2008 Jens Petersen <petersen@redhat.com> - 6.8.3-4
* Wed Sep 24 2008 Jens Petersen <petersen@redhat.com> - 6.8.3-5.fc10
- bring back haddock-generated lib docs, now under docdir/ghc
- fix macros.ghc filepath (#460304)
- spec file cleanups:
- fix the source urls back
- drop requires chkconfig
- do not override __spec_install_post
- override _target_platform so we can use %%configure
- setup docs building in build.mk
- no longer need to remove network/include/Typeable.h
- install binaries under libdir not libexec
- remove hsc2hs and runhaskell binaries since are alternatives
* Wed Sep 17 2008 Jens Petersen <petersen@redhat.com> - 6.8.3-4.fc10
- add macros.ghc for new Haskell Packaging Guidelines (#460304)
* Wed Jun 18 2008 Bryan O'Sullivan <bos@serpentine.com> - 6.8.3-3