2010-07-31 04:44:43 +00:00
|
|
|
# "cabal"
|
2009-05-13 07:37:39 +00:00
|
|
|
%cabal %{_bindir}/runghc Setup
|
|
|
|
|
2010-07-31 04:44:43 +00:00
|
|
|
# configure
|
2009-05-13 07:37:39 +00:00
|
|
|
%cabal_configure \
|
|
|
|
%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} --htmldir=%{ghcdocdir} --libsubdir='$compiler/$pkgid'
|
|
|
|
|
2010-07-31 04:44:43 +00:00
|
|
|
# install
|
2009-05-13 07:37:39 +00:00
|
|
|
%cabal_install %cabal copy --destdir=${RPM_BUILD_ROOT} -v
|
|
|
|
|
2010-07-31 04:44:43 +00:00
|
|
|
# root dir for ghc docs
|
|
|
|
%ghcdocbasedir %{_docdir}/ghc
|
|
|
|
# ghcdocdir [pkgname]
|
|
|
|
%ghcdocdir %{ghcdocbasedir}/libraries/%{?pkg_name}%{!?pkg_name:%{name}}
|
|
|
|
# top library dir
|
|
|
|
%ghcpkgbasedir %{_libdir}/ghc-%{ghc_version}
|
|
|
|
# ghcpkgdir [pkgname]
|
|
|
|
%ghcpkgdir %{ghcpkgbasedir}/%{?pkg_name}%{!?pkg_name:%name}-%{version}
|
2009-05-13 07:37:39 +00:00
|
|
|
|
2010-07-31 04:44:43 +00:00
|
|
|
# ghc_gen_filelists [pkgname]
|
2009-05-13 07:37:39 +00:00
|
|
|
%ghc_gen_filelists() \
|
2010-07-31 06:21:10 +00:00
|
|
|
pkgname=%{?1}%{!?1:%{pkg_name}} \
|
|
|
|
basefile=ghc-${pkgname} \
|
|
|
|
pkgnamever=${pkgname}-%{version} \
|
|
|
|
rm -f ${basefile}-devel.files ${basefile}-prof.files ${basefile}-doc.files \
|
|
|
|
echo '%defattr(-,root,root,-)' > ${basefile}-devel.files \
|
|
|
|
find ${RPM_BUILD_ROOT}%{ghcpkgdir} -type d | sed 's/^/%dir /' >> ${basefile}-devel.files \
|
|
|
|
find ${RPM_BUILD_ROOT}%{ghcpkgdir} ! \\( -type d -o -name '*_p.a' -o -name '*.p_hi' \\) >> ${basefile}-devel.files \
|
|
|
|
echo '%defattr(-,root,root,-)' > ${basefile}-prof.files \
|
|
|
|
find ${RPM_BUILD_ROOT}%{ghcpkgdir} \\( -name '*_p.a' -o -name '*.p_hi' \\) >> ${basefile}-prof.files \
|
|
|
|
sed -i -e "s!${RPM_BUILD_ROOT}!!g" ${basefile}-devel.files ${basefile}-prof.files \
|
|
|
|
echo '%defattr(-,root,root,-)' > ${basefile}-doc.files \
|
|
|
|
echo '%{ghcdocdir}' >> ${basefile}-doc.files \
|
2009-05-13 07:37:39 +00:00
|
|
|
%{nil}
|
|
|
|
|
|
|
|
%ghc_gen_scripts %cabal register --gen-script ; %cabal unregister --gen-script
|
|
|
|
|
|
|
|
%ghc_install_scripts install -m 755 register.sh unregister.sh ${RPM_BUILD_ROOT}%{ghcpkgdir}
|
|
|
|
|
|
|
|
%ghc_register_pkg %{ghcpkgdir}/register.sh >/dev/null || :
|
|
|
|
|
|
|
|
%ghc_unregister_pkg %{ghcpkgdir}/unregister.sh >/dev/null || :
|
|
|
|
|
2010-07-31 04:44:43 +00:00
|
|
|
# compiler version
|
2009-12-25 15:37:49 +00:00
|
|
|
%ghc_version %{!?ghc_version_override:%(ghc --numeric-version)}%{?ghc_version_override}
|
2009-12-08 00:49:48 +00:00
|
|
|
|
|
|
|
%ghc_pkg_ver() %(ghc-pkg list --global --simple-output %1|sed -e "s/.*%1-//")
|
2009-12-25 15:37:49 +00:00
|
|
|
|
2010-07-31 05:49:33 +00:00
|
|
|
# create and install package scripts
|
|
|
|
%cabal_pkg_conf \
|
|
|
|
%ghc_gen_scripts\
|
|
|
|
%ghc_install_scripts\
|
|
|
|
%{nil}
|
|
|
|
|
2010-07-31 04:44:43 +00:00
|
|
|
# devel pkg basic requires
|
2009-12-25 15:37:49 +00:00
|
|
|
%ghc_requires Requires: ghc = %{ghc_version}\
|
|
|
|
Requires(post): ghc = %{ghc_version}\
|
|
|
|
Requires(preun): ghc = %{ghc_version}\
|
2010-07-31 04:44:43 +00:00
|
|
|
%{nil}
|
2009-12-25 15:37:49 +00:00
|
|
|
|
2010-07-31 04:44:43 +00:00
|
|
|
# doc pkg basic requires
|
2009-12-25 15:37:49 +00:00
|
|
|
%ghc_doc_requires Requires: ghc-doc = %{ghc_version}\
|
|
|
|
Requires(post): ghc-doc = %{ghc_version}\
|
|
|
|
Requires(postun): ghc-doc = %{ghc_version}
|
|
|
|
|
2010-07-31 04:44:43 +00:00
|
|
|
# prof pkg basic requires
|
2009-12-25 15:37:49 +00:00
|
|
|
%ghc_prof_requires Requires: ghc-prof = %{ghc_version}\
|
|
|
|
Requires: ghc-%{?pkg_name}%{!?pkg_name:%name}-devel = %{version}-%{release}
|
2010-07-31 04:44:43 +00:00
|
|
|
|
|
|
|
# ghc_lib_package [-c cdepslist] [-h pkgdepslist]
|
|
|
|
%ghc_lib_package(c:h:)\
|
|
|
|
%define ghc_pkg_name ghc-%{?pkg_name}%{!?pkg_name:%name}\
|
|
|
|
\
|
|
|
|
%ghc_package_devel\
|
|
|
|
\
|
|
|
|
%ghc_package_doc\
|
|
|
|
\
|
|
|
|
%ghc_package_prof\
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
# ghc_binlib_package [-c cdepslist] [-h pkgdepslist] [-l licensetag]
|
|
|
|
%ghc_binlib_package(c:h:l:)\
|
|
|
|
%define local_pkg_name %{?pkg_name}%{!?pkg_name:%name}\
|
|
|
|
%define ghc_pkg_name ghc-%{local_pkg_name}\
|
|
|
|
\
|
|
|
|
%ghc_lib_package\
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
# ghc_package_devel [-c cdepslist] [-h pkgdepslist] [-l licensetag]
|
|
|
|
%ghc_package_devel(c:h:l:)\
|
|
|
|
%define local_pkg_name %{?pkg_name}%{!?pkg_name:%name}\
|
|
|
|
%define ghc_pkg_name ghc-%{local_pkg_name}\
|
|
|
|
%package -n %{ghc_pkg_name}-devel\
|
|
|
|
Summary: %{?common_summary}%{!?common_summary:%{local_pkg_name} library} development files\
|
|
|
|
Group: Development/Libraries\
|
|
|
|
%{-l:License: %{-l*}}\
|
|
|
|
%{?ghc_requires}\
|
|
|
|
%{!-h:%{?ghc_pkg_deps:Requires: %{ghc_pkg_deps}}}\
|
|
|
|
%{-h:Requires: %{-h*}}\
|
|
|
|
%{!-c:%{?ghc_pkg_c_deps:Requires: %{ghc_pkg_c_deps}}}\
|
|
|
|
%{-c:Requires: %{-c*}}\
|
|
|
|
\
|
|
|
|
%description -n %{ghc_pkg_name}-devel\
|
|
|
|
%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\
|
|
|
|
\
|
|
|
|
This package contains the development files.\
|
|
|
|
\
|
|
|
|
%post -n %{ghc_pkg_name}-devel\
|
|
|
|
%ghc_register_pkg\
|
|
|
|
\
|
|
|
|
%preun -n %{ghc_pkg_name}-devel\
|
|
|
|
%ghc_unregister_pkg\
|
|
|
|
\
|
|
|
|
%files -n %{ghc_pkg_name}-devel -f %{ghc_pkg_name}-devel.files\
|
|
|
|
%defattr(-,root,root,-)\
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
# for docs post and postun
|
|
|
|
# re-index haddock
|
|
|
|
%ghc_reindex_haddock ( cd %{ghcdocbasedir}/libraries && [ -x "./gen_contents_index" ] && ./gen_contents_index ) || :
|
|
|
|
|
|
|
|
# ghc_package_doc [-h pkgdepslist] [-l licensetag]
|
|
|
|
%ghc_package_doc(h:l:)\
|
|
|
|
%define local_pkg_name %{?pkg_name}%{!?pkg_name:%name}\
|
|
|
|
%define ghc_pkg_name ghc-%{local_pkg_name}\
|
|
|
|
%package -n %{ghc_pkg_name}-doc\
|
|
|
|
Summary: Documentation for %{?common_summary}%{!?common_summary:%{local_pkg_name} library}\
|
|
|
|
Group: Development/Libraries\
|
|
|
|
%{-l:License: %{-l*}}\
|
|
|
|
%{?ghc_doc_requires}\
|
|
|
|
%{!-h:%{?ghc_pkg_deps:Requires: %(echo %{ghc_pkg_deps} | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-doc/g")}}\
|
|
|
|
%{-h:Requires: %(echo %{-h*} | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-doc/g")}\
|
|
|
|
\
|
|
|
|
%description -n %{ghc_pkg_name}-doc\
|
|
|
|
%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\
|
|
|
|
\
|
|
|
|
This package contains development documentation files.\
|
|
|
|
\
|
|
|
|
%post -n %{ghc_pkg_name}-doc\
|
|
|
|
%ghc_reindex_haddock\
|
|
|
|
\
|
|
|
|
%postun -n %{ghc_pkg_name}-doc\
|
|
|
|
if [ "$1" -eq 0 ] ; then\
|
|
|
|
%ghc_reindex_haddock\
|
|
|
|
fi\
|
|
|
|
\
|
|
|
|
%files -n %{ghc_pkg_name}-doc -f %{ghc_pkg_name}-doc.files\
|
|
|
|
%defattr(-,root,root,-)\
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
# ghc_package_prof [-c cdepslist] [-h pkgdepslist] [-l licensetag]
|
|
|
|
%ghc_package_prof(h:l:)\
|
|
|
|
%define local_pkg_name %{?pkg_name}%{!?pkg_name:%name}\
|
|
|
|
%define ghc_pkg_name ghc-%{local_pkg_name}\
|
|
|
|
%package -n %{ghc_pkg_name}-prof\
|
|
|
|
Summary: Profiling libraries for %{?common_summary}%{!?common_summary:%{local_pkg_name}}\
|
|
|
|
Group: Development/Libraries\
|
|
|
|
%{-l:License: %{-l*}}\
|
|
|
|
%{?ghc_prof_requires}\
|
|
|
|
%{!-h:%{?ghc_pkg_deps:Requires: %(echo %{ghc_pkg_deps} | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-prof/g")}}\
|
|
|
|
%{-h:Requires: %(echo %{-h*} | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-prof/g")}\
|
|
|
|
\
|
|
|
|
%description -n %{ghc_pkg_name}-prof\
|
|
|
|
%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\
|
|
|
|
\
|
|
|
|
This package contains the profiling library.\
|
|
|
|
\
|
|
|
|
%files -n %{ghc_pkg_name}-prof -f %{ghc_pkg_name}-prof.files\
|
|
|
|
%defattr(-,root,root,-)\
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
# ghc_strip_dynlinked
|
|
|
|
%ghc_strip_dynlinked\
|
|
|
|
%if 0%{!?__debug_package:1}\
|
2010-07-31 05:49:33 +00:00
|
|
|
find $RPM_BUILD_ROOT -type f -exec sh -c "file {} | grep -q 'dynamically linked'" \\; -exec strip "{}" \\;\
|
2010-07-31 04:44:43 +00:00
|
|
|
%endif
|
|
|
|
|
|
|
|
# ghc_bin_build
|
|
|
|
%ghc_bin_build\
|
|
|
|
%cabal_configure --ghc\
|
|
|
|
%cabal build
|
|
|
|
|
|
|
|
# ghc_lib_build
|
|
|
|
%ghc_lib_build\
|
|
|
|
%cabal_configure --ghc -p\
|
|
|
|
%cabal build\
|
|
|
|
%cabal haddock
|
|
|
|
|
|
|
|
# ghc_bin_install
|
|
|
|
%ghc_bin_install\
|
|
|
|
%cabal_install\
|
|
|
|
%ghc_strip_dynlinked
|
|
|
|
|
|
|
|
# ghc_lib_install
|
|
|
|
%ghc_lib_install\
|
|
|
|
%cabal_install\
|
2010-07-31 05:49:33 +00:00
|
|
|
%cabal_pkg_conf\
|
2010-07-31 04:44:43 +00:00
|
|
|
%ghc_gen_filelists ghc-%{?pkg_name}%{!?pkg_name:%name}\
|
|
|
|
%ghc_strip_dynlinked
|