[ghc-rpm-macros/el5] rebase to 0.10.61 from el6 branch

Jens Petersen petersen at fedoraproject.org
Sat Jun 2 06:50:46 UTC 2012


commit f9f8e2fc3f7514a969fd6aa72d3835c2e35a051c
Author: Jens Petersen <petersen at redhat.com>
Date:   Sat Jun 2 14:01:35 2012 +0900

    rebase to 0.10.61 from el6 branch

 .gitignore          |    1 -
 AUTHORS             |    6 +-
 ghc-deps.sh         |   59 +++++++++++
 ghc-rpm-macros.ghc  |  285 ++++++++++++++++++++++++++++-----------------------
 ghc-rpm-macros.spec |  145 ++++++++++++++++++++++----
 5 files changed, 345 insertions(+), 151 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index cfda0b0..e69de29 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +0,0 @@
-/ghc-rpm-macros-*/
diff --git a/AUTHORS b/AUTHORS
index 9725c64..adc72fc 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,3 +1,7 @@
+Maintainer:
+Jens Petersen <petersen at redhat.com>
+
+Initial implementation:
 Bryan O'Sullivan
 Jens Petersen
-Yaakov Nemoy
\ No newline at end of file
+Yaakov Nemoy
diff --git a/ghc-deps.sh b/ghc-deps.sh
new file mode 100755
index 0000000..9033a92
--- /dev/null
+++ b/ghc-deps.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+# find rpm provides and requires for Haskell GHC libraries
+
+# To use add the following lines to spec file:
+#   %define _use_internal_dependency_generator 0
+#   %define __find_requires /usr/lib/rpm/ghc-deps.sh --requires %{buildroot}%{ghclibdir}
+
+[ $# -ne 2 ] && echo "Usage: `basename $0` --requires %{buildroot}%{ghclibdir}" && exit 1
+
+MODE=$1
+PKGBASEDIR=$2
+PKGCONFDIR=$PKGBASEDIR/package.conf.d
+
+case $MODE in
+    --requires) FIELD=depends ;;
+    *) echo "`basename $0`: Need --requires" ; exit 1
+esac
+
+if [ -d "$PKGBASEDIR" ]; then
+  SHARED=$(find $PKGBASEDIR -type f -name '*.so')
+fi
+
+GHCVERSION=$(ghc --numeric-version)
+
+files=$(cat)
+
+#set -x
+
+for i in $files; do
+    LIB_FILE=$(echo $i | grep /libHS | egrep -v "$PKGBASEDIR/libHS")
+    if [ "$LIB_FILE" ]; then
+	if [ -d "$PKGCONFDIR" ]; then
+	    DEP=""
+	    case $LIB_FILE in
+		*.so) ;;
+		*_p.a) DEP=ghc-\\1-prof ;;
+		*.a) DEP=ghc-\\1-devel ;;
+	    esac
+	    if [ "$DEP" ]; then
+		PKGVER=$(echo $LIB_FILE | sed -e "s%$PKGBASEDIR/\([^/]\+\)/libHS.*%\1%")
+		HASHS=$(ghc-pkg -f $PKGCONFDIR field $PKGVER $FIELD | sed -e "s/^$FIELD: \+//")
+		for i in $HASHS; do
+		    case $i in
+			# ignore internal packages
+			base-3*) ;;
+			bin-package-db-*) ;;
+			ghc-binary-*) ;;
+			ghc-prim-*) ;;
+			integer-gmp-*) ;;
+			*-*) echo $i | sed -e "s/\(.*\)-\(.*\)-.*/$DEP = \2/" ;;
+			*) ;;
+		    esac
+		done
+	    fi
+	fi
+    fi
+done
+
+echo $files | tr [:blank:] '\n' | /usr/lib/rpm/rpmdeps $MODE
diff --git a/ghc-rpm-macros.ghc b/ghc-rpm-macros.ghc
index 2f99c79..1ad808b 100644
--- a/ghc-rpm-macros.ghc
+++ b/ghc-rpm-macros.ghc
@@ -1,108 +1,128 @@
+# 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
+
+# check ghc version was rebuilt against self
+%ghc_check_bootstrap\
+if [ ! "$(ghc --info | grep \\"Booter\\ version\\",\\"%{ghc_version}\\")" ]; then\
+  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."\
+  echo "To override set ghc_bootstrapping."\
+  echo "Aborting."\
+  exit 1\
+%endif\
+fi
 
 # configure
-%cabal_configure \
-%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} --htmldir=%{ghcdocdir} --libsubdir='$compiler/$pkgid' %{?with_shared:--enable-shared} %{?with_dynamic:--ghc-option=-dynamic}
+%cabal_configure\
+%ghc_check_bootstrap\
+%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} %{?cabal_configure_options}
 
 # install
-%cabal_install %cabal copy --destdir=${RPM_BUILD_ROOT} -v
+%cabal_install %cabal copy --destdir=%{buildroot} -v
 
 # root dir for ghc docs
 %ghcdocbasedir %{_docdir}/ghc/html
-# ghcdocdir [pkgname]
-%ghcdocdir() %{ghcdocbasedir}/libraries/%{?1}%{!?1:%{pkg_name}}-%{version}
+# libraries doc dir
+%ghclibdocdir %{ghcdocbasedir}/libraries
 # top library dir
-%ghcpkgbasedir %{_libdir}/ghc-%{ghc_version}
-# ghcpkgdir [pkgname]
-%ghcpkgdir() %{ghcpkgbasedir}/%{?1}%{!?1:%{pkg_name}}-%{version}
-
-# ghc_gen_filelists [pkgname]
-%ghc_gen_filelists() \
-pkgname=%{?1}%{!?1:%{pkg_name}} \
-basefile=ghc-${pkgname} \
-pkgnamever=${pkgname}-%{version} \
-rm -f ${basefile}.files ${basefile}-devel.files ${basefile}-prof.files \
-echo "%defattr(-,root,root,-)" > ${basefile}.files \
-if [ -d "${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}" ]; then \
-  %{!?1:echo "%{_docdir}/%{name}-%{version}" >> ${basefile}%{!?with_shared:-devel}.files} %{?1::} \
-fi \
-%if %{with shared} \
-if [ -d "${RPM_BUILD_ROOT}%{ghcpkgdir}" ]; then \
-echo "%dir %{ghcpkgdir}" >> ${basefile}.files \
-echo "%attr(755,root,root) %{ghcpkgdir}/libHS${pkgnamever}-ghc%{ghc_version}.so" >> ${basefile}.files \
-fi \
-%endif \
-echo "%defattr(-,root,root,-)" > ${basefile}-devel.files \
-echo "%{_libdir}/ghc-%{ghc_version}/package.conf.d/${pkgnamever}*.conf" >> ${basefile}-devel.files \
-if [ -d "${RPM_BUILD_ROOT}%{ghcpkgdir}" ]; then \
-find ${RPM_BUILD_ROOT}%{ghcpkgdir} -type d | sed "s/^/%dir /" >> ${basefile}-devel.files \
-find ${RPM_BUILD_ROOT}%{ghcpkgdir} ! \\( -type d -o -name "*_p.a" -o -name "*.p_hi" -o -name "libHS*.so" \\) >> ${basefile}-devel.files \
-fi \
-echo "%defattr(-,root,root,-)" > ${basefile}-prof.files \
-if [ -d "${RPM_BUILD_ROOT}%{ghcpkgdir}" ]; then \
-find ${RPM_BUILD_ROOT}%{ghcpkgdir} \\( -name "*_p.a" -o -name "*.p_hi" \\) >> ${basefile}-prof.files \
-fi \
-if [ -d "${RPM_BUILD_ROOT}%{ghcdocdir}" ]; then \
-echo "%{ghcdocdir}" >> ${basefile}-devel.files \
-fi \
-sed -i -e "s!${RPM_BUILD_ROOT}!!g" ${basefile}.files ${basefile}-devel.files ${basefile}-prof.files \
+%ghclibdir %{_libdir}/ghc-%{ghc_version}
+
+# ghc_gen_filelists [name] [version]
+%ghc_gen_filelists()\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define pkgver %{?2}%{!?2:%{version}}\
+%define pkgnamever %{pkgname}-%{pkgver}\
+%define basepkg ghc-%{pkgname}\
+%define pkgdir %{ghclibdir}/%{pkgnamever}\
+%define docdir %{ghclibdocdir}/%{pkgnamever}\
+rm -f %{basepkg}.files %{basepkg}-devel.files\
+%if %{undefined ghc_without_shared}\
+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\
+%if 0%{!?1:1}\
+if [ -d "%{buildroot}%{_docdir}/%{name}-%{version}" ]; then\
+  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\
+if [ -d "%{buildroot}%{pkgdir}" ]; then\
+find %{buildroot}%{pkgdir} -type d | sed "s/^/%dir /" >> %{basepkg}-devel.files\
+find %{buildroot}%{pkgdir} ! \\( -type d -o -name "libHS*.so" \\) >> %{basepkg}-devel.files\
+fi\
+if [ -d "%{buildroot}%{docdir}" ]; then\
+echo "%{docdir}" >> %{basepkg}-devel.files\
+fi\
+sed -i -e "s!%{buildroot}!!g" %{!?ghc_without_shared:%{basepkg}.files} %{basepkg}-devel.files\
 %{nil}
 
 # compiler version
 %ghc_version %{!?ghc_version_override:%(ghc --numeric-version)}%{?ghc_version_override}
 
 # create and install package.conf file
-# cabal_pkg_conf [pkgname]
-%cabal_pkg_conf \
-%cabal register --gen-pkg-config \
-mkdir -p $RPM_BUILD_ROOT%{_libdir}/ghc-%{ghc_version}/package.conf.d \
-install --mode=0644 %{?1}%{!?1:%{pkg_name}}-%{version}.conf $RPM_BUILD_ROOT%{_libdir}/ghc-%{ghc_version}/package.conf.d
+# cabal_pkg_conf [name] [version]
+%cabal_pkg_conf()\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define pkgver %{?2}%{!?2:%{version}}\
+%define pkgnamever %{pkgname}-%{pkgver}\
+%cabal register --gen-pkg-config\
+mkdir -p %{buildroot}%{ghclibdir}/package.conf.d\
+install --mode=0644 %{pkgnamever}.conf %{buildroot}%{ghclibdir}/package.conf.d\
+%{nil}
 
 # devel pkg basic requires
-%ghc_requires Requires:       ghc = %{ghc_version}\
+%ghc_devel_requires Requires:       ghc = %{ghc_version}\
 Requires(post): ghc = %{ghc_version}\
 Requires(postun): ghc = %{ghc_version}\
-%if %{with shared}\
-Requires:       ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}} = %{-v:%{-v*}}%{!-v:%{version}}-%{release}\
+%if %{undefined ghc_without_shared}\
+Requires:       ghc-%{?pkg_name}%{!?pkg_name:%{pkgname}} = %{?pkgver}%{!?pkgver:%{version}}-%{release}\
 %endif
 
-# doc pkg basic requires
-%ghc_doc_requires Requires:       ghc-doc = %{ghc_version}\
-Requires(post): ghc-doc = %{ghc_version}\
-Requires(postun): ghc-doc = %{ghc_version}
-
-# prof pkg basic requires
-%ghc_prof_requires Requires:       ghc-prof = %{ghc_version}\
-Requires:       ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}}-devel = %{-v:%{-v*}}%{!-v:%{version}}-%{release}
-
-# ghc_lib_package [-n pkgname] [-c cdepslist] [-h pkgdepslist] [-o obsolete-docver]
-%ghc_lib_package(n:c:h:o:)\
-%define ghc_pkg_name %{-n:ghc-%{-n*}}%{!-n:ghc-%{pkg_name}}\
-%if %{with shared}\
-%files -n %{ghc_pkg_name} -f %{ghc_pkg_name}.files\
-%defattr(-,root,root,-)\
+# ghc_lib_package [-c cdepslist] [-h pkgdepslist] (-o deprecated no-op)
+%ghc_lib_package(c:h:o:)\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define pkgver %{?2}%{!?2:%{version}}\
+%define pkgnamever %{pkgname}-%{pkgver}\
+%define basepkg ghc-%{pkgname}\
+%if %{undefined ghc_without_shared}\
+%files -n %{basepkg} -f %{basepkg}.files\
 %endif\
 \
 %ghc_package_devel\
-\
-%ghc_package_prof\
 %{nil}
 
-# ghc_binlib_package [-n pkgname] [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-v version] [-o obsolete-docver]
-%ghc_binlib_package(n:c:h:l:v:o:)\
-%define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\
-%define ghc_pkg_name ghc-%{local_pkg_name}\
-%package -n %{ghc_pkg_name}\
-Summary:        %{?common_summary}%{!?common_summary:%{local_pkg_name} library}\
+# ghc_binlib_package [-c cdepslist] [-h pkgdepslist] [-l licensetag] (-o deprecated no-op) [-x] [name] [version]
+%ghc_binlib_package(c:h:l:o:x)\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define pkgver %{?2}%{!?2:%{version}}\
+%define pkgnamever %{pkgname}-%{pkgver}\
+%{!-x:%{?1:%global ghc_packages_list %{?ghc_packages_list} %{pkgnamever}}}\
+%define basepkg ghc-%{pkgname}\
+%package -n %{basepkg}\
+Summary:        %{?common_summary}%{!?common_summary:Haskell %{pkgname} library}\
 Group:          System Environment/Libraries\
-%{-v:Version:        %{-v*}}\
+%{?1:Version:        %{pkgver}}\
 %{-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.}\
-\
+%description -n %{basepkg}\
+%{?common_description}%{!?common_description:Haskell %{pkgname} library.}\
+%if %{defined ghc_version} && %{undefined ghc_without_shared}\
 This package provides the shared library.\
+%endif\
 \
 %ghc_lib_package\
 %{nil}
@@ -112,88 +132,99 @@ This package provides the shared library.\
 # for docs post and postun
 %ghc_reindex_haddock ( cd %{ghcdocbasedir}/libraries && [ -x "./gen_contents_index" ] && ./gen_contents_index ) || :
 
-# ghc_package_devel [-n pkgname] [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-v version] [-o obsolete-docver]
-%ghc_package_devel(n:c:h:l:v:o:)\
-%define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\
-%define ghc_pkg_name ghc-%{local_pkg_name}\
-%package -n %{ghc_pkg_name}-devel\
-Summary:        %{?common_summary}%{!?common_summary:%{local_pkg_name} library} development files\
+# ghc_package_devel [-c cdepslist] [-h pkgdepslist] [-l licensetag] (-o deprecated no-op) [name] [version]
+%ghc_package_devel(c:h:l:o:)\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define pkgver %{?2}%{!?2:%{version}}\
+%define pkgnamever %{pkgname}-%{pkgver}\
+%define basepkg ghc-%{pkgname}\
+%package -n %{basepkg}-devel\
+Summary:        %{?common_summary}%{!?common_summary:Haskell %{pkgname} library} development files\
 Group:          Development/Libraries\
-%{-v:Version:        %{-v*}}\
+%{?1:Version:        %{pkgver}}\
 %{-l:License:        %{-l*}}\
-%{?ghc_requires}\
-%{?ghc_doc_requires}\
-%{!-h:%{?ghc_pkg_deps:Requires:       %{ghc_pkg_deps}}}\
+%{?ghc_devel_requires}\
 %{-h:Requires:       %{-h*}}\
-%{!-c:%{?ghc_pkg_c_deps:Requires:       %{ghc_pkg_c_deps}}}\
+%{?ghc_pkg_c_deps:Requires:       %{ghc_pkg_c_deps}}\
 %{-c:Requires:       %{-c*}}\
-%{-o:Obsoletes:      %{ghc_pkg_name}-doc < %{-o*}}\
-Provides:       %{ghc_pkg_name}-doc = %{version}-%{release}\
+%{?ghc_pkg_obsoletes:Obsoletes:      %{ghc_pkg_obsoletes}}\
+%{?ghc_pkg_obsoletes:Obsoletes:      %(echo "%{ghc_pkg_obsoletes}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-doc/g")}\
+Obsoletes:      %{basepkg}-doc < %{pkgver}-%{release}\
+Provides:       %{basepkg}-doc = %{pkgver}-%{release}\
+Obsoletes:      %{basepkg}-prof < %{pkgver}-%{release}\
+Provides:       %{basepkg}-prof = %{pkgver}-%{release}\
 \
-%description -n %{ghc_pkg_name}-devel\
-%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\
+%description -n %{basepkg}-devel\
+%{?common_description}%{!?common_description:Haskell %{pkgname} library.}\
 \
 This package contains the development files.\
 \
-%post -n %{ghc_pkg_name}-devel\
+%post -n %{basepkg}-devel\
 %ghc_pkg_recache\
 %ghc_reindex_haddock\
 \
-%postun -n %{ghc_pkg_name}-devel\
+%postun -n %{basepkg}-devel\
 %ghc_pkg_recache\
 %ghc_reindex_haddock\
 \
-%files -n %{ghc_pkg_name}-devel -f %{ghc_pkg_name}-devel.files\
-%defattr(-,root,root,-)\
-%{nil}
-
-# ghc_package_prof [-n pkgname] [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-v version]
-%ghc_package_prof(n:h:l:v:)\
-%define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\
-%define ghc_pkg_name ghc-%{local_pkg_name}\
-%package -n %{ghc_pkg_name}-prof\
-Summary:        Profiling libraries for %{?common_summary}%{!?common_summary:%{local_pkg_name}}\
-Group:          Development/Libraries\
-%{-v:Version:        %{-v*}}\
-%{-l:License:        %{-l*}}\
-%{?ghc_prof_requires}\
-%{!-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")}\
-\
-%description -n %{ghc_pkg_name}-prof\
-%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\
-\
-This package contains the profiling library.\
-\
-%files -n %{ghc_pkg_name}-prof -f %{ghc_pkg_name}-prof.files\
-%defattr(-,root,root,-)\
+%files -n %{basepkg}-devel -f %{basepkg}-devel.files\
 %{nil}
 
 # ghc_strip_dynlinked
 %ghc_strip_dynlinked\
-%if 0%{!?__debug_package:1}\
-find $RPM_BUILD_ROOT -type f -exec sh -c "file {} | grep -q 'dynamically linked'" \\; -exec strip "{}" \\;\
+%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 --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\
+# 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\
-%cabal haddock %{?with_hscolour:--hyperlink-source}
+%if %{undefined without_haddock}\
+%cabal haddock $(if [ -x %{_bindir}/HsColour ]; then echo --hyperlink-source; fi)\
+%endif\
+%{?1:cd -}\
+%{nil}
 
-# ghc_bin_install
+# install bin package
 %ghc_bin_install\
 %cabal_install\
 %ghc_strip_dynlinked
 
-# ghc_lib_install
-%ghc_lib_install\
+# ghc_lib_install [name] [version]
+%ghc_lib_install()\
+%if %{undefined ghc_bootstrapping}\
+%global _use_internal_dependency_generator 0\
+%global __find_requires %{_rpmconfigdir}/ghc-deps.sh --requires %{buildroot}%{ghclibdir}\
+%endif\
+%{?1:cd %1-%2}\
 %cabal_install\
 %cabal_pkg_conf\
+%{?1:cd -}\
 %ghc_gen_filelists\
-%ghc_strip_dynlinked
+%{!?1:%ghc_strip_dynlinked}\
+%{nil}
+
+# skip shared and prof libs, documentation, and testsuite
+# - without_hscolour needs to be set locally in the spec file
+%ghc_bootstrap\
+%global ghc_without_shared 1\
+%global ghc_without_dynamic 1\
+%global without_prof 1\
+%global without_haddock 1\
+%global without_manual 1
+
+# 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
diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec
index 8e788bf..07af3b6 100644
--- a/ghc-rpm-macros.spec
+++ b/ghc-rpm-macros.spec
@@ -1,26 +1,30 @@
-Name:		ghc-rpm-macros
-Version:	0.8.1
-Release:	1%{?dist}
-Summary:	Macros for building packages for GHC
+%global debug_package %{nil}
 
-Group:		Development/Libraries
-License:	GPLv3
-URL:		https://fedoraproject.org/wiki/Haskell_SIG
+%global macros_file %{_sysconfdir}/rpm/macros.ghc
+
+Name:           ghc-rpm-macros
+Version:        0.10.61
+Release:        1%{?dist}
+Summary:        Macros for building packages for GHC
+
+Group:          Development/Libraries
+License:        GPLv3
+URL:            https://fedoraproject.org/wiki/Haskell_SIG
 
 # This is a Fedora maintained package which is specific to
 # our distribution.  Thus the source is only available from
 # within this srpm.
-Source0:	ghc-rpm-macros.ghc
-Source1:	COPYING
-Source2:	AUTHORS
-BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
-BuildArch:	noarch
+Source0:        ghc-rpm-macros.ghc
+Source1:        COPYING
+Source2:        AUTHORS
+Source3:        ghc-deps.sh
+Requires:       redhat-rpm-config
 
 %description
 A set of macros for building GHC packages following the Haskell Guidelines
-of the Haskell SIG. This package probably shouldn't be installed on its own
-as GHC is needed in order to make use of these macros.
+of the Fedora Haskell SIG.  ghc needs to be installed in order to make use of
+these macros.
+
 
 %prep
 %setup -c -T
@@ -32,24 +36,121 @@ echo no build stage needed
 
 
 %install
-rm -rf $RPM_BUILD_ROOT
-mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm
-cp -p %{SOURCE0} ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm/macros.ghc
+install -p -D -m 0644 %{SOURCE0} ${RPM_BUILD_ROOT}/%{macros_file}
+
+install -p -D -m 0755 %{SOURCE3} %{buildroot}/%{_prefix}/lib/rpm/ghc-deps.sh
 
+# this is why this package is now arch-dependent:
+# turn off shared libs and dynamic linking on secondary archs
+%ifnarch %{ix86} x86_64
+cat >> %{buildroot}/%{macros_file} <<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
 %defattr(-,root,root,-)
 %doc COPYING AUTHORS
-%config(noreplace) %{_sysconfdir}/rpm/macros.ghc
+%config(noreplace) %{macros_file}
+%{_prefix}/lib/rpm/ghc-deps.sh
 
 
 %changelog
+* Thu Nov 17 2011 Jens Petersen <petersen at redhat.com> - 0.10.61-1
+- test for HsColour directly when running "cabal haddock" instead of
+  checking for without_haddock
+
+* Fri Sep 30 2011 Jens Petersen <petersen at redhat.com> - 0.10.60-1
+- fix devel subpackage's prof and doc obsoletes and provides versions
+  for multiple lib packages like ghc (reported by Henrik Nordström)
+
+* Tue Sep 13 2011 Jens Petersen <petersen at redhat.com> - 0.10.59-1
+- do not setup ghc-deps.sh when ghc_bootstrapping
+- add ghc_test build config
+- drop redundant defattr from filelists
+- move dependency generator setup from ghc_package_devel to ghc_lib_install
+- ghc_bootstrap is now a macro providing bootstrap config
+- add ghc_check_bootstrap
+
+* Mon Jun 27 2011 Jens Petersen <petersen at redhat.com> - 0.10.58-1
+- add requires for redhat-rpm-config for ghc_arches
+
+* Wed Jun 22 2011 Jens Petersen <petersen at redhat.com> - 0.10.57-1
+- ghc-deps.sh: also ignore base-3 since it is part of ghc-base
+
+* Mon Jun 13 2011 Jens Petersen <petersen at redhat.com> - 0.10.56-1
+- merge prof subpackages into devel to simplify packaging
+- condition --htmldir on pkg_name
+
+* Mon May  9 2011 Jens Petersen <petersen at redhat.com> - 0.10.55-1
+- include ghc_pkg_c_deps even when -c option used
+
+* Mon May  9 2011 Jens Petersen <petersen at redhat.com> - 0.10.54-1
+- ghc-deps.sh: ignore private ghc lib deps
+- macros.ghc: drop ghc-prof requires from ghc_prof_requires
+
+* Sat May  7 2011 Jens Petersen <petersen at redhat.com> - 0.10.53-1
+- backport ghc-deps.sh rpm dependency script for automatic versioned
+  library dependencies (without hashes)
+- drop ghc_pkg_deps from ghc_package_devel and ghc_package_prof since
+  ghc-deps.sh generates better inter-package dependencies already
+
+* Wed Mar 16 2011 Jens Petersen <petersen at 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 at redhat.com> - 0.10.51-1
+- ghc_binlib_package's -x option does not take an arg
+
+* Sat Jan 29 2011 Jens Petersen <petersen at redhat.com> - 0.10.50-1
+- merge subpackaging support from 0.11.4:
+- drop ghcdocdir and ghcpkgdir
+- new ghclibdocdir
+- improve prof summary and description
+- add without_prof and without_haddock option macros
+- add ghc_binlib_package option to exclude package from ghc_packages_list
+- condition lib base package additional description for srpm
+- use buildroot instead of RPM_BUILD_ROOT
+- rename ghcpkgbasedir to ghclibdir
+- move name and version macro options (-n and -v) to optional args
+- ghc_gen_filelists, ghc_lib_build, ghc_lib_install, cabal_pkg_conf
+  now take optional "[name] [version]" args
+- drop with_devhelp since --html-help option gone from haddock-2.8.0
+- rename ghc_requires to ghc_devel_requires
+- drop ghc_doc_requires
+
+* Wed Dec 29 2010 Jens Petersen <petersen at redhat.com> - 0.8.3-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
+  (reported by narasim)
+
+* Thu Sep 30 2010 Jens Petersen <petersen at redhat.com> - 0.8.2-1
+- add ghc_pkg_obsoletes for obsoleting old packages
+- always obsolete -doc packages, but keep -o for now for backward compatibility
+- disable debuginfo by default
+- make shared and hscolour default
+- use without_shared and without_hscolour to disable them
+- fix without_shared build so it actually works
+- use ghcpkgbasedir
+
 * Fri Jul 16 2010 Jens Petersen <petersen at redhat.com> - 0.8.1-1
-- fix ghc_strip_dynlinked for no dynlinked files
+- fix ghc_strip_dynlinked when no dynlinked files
 - devel should provide doc also when not obsoleting
 
 * Fri Jul 16 2010 Jens Petersen <petersen at redhat.com> - 0.8.0-1


More information about the scm-commits mailing list