2011-02-12 15:07:05 +00:00
|
|
|
# RPM Macros for packaging Haskell cabalized packages -*-rpm-spec-*-
|
2011-02-10 12:11:02 +00:00
|
|
|
# see https://fedoraproject.org/wiki/PackagingDrafts/Haskell for more details
|
|
|
|
|
2010-06-20 12:10:25 +00:00
|
|
|
# "cabal"
|
2011-12-02 13:20:12 +00:00
|
|
|
%cabal [ -x Setup ] || ghc --make %{!?ghc_user_conf:-no-user-package-conf} %{!?ghc_without_shared:%{!?ghc_without_dynamic:-dynamic}} Setup\
|
2011-01-23 05:05:38 +00:00
|
|
|
./Setup
|
2009-05-13 07:37:39 +00:00
|
|
|
|
2011-06-17 03:29:21 +00:00
|
|
|
# check ghc version was rebuilt against self
|
|
|
|
%ghc_check_bootstrap\
|
2011-03-28 07:45:18 +00:00
|
|
|
if [ ! "$(ghc --info | grep \\"Booter\\ version\\",\\"%{ghc_version}\\")" ]; then\
|
2011-06-17 08:00:17 +00:00
|
|
|
echo "Warning: this ghc build is not self-bootstrapped."\
|
|
|
|
%if %{undefined ghc_bootstrapping}\
|
|
|
|
echo "The ghc package should be rebuilt against its current version before\
|
|
|
|
proceeding, to avoid dependency ABI breakage from a future ghc rebuild."\
|
2011-06-17 08:11:17 +00:00
|
|
|
echo "To override set ghc_bootstrapping."\
|
2011-06-17 03:29:21 +00:00
|
|
|
echo "Aborting."\
|
2011-03-28 06:57:59 +00:00
|
|
|
exit 1\
|
|
|
|
%endif\
|
2011-06-17 03:29:21 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# configure
|
|
|
|
%cabal_configure\
|
|
|
|
%ghc_check_bootstrap\
|
2011-05-08 14:09:07 +00:00
|
|
|
%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} %{?pkg_name:--htmldir=%{ghclibdocdir}/%{pkg_name}-%{version}} --libsubdir='$compiler/$pkgid' --ghc %{!?ghc_without_shared:--enable-shared} %{!?ghc_without_dynamic:--enable-executable-dynamic} %{?cabal_configure_options}
|
2009-12-23 14:42:16 +00:00
|
|
|
|
2010-06-20 12:10:25 +00:00
|
|
|
# install
|
2011-01-03 11:37:32 +00:00
|
|
|
%cabal_install %cabal copy --destdir=%{buildroot} -v
|
2009-05-13 07:37:39 +00:00
|
|
|
|
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
|
2011-01-22 12:48:18 +00:00
|
|
|
# libraries doc dir
|
|
|
|
%ghclibdocdir %{ghcdocbasedir}/libraries
|
2010-06-20 12:10:25 +00:00
|
|
|
# top library dir
|
2011-01-03 11:37:32 +00:00
|
|
|
%ghclibdir %{_libdir}/ghc-%{ghc_version}
|
2010-12-30 12:19:29 +00:00
|
|
|
|
2011-01-03 11:37:32 +00:00
|
|
|
# ghc_gen_filelists [name] [version]
|
2010-12-30 12:19:29 +00:00
|
|
|
%ghc_gen_filelists()\
|
2011-01-03 11:37:32 +00:00
|
|
|
%define pkgname %{?1}%{!?1:%{pkg_name}}\
|
|
|
|
%define pkgver %{?2}%{!?2:%{version}}\
|
|
|
|
%define pkgnamever %{pkgname}-%{pkgver}\
|
|
|
|
%define basepkg ghc-%{pkgname}\
|
|
|
|
%define pkgdir %{ghclibdir}/%{pkgnamever}\
|
2011-01-22 12:48:18 +00:00
|
|
|
%define docdir %{ghclibdocdir}/%{pkgnamever}\
|
2011-05-16 01:58:56 +00:00
|
|
|
rm -f %{basepkg}.files %{basepkg}-devel.files\
|
2011-02-12 15:07:05 +00:00
|
|
|
%if %{undefined ghc_without_shared}\
|
2011-01-03 11:37:32 +00:00
|
|
|
if [ -d "%{buildroot}%{pkgdir}" ]; then\
|
|
|
|
echo "%dir %{pkgdir}" >> %{basepkg}.files\
|
|
|
|
echo "%attr(755,root,root) %{pkgdir}/libHS%{pkgnamever}-ghc%{ghc_version}.so" >> %{basepkg}.files\
|
|
|
|
fi\
|
|
|
|
%endif\
|
2011-10-15 04:01:58 +00:00
|
|
|
%if 0%{!?1:1} && %{undefined ghc_exclude_docdir}\
|
2011-01-29 12:34:52 +00:00
|
|
|
if [ -d "%{buildroot}%{_docdir}/%{name}-%{version}" ]; then\
|
2011-02-12 15:07:05 +00:00
|
|
|
echo "%{_docdir}/%{name}-%{version}" >> %{basepkg}%{?ghc_without_shared:-devel}.files\
|
2011-11-12 12:59:12 +00:00
|
|
|
elif [ -d "%{buildroot}%{_docdir}/ghc-%{pkgnamever}" ]; then\
|
2011-03-09 06:12:41 +00:00
|
|
|
echo "%{_docdir}/ghc-%{pkgnamever}" >> %{basepkg}%{?ghc_without_shared:-devel}.files\
|
|
|
|
fi\
|
|
|
|
%endif\
|
2011-12-27 06:06:50 +00:00
|
|
|
%if 0%{!?1:1} && %{defined ghc_without_shared}\
|
|
|
|
if [ "%{name}" = "ghc-%{pkg_name}" ]; then\
|
|
|
|
if [ -d "%{buildroot}%{_docdir}/%{name}-%{version}" ]; then\
|
|
|
|
mv %{buildroot}%{_docdir}/%{name}-%{version} %{buildroot}%{_docdir}/%{name}-devel-%{version}\
|
|
|
|
fi\
|
|
|
|
fi\
|
|
|
|
%endif\
|
2011-01-03 11:37:32 +00:00
|
|
|
echo "%{ghclibdir}/package.conf.d/%{pkgnamever}*.conf" >> %{basepkg}-devel.files\
|
|
|
|
if [ -d "%{buildroot}%{pkgdir}" ]; then\
|
|
|
|
find %{buildroot}%{pkgdir} -type d | sed "s/^/%dir /" >> %{basepkg}-devel.files\
|
2011-05-16 01:58:56 +00:00
|
|
|
find %{buildroot}%{pkgdir} ! \\( -type d -o -name "libHS*.so" \\) >> %{basepkg}-devel.files\
|
2011-01-03 11:37:32 +00:00
|
|
|
fi\
|
|
|
|
if [ -d "%{buildroot}%{docdir}" ]; then\
|
|
|
|
echo "%{docdir}" >> %{basepkg}-devel.files\
|
|
|
|
fi\
|
2011-05-16 01:58:56 +00:00
|
|
|
sed -i -e "s!%{buildroot}!!g" %{!?ghc_without_shared:%{basepkg}.files} %{basepkg}-devel.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
|
2011-01-03 11:37:32 +00:00
|
|
|
# cabal_pkg_conf [name] [version]
|
2010-12-30 12:19:29 +00:00
|
|
|
%cabal_pkg_conf()\
|
2011-01-03 11:37:32 +00:00
|
|
|
%define pkgname %{?1}%{!?1:%{pkg_name}}\
|
|
|
|
%define pkgver %{?2}%{!?2:%{version}}\
|
|
|
|
%define pkgnamever %{pkgname}-%{pkgver}\
|
|
|
|
%cabal register --gen-pkg-config\
|
2011-01-22 12:48:18 +00:00
|
|
|
mkdir -p %{buildroot}%{ghclibdir}/package.conf.d\
|
|
|
|
install --mode=0644 %{pkgnamever}.conf %{buildroot}%{ghclibdir}/package.conf.d\
|
2010-12-30 12:19:29 +00:00
|
|
|
%{nil}
|
2010-04-12 14:52:34 +00:00
|
|
|
|
2010-06-20 12:10:25 +00:00
|
|
|
# devel pkg basic requires
|
2011-11-01 12:18:49 +00:00
|
|
|
%ghc_devel_requires Requires: ghc-compiler = %{ghc_version}\
|
|
|
|
Requires(post): ghc-compiler = %{ghc_version}\
|
|
|
|
Requires(postun): ghc-compiler = %{ghc_version}\
|
2011-02-12 15:07:05 +00:00
|
|
|
%if %{undefined ghc_without_shared}\
|
2011-01-03 11:37:32 +00:00
|
|
|
Requires: ghc-%{?pkg_name}%{!?pkg_name:%{pkgname}} = %{?pkgver}%{!?pkgver:%{version}}-%{release}\
|
2010-11-23 07:08:28 +00:00
|
|
|
%endif
|
2009-12-23 14:42:16 +00:00
|
|
|
|
2011-12-27 00:57:08 +00:00
|
|
|
%ghc_shared_files\
|
|
|
|
%if %{undefined ghc_without_shared}\
|
|
|
|
%files -n %{basepkg} -f %{basepkg}.files\
|
|
|
|
%{?base_doc_files:%doc %base_doc_files}\
|
|
|
|
%endif\
|
|
|
|
%{nil}
|
|
|
|
|
2011-01-03 11:37:32 +00:00
|
|
|
# ghc_lib_package [-c cdepslist] [-h pkgdepslist]
|
|
|
|
%ghc_lib_package(c:h:)\
|
|
|
|
%define pkgname %{?1}%{!?1:%{pkg_name}}\
|
|
|
|
%define basepkg ghc-%{pkgname}\
|
2011-12-27 00:57:08 +00:00
|
|
|
%ghc_shared_files\
|
2010-01-09 15:58:27 +00:00
|
|
|
\
|
|
|
|
%ghc_package_devel\
|
2010-04-12 14:52:34 +00:00
|
|
|
%{nil}
|
2010-01-09 15:58:27 +00:00
|
|
|
|
2011-01-20 08:25:37 +00:00
|
|
|
# ghc_binlib_package [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-x] [name] [version]
|
|
|
|
%ghc_binlib_package(c:h:l:x)\
|
2011-01-03 11:37:32 +00:00
|
|
|
%define pkgname %{?1}%{!?1:%{pkg_name}}\
|
|
|
|
%define pkgver %{?2}%{!?2:%{version}}\
|
|
|
|
%define pkgnamever %{pkgname}-%{pkgver}\
|
2011-01-20 08:25:37 +00:00
|
|
|
%{!-x:%{?1:%global ghc_packages_list %{?ghc_packages_list} %{pkgnamever}}}\
|
2011-01-03 11:37:32 +00:00
|
|
|
%define basepkg ghc-%{pkgname}\
|
|
|
|
%package -n %{basepkg}\
|
|
|
|
Summary: %{?common_summary}%{!?common_summary:Haskell %{pkgname} library}\
|
2010-01-09 15:58:27 +00:00
|
|
|
Group: System Environment/Libraries\
|
2011-01-03 11:37:32 +00:00
|
|
|
%{?1:Version: %{pkgver}}\
|
2010-01-09 15:58:27 +00:00
|
|
|
%{-l:License: %{-l*}}\
|
2011-03-10 06:02:39 +00:00
|
|
|
%{?ghc_pkg_obsoletes:Obsoletes: %(echo "%{ghc_pkg_obsoletes}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1/g")}\
|
2010-01-09 15:58:27 +00:00
|
|
|
\
|
2011-01-03 11:37:32 +00:00
|
|
|
%description -n %{basepkg}\
|
|
|
|
%{?common_description}%{!?common_description:Haskell %{pkgname} library.}\
|
2011-02-12 15:07:05 +00:00
|
|
|
%if %{defined ghc_version} && %{undefined ghc_without_shared}\
|
2010-01-09 15:58:27 +00:00
|
|
|
This package provides the shared library.\
|
2011-01-03 11:37:32 +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
|
|
|
|
2011-03-28 06:57:59 +00:00
|
|
|
# (deprecated) for docs post and postun
|
|
|
|
%ghc_reindex_haddock :
|
2010-07-15 14:43:34 +00:00
|
|
|
|
2011-12-27 00:57:08 +00:00
|
|
|
%ghc_devel_files\
|
|
|
|
%files -n %{basepkg}-devel -f %{basepkg}-devel.files\
|
|
|
|
%if %{defined ghc_without_shared}\
|
|
|
|
%{?base_doc_files:%doc %base_doc_files}\
|
|
|
|
%endif\
|
|
|
|
%{?devel_doc_files:%doc %devel_doc_files}\
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
%ghc_files()\
|
|
|
|
%{?1:%define base_doc_files %*}\
|
|
|
|
%define basepkg ghc-%{pkg_name}\
|
|
|
|
%ghc_shared_files\
|
|
|
|
\
|
|
|
|
%ghc_devel_files\
|
|
|
|
%{nil}
|
|
|
|
|
2011-01-03 11:37:32 +00:00
|
|
|
# ghc_package_devel [-c cdepslist] [-h pkgdepslist] [-l licensetag] [name] [version]
|
|
|
|
%ghc_package_devel(c:h:l:)\
|
|
|
|
%define pkgname %{?1}%{!?1:%{pkg_name}}\
|
|
|
|
%define pkgver %{?2}%{!?2:%{version}}\
|
|
|
|
%define pkgnamever %{pkgname}-%{pkgver}\
|
|
|
|
%define basepkg ghc-%{pkgname}\
|
|
|
|
%package -n %{basepkg}-devel\
|
2011-06-02 04:35:47 +00:00
|
|
|
Summary: %{?common_summary}%{!?common_summary:Haskell %{pkgname} library} development files\
|
2010-01-09 15:58:27 +00:00
|
|
|
Group: Development/Libraries\
|
2011-01-03 11:37:32 +00:00
|
|
|
%{?1:Version: %{pkgver}}\
|
2010-01-09 15:58:27 +00:00
|
|
|
%{-l:License: %{-l*}}\
|
2010-11-23 05:01:27 +00:00
|
|
|
%{?ghc_devel_requires}\
|
2010-01-09 15:58:27 +00:00
|
|
|
%{-h:Requires: %{-h*}}\
|
2011-05-09 09:56:37 +00:00
|
|
|
%{?ghc_pkg_c_deps:Requires: %{ghc_pkg_c_deps}}\
|
2010-01-09 15:58:27 +00:00
|
|
|
%{-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")}\
|
2011-09-30 01:43:58 +00:00
|
|
|
Obsoletes: %{basepkg}-doc < %{pkgver}-%{release}\
|
|
|
|
Provides: %{basepkg}-doc = %{pkgver}-%{release}\
|
|
|
|
Obsoletes: %{basepkg}-prof < %{pkgver}-%{release}\
|
|
|
|
Provides: %{basepkg}-prof = %{pkgver}-%{release}\
|
2010-01-09 15:58:27 +00:00
|
|
|
\
|
2011-01-03 11:37:32 +00:00
|
|
|
%description -n %{basepkg}-devel\
|
|
|
|
%{?common_description}%{!?common_description:Haskell %{pkgname} library.}\
|
2010-01-09 15:58:27 +00:00
|
|
|
\
|
|
|
|
This package contains the development files.\
|
|
|
|
\
|
2011-01-03 11:37:32 +00:00
|
|
|
%post -n %{basepkg}-devel\
|
2010-04-12 14:52:34 +00:00
|
|
|
%ghc_pkg_recache\
|
2010-01-09 15:58:27 +00:00
|
|
|
\
|
2011-01-03 11:37:32 +00:00
|
|
|
%postun -n %{basepkg}-devel\
|
2010-04-12 14:52:34 +00:00
|
|
|
%ghc_pkg_recache\
|
2010-01-09 15:58:27 +00:00
|
|
|
\
|
2011-12-27 00:57:08 +00:00
|
|
|
%ghc_devel_files\
|
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\
|
2011-02-12 15:07:05 +00:00
|
|
|
%if %{undefined __debug_package}\
|
2011-01-22 12:48:18 +00:00
|
|
|
find %{buildroot} -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\
|
2011-02-12 15:07:05 +00:00
|
|
|
%global debug_package %{nil}\
|
2010-12-30 12:19:29 +00:00
|
|
|
%cabal_configure\
|
2010-06-26 08:53:39 +00:00
|
|
|
%cabal build
|
|
|
|
|
2011-01-03 11:37:32 +00:00
|
|
|
# ghc_lib_build [name] [version]
|
2010-12-30 12:19:29 +00:00
|
|
|
%ghc_lib_build()\
|
2011-02-12 15:07:05 +00:00
|
|
|
%global debug_package %{nil}\
|
2011-01-03 11:37:32 +00:00
|
|
|
%{?1:cd %1-%2}\
|
2011-01-22 12:48:18 +00:00
|
|
|
%cabal_configure %{!?without_prof:-p} %{?1:--docdir=%{_docdir}/ghc-%1-%2 --htmldir=%{ghclibdocdir}/%1-%2}\
|
2010-06-26 08:53:39 +00:00
|
|
|
%cabal build\
|
2011-11-17 05:36:50 +00:00
|
|
|
%if %{undefined without_haddock}\
|
2011-12-02 13:20:12 +00:00
|
|
|
%cabal haddock %{!?without_hscolour:%(if [ -x %{_bindir}/HsColour ]; then echo --hyperlink-source; fi)}\
|
2011-11-17 05:36:50 +00:00
|
|
|
%endif\
|
2010-12-30 12:19:29 +00:00
|
|
|
%{?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\
|
2011-09-13 01:14:17 +00:00
|
|
|
%if %{undefined ghc_bootstrapping}\
|
2011-01-23 05:05:38 +00:00
|
|
|
%global _use_internal_dependency_generator 0\
|
|
|
|
%global __find_requires %{_rpmconfigdir}/ghc-deps.sh --requires %{buildroot}%{ghclibdir}\
|
2011-09-13 01:14:17 +00:00
|
|
|
%endif\
|
2010-06-26 08:53:39 +00:00
|
|
|
%cabal_install\
|
|
|
|
%ghc_strip_dynlinked
|
|
|
|
|
2011-01-03 11:37:32 +00:00
|
|
|
# ghc_lib_install [name] [version]
|
2010-12-30 12:19:29 +00:00
|
|
|
%ghc_lib_install()\
|
2011-09-13 01:14:17 +00:00
|
|
|
%if %{undefined ghc_bootstrapping}\
|
2011-07-01 04:54:49 +00:00
|
|
|
%global _use_internal_dependency_generator 0\
|
|
|
|
%global __find_provides %{_rpmconfigdir}/ghc-deps.sh --provides %{buildroot}%{ghclibdir}\
|
|
|
|
%global __find_requires %{_rpmconfigdir}/ghc-deps.sh --requires %{buildroot}%{ghclibdir}\
|
2011-09-13 01:14:17 +00:00
|
|
|
%endif\
|
2011-01-03 11:37:32 +00:00
|
|
|
%{?1:cd %1-%2}\
|
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}
|
2011-06-17 08:00:17 +00:00
|
|
|
|
|
|
|
# skip shared and prof libs, documentation, and testsuite
|
2011-06-17 08:55:06 +00:00
|
|
|
# - without_hscolour needs to be set locally in the spec file
|
2011-06-17 08:00:17 +00:00
|
|
|
%ghc_bootstrap\
|
|
|
|
%global ghc_without_shared 1\
|
2011-06-17 08:55:06 +00:00
|
|
|
%global ghc_without_dynamic 1\
|
2011-06-17 08:00:17 +00:00
|
|
|
%global without_prof 1\
|
|
|
|
%global without_haddock 1\
|
2011-10-18 08:43:47 +00:00
|
|
|
%global without_manual 1\
|
2011-11-01 12:24:30 +00:00
|
|
|
%global without_testsuite 1\
|
2011-10-18 08:43:47 +00:00
|
|
|
# needs to be set also in ghc.spec\
|
|
|
|
%global ghc_bootstrapping 1
|
2011-09-13 01:14:17 +00:00
|
|
|
|
|
|
|
# skip prof libs, and documentation
|
|
|
|
# - without_hscolour needs to be set locally in the spec file
|
|
|
|
%ghc_test\
|
|
|
|
%global without_prof 1\
|
|
|
|
%global without_haddock 1\
|
|
|
|
%global without_manual 1
|