[ghc-rpm-macros/f13/master] backport secondary arch support from 0.10.52

Jens Petersen petersen at fedoraproject.org
Thu Mar 17 06:42:41 UTC 2011


commit 9536f392f2b047ca53ae951291a67a40c7fb03ff
Author: Jens Petersen <petersen at redhat.com>
Date:   Thu Mar 17 15:41:21 2011 +0900

    backport secondary arch support from 0.10.52
    
    - add ghc_pkg_obsoletes to binlib base lib package 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 archs
      (ie non main intel archs)
    - disable debuginfo for self
    - add cabal_configure_options to pass extra options to cabal_configure
    - drop with_devhelp since --html-help option gone from haddock-2.8.0

 ghc-rpm-macros.ghc  |   35 +++++++++++++++++++++--------------
 ghc-rpm-macros.spec |   34 +++++++++++++++++++++++++++-------
 2 files changed, 48 insertions(+), 21 deletions(-)
---
diff --git a/ghc-rpm-macros.ghc b/ghc-rpm-macros.ghc
index 0b2fc7c..0e15a1f 100644
--- a/ghc-rpm-macros.ghc
+++ b/ghc-rpm-macros.ghc
@@ -1,9 +1,12 @@
+# RPM Macros for packaging Haskell cabalized packages  -*-rpm-spec-*-
+# see https://fedoraproject.org/wiki/PackagingDrafts/Haskell for more details
+
 # "cabal"
 %cabal %{_bindir}/runghc Setup
 
 # configure
 %cabal_configure \
-%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} --htmldir=%{ghcdocdir} --libsubdir='$compiler/$pkgid' %{!?without_shared:--enable-shared} %{?with_dynamic:--ghc-option=-dynamic}
+%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} --htmldir=%{ghcdocdir} --libsubdir='$compiler/$pkgid' --ghc %{!?ghc_without_shared:--enable-shared} %{?cabal_configure_options}
 
 # install
 %cabal_install %cabal copy --destdir=${RPM_BUILD_ROOT} -v
@@ -23,7 +26,7 @@ pkgname=%{?1}%{!?1:%{pkg_name}} \
 basefile=ghc-${pkgname} \
 pkgnamever=${pkgname}-%{version} \
 rm -f ${basefile}.files ${basefile}-devel.files ${basefile}-prof.files ${basefile}-doc.files \
-%if 0%{!?without_shared:1} \
+%if %{undefined ghc_without_shared}\
 echo "%defattr(-,root,root,-)" > ${basefile}.files \
 if [ -d "${RPM_BUILD_ROOT}%{ghcpkgdir}" ]; then \
 echo "%dir %{ghcpkgdir}" >> ${basefile}.files \
@@ -32,7 +35,7 @@ fi \
 %endif \
 echo "%defattr(-,root,root,-)" > ${basefile}-devel.files \
 if [ -d "${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}" ]; then \
-  %{!?1:echo "%{_docdir}/%{name}-%{version}" >> ${basefile}%{?without_shared:-devel}.files} %{?1::} \
+  %{!?1:echo "%{_docdir}/%{name}-%{version}" >> ${basefile}%{?ghc_without_shared:-devel}.files} %{?1::} \
 fi \
 echo "%{ghcpkgbasedir}/package.conf.d/${pkgnamever}*.conf" >> ${basefile}-devel.files \
 if [ -d "${RPM_BUILD_ROOT}%{ghcpkgdir}" ]; then \
@@ -47,7 +50,7 @@ echo "%defattr(-,root,root,-)" > ${basefile}-doc.files \
 if [ -d "${RPM_BUILD_ROOT}%{ghcdocdir}" ]; then \
 echo "%{ghcdocdir}" >> ${basefile}-doc.files \
 fi \
-sed -i -e "s!${RPM_BUILD_ROOT}!!g" %{!?without_shared:${basefile}.files} ${basefile}-devel.files ${basefile}-prof.files \
+sed -i -e "s!${RPM_BUILD_ROOT}!!g" %{!?ghc_without_shared:${basefile}.files} ${basefile}-devel.files ${basefile}-prof.files \
 %{nil}
 
 # compiler version
@@ -64,7 +67,7 @@ install --mode=0644 %{?1}%{!?1:%{pkg_name}}-%{version}.conf $RPM_BUILD_ROOT%{ghc
 %ghc_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-%{-n:%{-n*}}%{!-n:%{pkg_name}} = %{-v:%{-v*}}%{!-v:%{version}}-%{release}\
 %endif
 
@@ -80,7 +83,7 @@ Requires:       ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}}-devel = %{-v:%{-v*}}%{!-v:%{v
 # ghc_lib_package [-n pkgname] [-c cdepslist] [-h pkgdepslist]
 %ghc_lib_package(n:c:h:)\
 %define ghc_pkg_name ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}}\
-%if 0%{!?without_shared:1}\
+%if %{undefined ghc_without_shared}\
 %files -n %{ghc_pkg_name} -f %{ghc_pkg_name}.files\
 %defattr(-,root,root,-)\
 %endif\
@@ -101,13 +104,14 @@ Summary:        %{?common_summary}%{!?common_summary:%{local_pkg_name} library}\
 Group:          System Environment/Libraries\
 %{-v:Version:        %{-v*}}\
 %{-l:License:        %{-l*}}\
+%{?ghc_pkg_obsoletes:Obsoletes:      %(echo "%{ghc_pkg_obsoletes}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1/g")}\
 \
 %description -n %{ghc_pkg_name}\
 %{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\
 \
-%if 0%{!?without_shared:1} \
+%if %{defined ghc_version} && %{undefined ghc_without_shared}\
 This package provides the shared library.\
-%endif \
+%endif\
 \
 %ghc_lib_package\
 %{nil}
@@ -205,27 +209,30 @@ This package contains the profiling library.\
 
 # ghc_strip_dynlinked
 %ghc_strip_dynlinked\
-%if 0%{!?__debug_package:1}\
+%if %{undefined __debug_package}\
 find $RPM_BUILD_ROOT -type f -exec sh -c "file {} | grep -q 'dynamically linked'" \\; -exec strip "{}" \\;\
 %endif
 
 # ghc_bin_build
 %ghc_bin_build\
-%cabal_configure --ghc\
+%global debug_package %{nil}\
+%cabal_configure %{!?ghc_without_dynamic:--ghc-option=-dynamic}\
 %cabal build
 
 # ghc_lib_build
 %ghc_lib_build\
-%cabal_configure --ghc -p\
+%global debug_package %{nil}\
+%cabal_configure %{!?without_prof:-p}\
 %cabal build\
-%cabal haddock %{?with_hscolour:--hyperlink-source} %{?with_devhelp:--haddock-option=--html-help=devhelp}
+%{!?without_haddock:%cabal haddock %{?with_hscolour:--hyperlink-source}}\
+%{nil}
 
-# ghc_bin_install
+# install bin package
 %ghc_bin_install\
 %cabal_install\
 %ghc_strip_dynlinked
 
-# ghc_lib_install
+# install lib package
 %ghc_lib_install\
 %cabal_install\
 %cabal_pkg_conf\
diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec
index 3e07601..e31c54a 100644
--- a/ghc-rpm-macros.spec
+++ b/ghc-rpm-macros.spec
@@ -1,5 +1,7 @@
+%global debug_package %{nil}
+
 Name:		ghc-rpm-macros
-Version:	0.7.4
+Version:	0.7.5
 Release:	1%{?dist}
 Summary:	Macros for building packages for GHC
 
@@ -13,9 +15,6 @@ URL:		https://fedoraproject.org/wiki/Haskell_SIG
 Source0:	ghc-rpm-macros.ghc
 Source1:	COPYING
 Source2:	AUTHORS
-BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
-BuildArch:	noarch
 
 %description
 A set of macros for building GHC packages following the Haskell Guidelines
@@ -32,13 +31,19 @@ echo no build stage needed
 
 
 %install
-rm -rf $RPM_BUILD_ROOT
 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
 
-%clean
-rm -rf $RPM_BUILD_ROOT
+# shared libraries are only supported on primary intel archs
+%%ghc_without_dynamic 1
+%%ghc_without_shared 1
+EOF
+%endif
 
 
 %files
@@ -48,6 +53,21 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Thu Mar 17 2011 Jens Petersen <petersen at redhat.com> - 0.7.5-1
+- backport secondary arch support from 0.10.52:
+- add ghc_pkg_obsoletes to binlib base lib package 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
+- add cabal_configure_options to pass extra options to cabal_configure
+- drop with_devhelp since --html-help option gone from haddock-2.8.0
+
 * Wed Dec 29 2010 Jens Petersen <petersen at redhat.com> - 0.7.4-1
 - revert disabling debug_package, since with redhat-rpm-config installed
   the behaviour depended on the position of ghc_lib_package in the spec file


More information about the scm-commits mailing list