[ghc-rpm-macros] disable shared and dynamic on secondary archs

Jens Petersen petersen at fedoraproject.org
Sat Feb 12 15:08:02 UTC 2011


commit 2c0b10d5d5efc8f75ed5896ecfd7036bdd74e610
Author: Jens Petersen <petersen at redhat.com>
Date:   Sun Feb 13 01:07:05 2011 +1000

    disable shared and dynamic on secondary archs
    
    - 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

 ghc-rpm-macros.ghc  |   23 ++++++++++++-----------
 ghc-rpm-macros.spec |   28 +++++++++++++++++++++++++---
 2 files changed, 37 insertions(+), 14 deletions(-)
---
diff --git a/ghc-rpm-macros.ghc b/ghc-rpm-macros.ghc
index 0b5bd29..8d71123 100644
--- a/ghc-rpm-macros.ghc
+++ b/ghc-rpm-macros.ghc
@@ -1,13 +1,13 @@
-# RPM Macros for packaging Haskell cabalized packages
+# RPM Macros for packaging Haskell cabalized packages  -*-rpm-spec-*-
 # see https://fedoraproject.org/wiki/PackagingDrafts/Haskell for more details
 
 # "cabal"
-%cabal [ -x Setup ] || ghc --make %{!?without_shared:%{!?without_dynamic:-dynamic}} 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} %{!?without_dynamic:--enable-executable-dynamic} %{?cabal_configure_options}
+%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} --htmldir=%{ghclibdocdir}/%{pkg_name}-%{version} --libsubdir='$compiler/$pkgid' --ghc %{!?ghc_without_shared:--enable-shared} %{!?ghc_without_dynamic:--enable-executable-dynamic} %{?cabal_configure_options}
 
 # install
 %cabal_install %cabal copy --destdir=%{buildroot} -v
@@ -28,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\
@@ -38,7 +38,7 @@ 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\
 echo "%{ghclibdir}/package.conf.d/%{pkgnamever}*.conf" >> %{basepkg}-devel.files\
@@ -53,7 +53,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
@@ -74,7 +74,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
 
@@ -88,7 +88,7 @@ Requires:       ghc-%{?pkg_name}%{!?pkg_name:%{pkgname}} = %{?pkgver}%{!?pkgver:
 %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\
@@ -113,8 +113,7 @@ Group:          System Environment/Libraries\
 \
 %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\
 \
@@ -195,17 +194,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\
+%global debug_package %{nil}\
 %cabal_configure\
 %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\
diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec
index ac66a97..ccf13cf 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.11.9
+Version:	0.11.10
 Release:	1%{?dist}
 Summary:	Macros for building packages for GHC
 
@@ -15,8 +17,6 @@ Source1:	COPYING
 Source2:	AUTHORS
 Source3:	ghc-deps.sh
 
-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
@@ -38,6 +38,17 @@ install -p -m 0644 %{SOURCE0} ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm/macros.ghc
 mkdir -p ${RPM_BUILD_ROOT}/%{_prefix}/lib/rpm
 install -p %{SOURCE3} ${RPM_BUILD_ROOT}/%{_prefix}/lib/rpm
 
+# 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}/%{_prefix}%{_sysconfdir}/rpm/macros.ghc <<EOF
+
+# shared libraries are only supported on main intel archs
+%%global ghc_without_dynamic 1
+%%global ghc_without_shared 1
+EOF
+%endif
+
 
 %files
 %defattr(-,root,root,-)
@@ -47,6 +58,17 @@ install -p %{SOURCE3} ${RPM_BUILD_ROOT}/%{_prefix}/lib/rpm
 
 
 %changelog
+* Sun Feb 13 2011 Jens Petersen <petersen at redhat.com> - 0.11.10-1
+- 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
+
 * Fri Feb 11 2011 Jens Petersen <petersen at redhat.com> - 0.11.9-1
 - revert "set without_shared and without_dynamic by default on secondary archs
   in cabal_bin_build and cabal_lib_build" change, since happening for all archs


More information about the scm-commits mailing list