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-12-30 12:19:29 +00:00
|
|
|
%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} --htmldir=%{ghcdocdir} --libsubdir='$compiler/$pkgid' --ghc %{!?without_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-12-30 12:19:29 +00:00
|
|
|
# (deprecated) pkg doc dir
|
|
|
|
%ghcdocdir %{ghcdocbasedir}/libraries/%{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-12-30 12:19:29 +00:00
|
|
|
# (deprecated) package dir
|
|
|
|
%ghcpkgdir %{ghcpkgbasedir}/%{pkg_name}-%{version}
|
|
|
|
|
|
|
|
# ghc_gen_filelists [name-version]
|
|
|
|
%ghc_gen_filelists()\
|
|
|
|
pkgnamever=%{?1}%{!?1:%{pkg_name}-%{version}} \
|
|
|
|
pkgname=%{?pkg_name}%{!?pkg_name:$(echo ${pkgnamever} | sed -e "s/\\(.*\\)-.*/\\1/")} \
|
|
|
|
basepkg=ghc-${pkgname} \
|
|
|
|
pkgdir=%{ghcpkgbasedir}/${pkgnamever} \
|
|
|
|
docdir=%{ghcdocbasedir}/libraries/${pkgnamever} \
|
|
|
|
rm -f ${basepkg}.files ${basepkg}-devel.files ${basepkg}-prof.files \
|
2010-09-30 02:21:16 +00:00
|
|
|
%if 0%{!?without_shared:1} \
|
2010-12-30 12:19:29 +00:00
|
|
|
echo "%defattr(-,root,root,-)" > ${basepkg}.files \
|
|
|
|
if [ -d "${RPM_BUILD_ROOT}${pkgdir}" ]; then \
|
|
|
|
echo "%dir ${pkgdir}" >> ${basepkg}.files \
|
|
|
|
echo "%attr(755,root,root) ${pkgdir}/libHS${pkgnamever}-ghc%{ghc_version}.so" >> ${basepkg}.files \
|
2010-01-14 14:32:25 +00:00
|
|
|
fi \
|
|
|
|
%endif \
|
2010-12-30 12:19:29 +00:00
|
|
|
echo "%defattr(-,root,root,-)" > ${basepkg}-devel.files \
|
|
|
|
if [ -d "${RPM_BUILD_ROOT}%{_docdir}/ghc-${pkgnamever}" ]; then \
|
|
|
|
echo "%{_docdir}/ghc-${pkgnamever}" >> ${basepkg}%{?without_shared:-devel}.files \
|
2010-09-30 03:12:47 +00:00
|
|
|
fi \
|
2010-12-30 12:19:29 +00:00
|
|
|
echo "%{ghcpkgbasedir}/package.conf.d/${pkgnamever}*.conf" >> ${basepkg}-devel.files \
|
|
|
|
if [ -d "${RPM_BUILD_ROOT}${pkgdir}" ]; then \
|
|
|
|
find ${RPM_BUILD_ROOT}${pkgdir} -type d | sed "s/^/%dir /" >> ${basepkg}-devel.files \
|
|
|
|
find ${RPM_BUILD_ROOT}${pkgdir} ! \\( -type d -o -name "*_p.a" -o -name "*.p_hi" -o -name "libHS*.so" \\) >> ${basepkg}-devel.files \
|
2010-01-14 14:32:25 +00:00
|
|
|
fi \
|
2010-12-30 12:19:29 +00:00
|
|
|
echo "%defattr(-,root,root,-)" > ${basepkg}-prof.files \
|
|
|
|
if [ -d "${RPM_BUILD_ROOT}${pkgdir}" ]; then \
|
|
|
|
find ${RPM_BUILD_ROOT}${pkgdir} \\( -name "*_p.a" -o -name "*.p_hi" \\) >> ${basepkg}-prof.files \
|
2010-01-14 14:32:25 +00:00
|
|
|
fi \
|
2010-12-30 12:19:29 +00:00
|
|
|
if [ -d "${RPM_BUILD_ROOT}${docdir}" ]; then \
|
|
|
|
echo "${docdir}" >> ${basepkg}-devel.files \
|
2010-01-14 14:32:25 +00:00
|
|
|
fi \
|
2010-12-30 12:19:29 +00:00
|
|
|
sed -i -e "s!${RPM_BUILD_ROOT}!!g" %{!?without_shared:${basepkg}.files} ${basepkg}-devel.files ${basepkg}-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
|
2010-12-30 12:19:29 +00:00
|
|
|
# cabal_pkg_conf [name-ver]
|
|
|
|
%cabal_pkg_conf()\
|
|
|
|
pkgnamever=%{?1}%{!?1:%{pkg_name}-%{version}} \
|
2009-12-11 18:17:07 +00:00
|
|
|
%cabal register --gen-pkg-config \
|
2010-09-30 02:21:16 +00:00
|
|
|
mkdir -p $RPM_BUILD_ROOT%{ghcpkgbasedir}/package.conf.d \
|
2010-12-30 12:19:29 +00:00
|
|
|
install --mode=0644 ${pkgnamever}.conf $RPM_BUILD_ROOT%{ghcpkgbasedir}/package.conf.d \
|
|
|
|
%{nil}
|
2010-04-12 14:52:34 +00:00
|
|
|
|
2010-06-20 12:10:25 +00:00
|
|
|
# devel pkg basic requires
|
2010-11-23 05:01:27 +00:00
|
|
|
%ghc_devel_requires Requires(post): ghc = %{ghc_version}\
|
2010-11-23 07:08:28 +00:00
|
|
|
Requires(postun): ghc = %{ghc_version}\
|
|
|
|
%if 0%{!?without_shared:1}\
|
|
|
|
Requires: ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}} = %{-v:%{-v*}}%{!-v:%{version}}-%{release}\
|
|
|
|
%endif
|
2009-12-23 14:42:16 +00:00
|
|
|
|
2010-06-20 12:10:25 +00:00
|
|
|
# prof pkg basic requires
|
2010-11-23 07:08:28 +00:00
|
|
|
%ghc_prof_requires Requires: ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}}-devel = %{-v:%{-v*}}%{!-v:%{version}}-%{release}\
|
2010-11-23 05:01:27 +00:00
|
|
|
%{nil}
|
2010-01-09 15:58:27 +00:00
|
|
|
|
2010-09-30 02:21:16 +00:00
|
|
|
# ghc_lib_package [-n pkgname] [-c cdepslist] [-h pkgdepslist] (-o deprecated no-op)
|
2010-07-15 14:43:34 +00:00
|
|
|
%ghc_lib_package(n:c:h:o:)\
|
2010-09-30 02:21:16 +00:00
|
|
|
%define ghc_pkg_name ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}}\
|
|
|
|
%if 0%{!?without_shared:1}\
|
2010-01-09 15:58:27 +00:00
|
|
|
%files -n %{ghc_pkg_name} -f %{ghc_pkg_name}.files\
|
|
|
|
%defattr(-,root,root,-)\
|
|
|
|
%endif\
|
|
|
|
\
|
|
|
|
%ghc_package_devel\
|
|
|
|
\
|
|
|
|
%ghc_package_prof\
|
2010-04-12 14:52:34 +00:00
|
|
|
%{nil}
|
2010-01-09 15:58:27 +00:00
|
|
|
|
2010-09-30 02:21:16 +00:00
|
|
|
# ghc_binlib_package [-n pkgname] [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-v version] (-o deprecated no-op)
|
2010-07-15 14:43:34 +00:00
|
|
|
%ghc_binlib_package(n:c:h:l:v:o:)\
|
2010-01-10 14:59:10 +00:00
|
|
|
%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-12-30 12:19:29 +00:00
|
|
|
Summary: %{?common_summary}%{!?common_summary:Haskell %{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
|
|
|
\
|
2010-09-30 03:12:47 +00:00
|
|
|
%if 0%{!?without_shared:1} \
|
2010-01-09 15:58:27 +00:00
|
|
|
This package provides the shared library.\
|
2010-09-30 03:12:47 +00:00
|
|
|
%endif \
|
2010-01-09 15:58:27 +00:00
|
|
|
\
|
|
|
|
%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-07-15 14:43:34 +00:00
|
|
|
# for docs post and postun
|
2010-11-23 05:01:27 +00:00
|
|
|
%ghc_reindex_haddock\
|
|
|
|
%{nil}
|
2010-07-15 14:43:34 +00:00
|
|
|
|
2010-09-30 02:21:16 +00:00
|
|
|
# ghc_package_devel [-n pkgname] [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-v version] (-o deprecated no-op)
|
2010-07-15 14:43:34 +00:00
|
|
|
%ghc_package_devel(n:c:h:l:v:o:)\
|
2010-09-30 02:21:16 +00:00
|
|
|
%global _use_internal_dependency_generator 0\
|
2010-11-23 05:01:27 +00:00
|
|
|
%global __find_provides /usr/lib/rpm/ghc-deps.sh --provides %{buildroot}%{ghcpkgbasedir}\
|
|
|
|
%global __find_requires /usr/lib/rpm/ghc-deps.sh --requires %{buildroot}%{ghcpkgbasedir}\
|
2010-01-10 14:59:10 +00:00
|
|
|
%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 06:05:43 +00:00
|
|
|
Summary: %{?common_summary}%{!?common_summary:%{local_pkg_name} library} development files\
|
2010-01-09 15:58:27 +00:00
|
|
|
Group: Development/Libraries\
|
|
|
|
%{-v:Version: %{-v*}}\
|
|
|
|
%{-l:License: %{-l*}}\
|
2010-11-23 05:01:27 +00:00
|
|
|
%{?ghc_devel_requires}\
|
2010-01-09 15:58:27 +00:00
|
|
|
%{!-h:%{?ghc_pkg_deps:Requires: %{ghc_pkg_deps}}}\
|
|
|
|
%{-h:Requires: %{-h*}}\
|
|
|
|
%{!-c:%{?ghc_pkg_c_deps:Requires: %{ghc_pkg_c_deps}}}\
|
|
|
|
%{-c:Requires: %{-c*}}\
|
2010-09-30 02:21:16 +00:00
|
|
|
%{?ghc_pkg_obsoletes:Obsoletes: %{ghc_pkg_obsoletes}}\
|
|
|
|
%{?ghc_pkg_obsoletes:Obsoletes: %(echo "%{ghc_pkg_obsoletes}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-doc/g")}\
|
|
|
|
Obsoletes: %{ghc_pkg_name}-doc < %{version}-%{release}\
|
2010-07-17 08:08:37 +00:00
|
|
|
Provides: %{ghc_pkg_name}-doc = %{version}-%{release}\
|
2010-01-09 15:58:27 +00:00
|
|
|
\
|
|
|
|
%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-07-15 14:43:34 +00:00
|
|
|
%ghc_reindex_haddock\
|
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
|
|
|
%ghc_reindex_haddock\
|
|
|
|
\
|
2010-07-15 14:43:34 +00:00
|
|
|
%files -n %{ghc_pkg_name}-devel -f %{ghc_pkg_name}-devel.files\
|
2010-01-09 15:58:27 +00:00
|
|
|
%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-06-28 07:33:22 +00:00
|
|
|
%ghc_package_prof(n:h:l:v:)\
|
2010-01-10 14:59:10 +00:00
|
|
|
%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}\
|
2010-09-30 02:21:16 +00:00
|
|
|
%{!-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")}\
|
|
|
|
%{?ghc_pkg_obsoletes:Obsoletes: %(echo "%{ghc_pkg_obsoletes}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-prof/g")}\
|
2010-01-09 15:58:27 +00:00
|
|
|
\
|
|
|
|
%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}\
|
2010-07-17 08:08:37 +00:00
|
|
|
find $RPM_BUILD_ROOT -type f -exec sh -c "file {} | grep -q 'dynamically linked'" \\; -exec strip "{}" \\;\
|
2010-06-23 10:24:53 +00:00
|
|
|
%endif
|
2010-06-26 08:53:39 +00:00
|
|
|
|
|
|
|
# ghc_bin_build
|
|
|
|
%ghc_bin_build\
|
2010-12-30 12:19:29 +00:00
|
|
|
%cabal_configure\
|
2010-06-26 08:53:39 +00:00
|
|
|
%cabal build
|
|
|
|
|
2010-12-30 12:19:29 +00:00
|
|
|
# ghc_lib_build [name-version]
|
|
|
|
%ghc_lib_build()\
|
|
|
|
%{?1:cd %1}\
|
|
|
|
%cabal_configure -p %{?1:--docdir=%{_docdir}/ghc-%1 --htmldir=%{ghcdocbasedir}/libraries/%1}\
|
2010-06-26 08:53:39 +00:00
|
|
|
%cabal build\
|
2010-12-30 12:19:29 +00:00
|
|
|
%cabal haddock %{!?without_hscolour:--hyperlink-source}\
|
|
|
|
%{?1:cd -}\
|
|
|
|
%{nil}
|
2010-06-26 08:53:39 +00:00
|
|
|
|
2010-12-30 12:19:29 +00:00
|
|
|
# install bin package
|
2010-06-26 08:53:39 +00:00
|
|
|
%ghc_bin_install\
|
|
|
|
%cabal_install\
|
|
|
|
%ghc_strip_dynlinked
|
|
|
|
|
2010-12-30 12:19:29 +00:00
|
|
|
# ghc_lib_install [name-version]
|
|
|
|
%ghc_lib_install()\
|
|
|
|
%{?1:cd %1}\
|
2010-06-26 08:53:39 +00:00
|
|
|
%cabal_install\
|
|
|
|
%cabal_pkg_conf\
|
2010-12-30 12:19:29 +00:00
|
|
|
%{?1:cd -}\
|
2010-06-26 08:53:39 +00:00
|
|
|
%ghc_gen_filelists\
|
2010-12-30 12:19:29 +00:00
|
|
|
%{!?1:%ghc_strip_dynlinked}\
|
|
|
|
%{nil}
|