backport secondary arch support and ghc subpackaging fixes from 0.11.12

This commit is contained in:
Jens Petersen 2011-03-16 18:56:30 +09:00
parent 88482e4ba7
commit 15ee332aeb
2 changed files with 53 additions and 15 deletions

View File

@ -1,9 +1,13 @@
# RPM Macros for packaging Haskell cabalized packages -*-rpm-spec-*-
# see https://fedoraproject.org/wiki/PackagingDrafts/Haskell for more details
# "cabal"
%cabal %{_bindir}/runghc Setup
%cabal [ -x Setup ] || ghc --make %{!?ghc_without_shared:%{!?ghc_without_dynamic:-dynamic}} Setup\
./Setup
# configure
%cabal_configure \
%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} --htmldir=%{ghclibdocdir}/%{pkg_name}-%{version} --libsubdir='$compiler/$pkgid' --ghc %{!?without_shared:--enable-shared} %{?with_dynamic:--ghc-option=-dynamic}
%cabal_configure\
%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} --htmldir=%{ghclibdocdir}/%{pkg_name}-%{version} --libsubdir='$compiler/$pkgid' --ghc %{!?ghc_without_shared:--enable-shared} %{?cabal_configure_options}
# install
%cabal_install %cabal copy --destdir=%{buildroot} -v
@ -24,7 +28,7 @@
%define pkgdir %{ghclibdir}/%{pkgnamever}\
%define docdir %{ghclibdocdir}/%{pkgnamever}\
rm -f %{basepkg}.files %{basepkg}-devel.files %{basepkg}-prof.files\
%if 0%{!?without_shared:1}\
%if %{undefined ghc_without_shared}\
echo "%defattr(-,root,root,-)" > %{basepkg}.files\
if [ -d "%{buildroot}%{pkgdir}" ]; then\
echo "%dir %{pkgdir}" >> %{basepkg}.files\
@ -34,7 +38,12 @@ fi\
echo "%defattr(-,root,root,-)" > %{basepkg}-devel.files\
%if 0%{!?1:1}\
if [ -d "%{buildroot}%{_docdir}/%{name}-%{version}" ]; then\
echo "%{_docdir}/%{name}-%{version}" >> %{basepkg}%{?without_shared:-devel}.files\
echo "%{_docdir}/%{name}-%{version}" >> %{basepkg}%{?ghc_without_shared:-devel}.files\
fi\
%endif\
%if 0%{?1:1}\
if [ -d "%{buildroot}%{_docdir}/ghc-%{pkgnamever}" ]; then\
echo "%{_docdir}/ghc-%{pkgnamever}" >> %{basepkg}%{?ghc_without_shared:-devel}.files\
fi\
%endif\
echo "%{ghclibdir}/package.conf.d/%{pkgnamever}*.conf" >> %{basepkg}-devel.files\
@ -49,7 +58,7 @@ fi\
if [ -d "%{buildroot}%{docdir}" ]; then\
echo "%{docdir}" >> %{basepkg}-devel.files\
fi\
sed -i -e "s!%{buildroot}!!g" %{!?without_shared:%{basepkg}.files} %{basepkg}-devel.files %{basepkg}-prof.files\
sed -i -e "s!%{buildroot}!!g" %{!?ghc_without_shared:%{basepkg}.files} %{basepkg}-devel.files %{basepkg}-prof.files\
%{nil}
# compiler version
@ -70,7 +79,7 @@ install --mode=0644 %{pkgnamever}.conf %{buildroot}%{ghclibdir}/package.conf.d\
%ghc_devel_requires Requires: ghc = %{ghc_version}\
Requires(post): ghc = %{ghc_version}\
Requires(postun): ghc = %{ghc_version}\
%if 0%{!?without_shared:1}\
%if %{undefined ghc_without_shared}\
Requires: ghc-%{?pkg_name}%{!?pkg_name:%{pkgname}} = %{?pkgver}%{!?pkgver:%{version}}-%{release}\
%endif
@ -85,7 +94,7 @@ Requires: ghc-%{?pkg_name}%{!?pkg_name:%{pkgname}}-devel = %{?pkgver}%{!?p
%define pkgver %{?2}%{!?2:%{version}}\
%define pkgnamever %{pkgname}-%{pkgver}\
%define basepkg ghc-%{pkgname}\
%if 0%{!?without_shared:1}\
%if %{undefined ghc_without_shared}\
%files -n %{basepkg} -f %{basepkg}.files\
%defattr(-,root,root,-)\
%endif\
@ -107,11 +116,11 @@ Summary: %{?common_summary}%{!?common_summary:Haskell %{pkgname} library}
Group: System Environment/Libraries\
%{?1:Version: %{pkgver}}\
%{-l:License: %{-l*}}\
%{?ghc_pkg_obsoletes:Obsoletes: %(echo "%{ghc_pkg_obsoletes}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1/g")}\
\
%description -n %{basepkg}\
%{?common_description}%{!?common_description:Haskell %{pkgname} library.}\
\
%if 0%{?ghc_version:%{!?without_shared:1}}\
%if %{defined ghc_version} && %{undefined ghc_without_shared}\
This package provides the shared library.\
%endif\
\
@ -188,17 +197,19 @@ This package contains the profiling development files.\
# ghc_strip_dynlinked
%ghc_strip_dynlinked\
%if 0%{!?__debug_package:1}\
%if %{undefined __debug_package}\
find %{buildroot} -type f -exec sh -c "file {} | grep -q 'dynamically linked'" \\; -exec strip "{}" \\;\
%endif
# ghc_bin_build
%ghc_bin_build\
%cabal_configure\
%global debug_package %{nil}\
%cabal_configure %{!?ghc_without_dynamic:--ghc-option=-dynamic}\
%cabal build
# ghc_lib_build [name] [version]
%ghc_lib_build()\
%global debug_package %{nil}\
%{?1:cd %1-%2}\
%cabal_configure %{!?without_prof:-p} %{?1:--docdir=%{_docdir}/ghc-%1-%2 --htmldir=%{ghclibdocdir}/%1-%2}\
%cabal build\

View File

@ -1,5 +1,7 @@
%global debug_package %{nil}
Name: ghc-rpm-macros
Version: 0.10.51
Version: 0.10.52
Release: 1%{?dist}
Summary: Macros for building packages for GHC
@ -14,8 +16,6 @@ Source0: ghc-rpm-macros.ghc
Source1: COPYING
Source2: AUTHORS
BuildArch: noarch
%description
A set of macros for building GHC packages following the Haskell Guidelines
of the Fedora Haskell SIG. This package probably shouldn't be installed on
@ -34,6 +34,17 @@ echo no build stage needed
mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm
install -p -m 0644 %{SOURCE0} ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm/macros.ghc
# this is why this package is now arch-dependent:
# turn off shared libs and dynamic linking on secondary archs
%ifnarch %{ix86} x86_64
cat >> ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm/macros.ghc <<EOF
# shared libraries are only supported on primary intel archs
%%ghc_without_dynamic 1
%%ghc_without_shared 1
EOF
%endif
%files
%defattr(-,root,root,-)
@ -42,6 +53,22 @@ install -p -m 0644 %{SOURCE0} ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm/macros.ghc
%changelog
* Wed Mar 16 2011 Jens Petersen <petersen@redhat.com> - 0.10.52-1
- backport ghc fixes and secondary arch support from 0.11.12:
- add ghc_pkg_obsoletes to binlib base lib package too
- add docdir when subpackaging packages too
- this package is now arch-dependent
- rename without_shared to ghc_without_shared and without_dynamic
to ghc_without_dynamic so that they can be globally defined for
secondary archs without shared libs
- use %%undefined macro
- disable debug_package in ghc_bin_build and ghc_lib_build
- set ghc_without_shared and ghc_without_dynamic on secondary
(ie non main intel archs)
- disable debuginfo for self
- only link Setup dynamically if without_shared and without_dynamic not set
- add cabal_configure_options to pass extra options to cabal_configure
* Fri Feb 4 2011 Jens Petersen <petersen@redhat.com> - 0.10.51-1
- ghc_binlib_package's -x option does not take an arg