2010-06-20 12:10:25 +00:00
|
|
|
# "cabal"
|
2009-05-13 07:37:39 +00:00
|
|
|
%cabal %{_bindir}/runghc Setup
|
|
|
|
|
2010-06-20 12:10:25 +00:00
|
|
|
# configure
|
2009-05-13 07:37:39 +00:00
|
|
|
%cabal_configure \
|
2010-01-09 15:58:27 +00:00
|
|
|
%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} --htmldir=%{ghcdocdir} --libsubdir='$compiler/$pkgid' %{?with_shared:--enable-shared} %{?with_dynamic:--ghc-option=-dynamic}
|
2009-12-23 14:42:16 +00:00
|
|
|
|
2010-06-20 12:10:25 +00:00
|
|
|
# install
|
2009-05-13 07:37:39 +00:00
|
|
|
%cabal_install %cabal copy --destdir=${RPM_BUILD_ROOT} -v
|
|
|
|
|
2010-06-20 12:10:25 +00:00
|
|
|
# root dir for ghc docs
|
2010-01-10 14:59:10 +00:00
|
|
|
%ghcdocbasedir %{_docdir}/ghc/html
|
2010-06-20 12:10:25 +00:00
|
|
|
# ghcdocdir [pkgname]
|
2010-01-14 14:32:25 +00:00
|
|
|
%ghcdocdir() %{ghcdocbasedir}/libraries/%{?1}%{!?1:%{pkg_name}}-%{version}
|
2010-06-20 12:10:25 +00:00
|
|
|
# top library dir
|
2010-01-14 14:32:25 +00:00
|
|
|
%ghcpkgbasedir %{_libdir}/ghc-%{ghc_version}
|
2010-06-20 12:10:25 +00:00
|
|
|
# ghcpkgdir [pkgname]
|
2010-01-14 14:32:25 +00:00
|
|
|
%ghcpkgdir() %{ghcpkgbasedir}/%{?1}%{!?1:%{pkg_name}}-%{version}
|
2009-05-13 07:37:39 +00:00
|
|
|
|
2010-06-20 12:10:25 +00:00
|
|
|
# ghc_gen_filelists [pkgname]
|
2009-05-13 07:37:39 +00:00
|
|
|
%ghc_gen_filelists() \
|
2010-01-14 14:32:25 +00:00
|
|
|
pkgname=%{?1}%{!?1:%{pkg_name}} \
|
|
|
|
basefile=ghc-${pkgname} \
|
|
|
|
pkgnamever=${pkgname}-%{version} \
|
2010-01-10 14:59:10 +00:00
|
|
|
rm -f ${basefile}.files ${basefile}-devel.files ${basefile}-prof.files ${basefile}-doc.files \
|
|
|
|
echo "%defattr(-,root,root,-)" > ${basefile}.files \
|
|
|
|
if [ -d "${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}" ]; then \
|
|
|
|
%{!?1:echo "%{_docdir}/%{name}-%{version}" >> ${basefile}%{!?with_shared:-devel}.files} %{?1::} \
|
|
|
|
fi \
|
2010-01-14 14:32:25 +00:00
|
|
|
%if %{with shared} \
|
|
|
|
if [ -d "${RPM_BUILD_ROOT}%{ghcpkgdir}" ]; then \
|
2010-01-10 14:59:10 +00:00
|
|
|
echo "%dir %{ghcpkgdir}" >> ${basefile}.files \
|
2010-01-14 14:32:25 +00:00
|
|
|
echo "%attr(755,root,root) %{ghcpkgdir}/libHS${pkgnamever}-ghc%{ghc_version}.so" >> ${basefile}.files \
|
|
|
|
fi \
|
|
|
|
%endif \
|
2010-01-10 14:59:10 +00:00
|
|
|
echo "%defattr(-,root,root,-)" > ${basefile}-devel.files \
|
2010-01-14 14:32:25 +00:00
|
|
|
echo "%{_libdir}/ghc-%{ghc_version}/package.conf.d/${pkgnamever}*.conf" >> ${basefile}-devel.files \
|
|
|
|
if [ -d "${RPM_BUILD_ROOT}%{ghcpkgdir}" ]; then \
|
2010-01-10 14:59:10 +00:00
|
|
|
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" -o -name "libHS*.so" \\) >> ${basefile}-devel.files \
|
2010-01-14 14:32:25 +00:00
|
|
|
fi \
|
2010-01-10 14:59:10 +00:00
|
|
|
echo "%defattr(-,root,root,-)" > ${basefile}-prof.files \
|
2010-01-14 14:32:25 +00:00
|
|
|
if [ -d "${RPM_BUILD_ROOT}%{ghcpkgdir}" ]; then \
|
2010-01-10 14:59:10 +00:00
|
|
|
find ${RPM_BUILD_ROOT}%{ghcpkgdir} \\( -name "*_p.a" -o -name "*.p_hi" \\) >> ${basefile}-prof.files \
|
2010-01-14 14:32:25 +00:00
|
|
|
fi \
|
2010-01-10 14:59:10 +00:00
|
|
|
echo "%defattr(-,root,root,-)" > ${basefile}-doc.files \
|
2010-01-14 14:32:25 +00:00
|
|
|
if [ -d "${RPM_BUILD_ROOT}%{ghcdocdir}" ]; then \
|
2010-01-10 14:59:10 +00:00
|
|
|
echo "%{ghcdocdir}" >> ${basefile}-doc.files \
|
2010-01-14 14:32:25 +00:00
|
|
|
fi \
|
|
|
|
sed -i -e "s!${RPM_BUILD_ROOT}!!g" ${basefile}.files ${basefile}-devel.files ${basefile}-prof.files \
|
2009-05-13 07:37:39 +00:00
|
|
|
%{nil}
|
|
|
|
|
2010-06-20 12:10:25 +00:00
|
|
|
# compiler version
|
2009-12-15 21:50:31 +00:00
|
|
|
%ghc_version %{!?ghc_version_override:%(ghc --numeric-version)}%{?ghc_version_override}
|
2009-11-16 07:45:33 +00:00
|
|
|
|
2010-06-20 12:10:25 +00:00
|
|
|
# create and install package.conf file
|
|
|
|
# cabal_pkg_conf [pkgname]
|
2009-12-11 18:17:07 +00:00
|
|
|
%cabal_pkg_conf \
|
|
|
|
%cabal register --gen-pkg-config \
|
2010-01-14 14:32:25 +00:00
|
|
|
mkdir -p $RPM_BUILD_ROOT%{_libdir}/ghc-%{ghc_version}/package.conf.d \
|
|
|
|
install --mode=0644 %{?1}%{!?1:%{pkg_name}}-%{version}.conf $RPM_BUILD_ROOT%{_libdir}/ghc-%{ghc_version}/package.conf.d
|
2010-04-12 14:52:34 +00:00
|
|
|
|
2010-06-20 12:10:25 +00:00
|
|
|
# devel pkg basic requires
|
2009-12-23 14:42:16 +00:00
|
|
|
%ghc_requires Requires: ghc = %{ghc_version}\
|
|
|
|
Requires(post): ghc = %{ghc_version}\
|
|
|
|
Requires(postun): ghc = %{ghc_version}\
|
|
|
|
%if %{with shared}\
|
2010-01-11 06:51:22 +00:00
|
|
|
Requires: ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}} = %{-v:%{-v*}}%{!-v:%{version}}-%{release}\
|
2009-12-23 14:42:16 +00:00
|
|
|
%endif
|
|
|
|
|
2010-06-20 12:10:25 +00:00
|
|
|
# doc pkg basic requires
|
2009-12-23 14:42:16 +00:00
|
|
|
%ghc_doc_requires Requires: ghc-doc = %{ghc_version}\
|
|
|
|
Requires(post): ghc-doc = %{ghc_version}\
|
|
|
|
Requires(postun): ghc-doc = %{ghc_version}
|
|
|
|
|
2010-06-20 12:10:25 +00:00
|
|
|
# prof pkg basic requires
|
2009-12-23 14:42:16 +00:00
|
|
|
%ghc_prof_requires Requires: ghc-prof = %{ghc_version}\
|
2010-01-11 06:51:22 +00:00
|
|
|
Requires: ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}}-devel = %{-v:%{-v*}}%{!-v:%{version}}-%{release}
|
2010-01-09 15:58:27 +00:00
|
|
|
|
2010-06-20 12:10:25 +00:00
|
|
|
# ghc_lib_package [-n pkgname] [-c cdepslist] [-h pkgdepslist]
|
2010-01-09 15:58:27 +00:00
|
|
|
%ghc_lib_package(n:c:h:)\
|
|
|
|
%define ghc_pkg_name %{-n:ghc-%{-n*}}%{!-n:ghc-%{pkg_name}}\
|
|
|
|
%if %{with shared}\
|
|
|
|
%files -n %{ghc_pkg_name} -f %{ghc_pkg_name}.files\
|
|
|
|
%defattr(-,root,root,-)\
|
|
|
|
%endif\
|
|
|
|
\
|
|
|
|
%ghc_package_devel\
|
|
|
|
\
|
|
|
|
%ghc_package_doc\
|
|
|
|
\
|
|
|
|
%ghc_package_prof\
|
2010-04-12 14:52:34 +00:00
|
|
|
%{nil}
|
2010-01-09 15:58:27 +00:00
|
|
|
|
2010-06-24 02:13:22 +00:00
|
|
|
# ghc_binlib_package [-n pkgname] [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-v version]
|
2010-01-10 14:59:10 +00:00
|
|
|
%ghc_binlib_package(n:c:h:l:v:s:d:)\
|
|
|
|
%define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\
|
|
|
|
%define ghc_pkg_name ghc-%{local_pkg_name}\
|
2010-01-09 15:58:27 +00:00
|
|
|
%package -n %{ghc_pkg_name}\
|
2010-06-24 02:13:22 +00:00
|
|
|
Summary: %{?common_summary}%{!?common_summary:%{local_pkg_name} library}\
|
2010-01-09 15:58:27 +00:00
|
|
|
Group: System Environment/Libraries\
|
|
|
|
%{-v:Version: %{-v*}}\
|
|
|
|
%{-l:License: %{-l*}}\
|
|
|
|
\
|
|
|
|
%description -n %{ghc_pkg_name}\
|
2010-06-24 02:13:22 +00:00
|
|
|
%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\
|
2010-01-09 15:58:27 +00:00
|
|
|
\
|
|
|
|
This package provides the shared library.\
|
|
|
|
\
|
|
|
|
%ghc_lib_package\
|
2010-04-12 14:52:34 +00:00
|
|
|
%{nil}
|
2010-01-09 15:58:27 +00:00
|
|
|
|
2010-04-12 14:52:34 +00:00
|
|
|
%ghc_pkg_recache %{_bindir}/ghc-pkg recache --no-user-package-conf || :
|
2010-01-09 15:58:27 +00:00
|
|
|
|
2010-06-20 12:10:25 +00:00
|
|
|
# for docs post and postun
|
|
|
|
%ghc_reindex_haddock ( cd %{ghcdocbasedir}/libraries && [ -x "./gen_contents_index" ] && ./gen_contents_index ) || :
|
|
|
|
|
2010-06-24 02:13:22 +00:00
|
|
|
# ghc_package_devel [-n pkgname] [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-v version]
|
2010-01-10 14:59:10 +00:00
|
|
|
%ghc_package_devel(n:c:h:l:v:s:d:)\
|
|
|
|
%define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\
|
|
|
|
%define ghc_pkg_name ghc-%{local_pkg_name}\
|
2010-01-09 15:58:27 +00:00
|
|
|
%package -n %{ghc_pkg_name}-devel\
|
2010-06-24 02:13:22 +00:00
|
|
|
Summary: %{?common_summary}%{!?common_summary:%{local_pkg_name}} development files\
|
2010-01-09 15:58:27 +00:00
|
|
|
Group: Development/Libraries\
|
|
|
|
%{-v:Version: %{-v*}}\
|
|
|
|
%{-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\
|
2010-06-24 02:13:22 +00:00
|
|
|
%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\
|
2010-01-09 15:58:27 +00:00
|
|
|
\
|
|
|
|
This package contains the development files.\
|
|
|
|
\
|
|
|
|
%post -n %{ghc_pkg_name}-devel\
|
2010-04-12 14:52:34 +00:00
|
|
|
%ghc_pkg_recache\
|
2010-01-09 15:58:27 +00:00
|
|
|
\
|
|
|
|
%postun -n %{ghc_pkg_name}-devel\
|
2010-04-12 14:52:34 +00:00
|
|
|
%ghc_pkg_recache\
|
2010-01-09 15:58:27 +00:00
|
|
|
\
|
|
|
|
%files -n %{ghc_pkg_name}-devel -f %{ghc_pkg_name}-devel.files\
|
|
|
|
%defattr(-,root,root,-)\
|
2010-04-12 14:52:34 +00:00
|
|
|
%{nil}
|
|
|
|
|
2010-06-20 12:10:25 +00:00
|
|
|
# re-index haddock
|
2010-04-12 14:52:34 +00:00
|
|
|
%ghc_reindex_haddock ( cd %{ghcdocbasedir}/libraries && [ -x "./gen_contents_index" ] && ./gen_contents_index ) || :
|
2010-01-09 15:58:27 +00:00
|
|
|
|
2010-06-24 02:13:22 +00:00
|
|
|
# ghc_package_doc [-n pkgname] [-h pkgdepslist] [-l licensetag] [-v version]
|
2010-01-10 14:59:10 +00:00
|
|
|
%ghc_package_doc(n:h:l:v:s:d:)\
|
|
|
|
%define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\
|
|
|
|
%define ghc_pkg_name ghc-%{local_pkg_name}\
|
2010-01-09 15:58:27 +00:00
|
|
|
%package -n %{ghc_pkg_name}-doc\
|
2010-06-24 02:13:22 +00:00
|
|
|
Summary: Documentation for %{?common_summary}%{!?common_summary:%{local_pkg_name}}\
|
2010-01-09 15:58:27 +00:00
|
|
|
Group: Development/Libraries\
|
|
|
|
%{-v:Version: %{-v*}}\
|
|
|
|
%{-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\
|
2010-06-24 02:13:22 +00:00
|
|
|
%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\
|
2010-01-09 15:58:27 +00:00
|
|
|
\
|
|
|
|
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,-)\
|
2010-04-12 14:52:34 +00:00
|
|
|
%{nil}
|
2010-01-09 15:58:27 +00:00
|
|
|
|
2010-06-24 02:13:22 +00:00
|
|
|
# ghc_package_prof [-n pkgname] [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-v version]
|
2010-01-10 14:59:10 +00:00
|
|
|
%ghc_package_prof(n:h:l:v:s:d:)\
|
|
|
|
%define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\
|
|
|
|
%define ghc_pkg_name ghc-%{local_pkg_name}\
|
2010-01-09 15:58:27 +00:00
|
|
|
%package -n %{ghc_pkg_name}-prof\
|
2010-06-24 02:13:22 +00:00
|
|
|
Summary: Profiling libraries for %{?common_summary}%{!?common_summary:%{local_pkg_name}}\
|
2010-01-09 15:58:27 +00:00
|
|
|
Group: Development/Libraries\
|
|
|
|
%{-v:Version: %{-v*}}\
|
|
|
|
%{-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\
|
2010-06-24 02:13:22 +00:00
|
|
|
%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\
|
2010-01-09 15:58:27 +00:00
|
|
|
\
|
|
|
|
This package contains the profiling library.\
|
|
|
|
\
|
|
|
|
%files -n %{ghc_pkg_name}-prof -f %{ghc_pkg_name}-prof.files\
|
|
|
|
%defattr(-,root,root,-)\
|
2010-04-12 14:52:34 +00:00
|
|
|
%{nil}
|
2010-06-20 12:44:49 +00:00
|
|
|
|
2010-06-23 10:05:24 +00:00
|
|
|
# ghc_strip_dynlinked
|
2010-06-23 10:24:53 +00:00
|
|
|
%ghc_strip_dynlinked\
|
|
|
|
%if 0%{!?__debug_package:1}\
|
|
|
|
find $RPM_BUILD_ROOT -type f -exec sh -c "file {} | grep -q 'dynamically linked'" \\; -print | xargs strip\
|
|
|
|
%endif
|