[ghc-rpm-macros/f19] bcond --enable-tests, GPLv3+, use _rpmconfigdir, macros.ghc-extra

Jens Petersen petersen at fedoraproject.org
Sat May 17 08:01:41 UTC 2014


commit f293e1525c3a9a0840d7d016f1b0bec1bba629d9
Author: Jens Petersen <petersen at redhat.com>
Date:   Sat May 17 17:01:22 2014 +0900

    bcond --enable-tests, GPLv3+, use _rpmconfigdir, macros.ghc-extra
    
    - do bcond cabal configure --enable-tests also for Bin packages
    - enable configure bcond check for tests
    - set Url field when generating subpackages
    - update license tag to GPLv3+
    - handle no _pkgdocdir in RHEL7 and docdir path different to F20+
    - abort ghc_fix_dynamic_rpath if no chrpath
    - Install macros to %{_rpmconfigdir}/macros.d.
    - set datasubdir in cabal_configure for ghc-7.8
    - move spec section metamacros and multiple library packaging macros still
      needed for ghc and haskell-platform to macros.ghc-extra

 ghc-rpm-macros.ghc       |  139 ++--------------------------------------------
 ghc-rpm-macros.ghc-extra |  114 +++++++++++++++++++++++++++++++++++++
 ghc-rpm-macros.spec      |   30 ++++++++--
 3 files changed, 142 insertions(+), 141 deletions(-)
---
diff --git a/ghc-rpm-macros.ghc b/ghc-rpm-macros.ghc
index 265cc23..cad130a 100644
--- a/ghc-rpm-macros.ghc
+++ b/ghc-rpm-macros.ghc
@@ -21,7 +21,7 @@ fi
 # configure
 %cabal_configure\
 %ghc_check_bootstrap\
-%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_pkgdocdir} --libsubdir='$compiler/$pkgid' --ghc %{!?ghc_without_dynamic:--enable-executable-dynamic} %{?cabal_configure_options} $cabal_configure_extra_options
+%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}} --libsubdir='$compiler/$pkgid' --datasubdir='$pkgid' --ghc %{!?ghc_without_dynamic:--enable-executable-dynamic} %{?with_tests:--enable-tests} %{?cabal_configure_options} $cabal_configure_extra_options
 
 # install
 %cabal_install %cabal copy --destdir=%{buildroot} -v
@@ -79,138 +79,7 @@ echo "%*" >> %{basepkg}.files
 %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_devel_requires Requires:       ghc-compiler = %{ghc_version}\
-Requires(post): ghc-compiler = %{ghc_version}\
-Requires(postun): ghc-compiler = %{ghc_version}\
-%if 0%{!?-m:1}\
-Requires:       ghc-%{?pkg_name}%{!?pkg_name:%{pkgname}} = %{?pkgver}%{!?pkgver:%{version}}-%{release}\
-%endif
-
-%ghc_shared_files\
-%files -n %{basepkg} -f %{basepkg}.files\
-%{?base_doc_files:%doc %base_doc_files}\
-%{nil}
-
-# ghc_lib_package [-c cdepslist] [-h pkgdepslist]
-%ghc_lib_package(c:h:)\
-%define pkgname %{?1}%{!?1:%{pkg_name}}\
-%define basepkg ghc-%{pkgname}\
-%ghc_shared_files\
-\
-%ghc_package_devel\
-%{nil}
-
-# ghc_package [-l licensetag] [name] [version]
-%ghc_package(l:)\
-%define pkgname %{?1}%{!?1:%{pkg_name}}\
-%define pkgver %{?2}%{!?2:%{version}}\
-%define basepkg ghc-%{pkgname}\
-%package -n %{basepkg}\
-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")}
-
-# ghc_description [name] [version]
-%ghc_description()\
-%define pkgname %{?1}%{!?1:%{pkg_name}}\
-%define basepkg ghc-%{pkgname}\
-%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_subpackage [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-x] [name] [version]
-%ghc_lib_subpackage(c:h:l: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}\
-%ghc_package\
-\
-%ghc_description\
-\
-%ghc_lib_package\
-%{nil}
-
-# (deprecated) for docs post and postun
-%ghc_reindex_haddock :
-
-%ghc_devel_files\
-%files -n %{basepkg}-devel -f %{basepkg}-devel.files\
-%{?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}
-
-# ghc_devel_package [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-m] [name] [version]
-#  -m : meta-package
-%ghc_devel_package(c:h:l:m)\
-%define pkgname %{?1}%{!?1:%{pkg_name}}\
-%define pkgver %{?2}%{!?2:%{version}}\
-%define basepkg ghc-%{pkgname}\
-%package -n %{basepkg}-devel\
-Summary:        %{?common_summary}%{!?common_summary:Haskell %{pkgname} library} development files\
-Group:          Development/Libraries\
-%{?1:Version:        %{pkgver}}\
-%{-l:License:        %{-l*}}\
-%{?ghc_devel_requires}\
-%{-h:Requires:       %{-h*}}\
-%{?ghc_pkg_c_deps:Requires:       %{ghc_pkg_c_deps}}\
-%{-c:Requires:       %{-c*}}\
-%{?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}\
-%if %{undefined without_prof}\
-Provides:       %{basepkg}-prof = %{pkgver}-%{release}\
-%endif
-
-# ghc_devel_description
-%ghc_devel_description()\
-%define pkgname %{?1}%{!?1:%{pkg_name}}\
-%define basepkg ghc-%{pkgname}\
-%description -n %{basepkg}-devel\
-%{?common_description}%{!?common_description:Haskell %{pkgname} library.}\
-\
-This package contains the development files.
-
-# ghc_devel_post_postun
-%ghc_devel_post_postun()\
-%define pkgname %{?1}%{!?1:%{pkg_name}}\
-%define basepkg ghc-%{pkgname}\
-%post -n %{basepkg}-devel\
-%ghc_pkg_recache\
-\
-%postun -n %{basepkg}-devel\
-%ghc_pkg_recache
-
-# ghc_package_devel [-c cdepslist] [-h pkgdepslist] [-l licensetag] [name] [version]
-%ghc_package_devel(c:h:l:)\
-%define pkgname %{?1}%{!?1:%{pkg_name}}\
-%define basepkg ghc-%{pkgname}\
-%ghc_devel_package\
-\
-%ghc_devel_description\
-\
-%ghc_devel_post_postun\
-\
-%ghc_devel_files\
+install -D --mode=0644 %{pkgnamever}.conf %{buildroot}%{ghclibdir}/package.conf.d/%{pkgnamever}.conf\
 %{nil}
 
 # ghc_bin_build
@@ -268,13 +137,15 @@ fi
 %{nil}
 
 # ghc_fix_dynamic_rpath prog ...
+# (assumes cwd = pkg_name!)
 %ghc_fix_dynamic_rpath()\
 %if %{undefined ghc_without_dynamic}\
+if ! type chrpath > /dev/null; then exit 1; fi\
 PDIR=$(cd ..; pwd)\
 for i in %*; do\
   PROG=%{buildroot}%{_bindir}/$i\
   if [ -x "$PROG" ]; then\
-    RPATH=$(chrpath $PROG| sed -e "s@^$PROG: RPATH=@@")\
+    RPATH=$(chrpath $PROG | sed -e "s@^$PROG: RPATH=@@")\
     case $RPATH in\
          *$PDIR*)\
          NEWRPATH=$(echo $RPATH | sed -e "s@$PDIR@%{ghclibdir}@g" -e "s@/dist/build@@g")\
diff --git a/ghc-rpm-macros.ghc-extra b/ghc-rpm-macros.ghc-extra
new file mode 100644
index 0000000..a0b3f6b
--- /dev/null
+++ b/ghc-rpm-macros.ghc-extra
@@ -0,0 +1,114 @@
+# RPM Macros for packaging Haskell packages with multiple libs  -*-rpm-spec-*-
+
+# ghc_lib_subpackage [-c cdepslist] [-l licensetag] [-x] [name] [version]
+%ghc_lib_subpackage(c:l: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}\
+%ghc_package\
+\
+%ghc_description\
+\
+%ghc_devel_package\
+\
+%ghc_devel_description\
+\
+%ghc_devel_post_postun\
+\
+%ghc_shared_files\
+\
+%ghc_devel_files\
+%{nil}
+
+# ghc_package [-l licensetag] [name] [version]
+%ghc_package(l:)\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define pkgver %{?2}%{!?2:%{version}}\
+%define basepkg ghc-%{pkgname}\
+%package -n %{basepkg}\
+Summary:        %{?common_summary}%{!?common_summary:Haskell %{pkgname} library}\
+%{?1:Version:        %{pkgver}}\
+%{-l:License:        %{-l*}}\
+Url:            http://hackage.haskell.org/package/%{pkgname}\
+%{?ghc_pkg_obsoletes:Obsoletes:      %(echo "%{ghc_pkg_obsoletes}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1/g")}\
+%{nil}
+
+# ghc_description [name] [version]
+%ghc_description()\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define basepkg ghc-%{pkgname}\
+%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\
+%{nil}
+
+# ghc_devel_package [-c cdepslist] [-l licensetag] [-m] [name] [version]
+#  -m : meta-package
+%ghc_devel_package(c:l:m)\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define pkgver %{?2}%{!?2:%{version}}\
+%define basepkg ghc-%{pkgname}\
+%package -n %{basepkg}-devel\
+Summary:        %{?common_summary}%{!?common_summary:Haskell %{pkgname} library} development files\
+%{?1:Version:        %{pkgver}}\
+%{-l:License:        %{-l*}}\
+Requires:       ghc-compiler = %{ghc_version}\
+Requires(post): ghc-compiler = %{ghc_version}\
+Requires(postun): ghc-compiler = %{ghc_version}\
+%if 0%{!?-m:1}\
+Requires:       ghc-%{?pkg_name}%{!?pkg_name:%{pkgname}} = %{?pkgver}%{!?pkgver:%{version}}-%{release}\
+%endif
+%{?ghc_pkg_c_deps:Requires:       %{ghc_pkg_c_deps}}\
+%{-c:Requires:       %{-c*}}\
+%{?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}\
+%if %{undefined without_prof}\
+Provides:       %{basepkg}-prof = %{pkgver}-%{release}\
+%endif\
+%{nil}
+
+# ghc_devel_description
+%ghc_devel_description()\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define basepkg ghc-%{pkgname}\
+%description -n %{basepkg}-devel\
+%{?common_description}%{!?common_description:Haskell %{pkgname} library.}\
+\
+This package contains the development files.\
+%{nil}
+
+# ghc_devel_post_postun
+%ghc_devel_post_postun()\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define basepkg ghc-%{pkgname}\
+%post -n %{basepkg}-devel\
+%ghc_pkg_recache\
+\
+%postun -n %{basepkg}-devel\
+%ghc_pkg_recache\
+%{nil}
+
+%ghc_files()\
+%{?1:%define base_doc_files %*}\
+%define basepkg ghc-%{pkg_name}\
+%ghc_shared_files\
+\
+%ghc_devel_files\
+%{nil}
+
+%ghc_shared_files\
+%files -n %{basepkg} -f %{basepkg}.files\
+%{?base_doc_files:%doc %base_doc_files}\
+%{nil}
+
+%ghc_devel_files\
+%files -n %{basepkg}-devel -f %{basepkg}-devel.files\
+%{?devel_doc_files:%doc %devel_doc_files}\
+%{nil}
diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec
index 18178bb..035d64c 100644
--- a/ghc-rpm-macros.spec
+++ b/ghc-rpm-macros.spec
@@ -1,16 +1,16 @@
 %global debug_package %{nil}
 
-%global macros_file %{_sysconfdir}/rpm/macros.ghc
+%global macros_dir %{_rpmconfigdir}/macros.d
 
 # uncomment to bootstrap without hscolour
 #%%global without_hscolour 1
 
 Name:           ghc-rpm-macros
-Version:        0.98.6
+Version:        0.98.7
 Release:        1%{?dist}
 Summary:        RPM macros for building packages for GHC
 
-License:        GPLv3
+License:        GPLv3+
 URL:            https://fedoraproject.org/wiki/Packaging:Haskell
 
 # This is a Fedora maintained package, originally made for
@@ -23,6 +23,7 @@ Source2:        AUTHORS
 Source3:        ghc-deps.sh
 Source4:        cabal-tweak-dep-ver
 Source5:        cabal-tweak-flag
+Source6:        ghc-rpm-macros.ghc-extra
 Requires:       redhat-rpm-config
 %if %{undefined without_hscolour}
 BuildRequires:  redhat-rpm-config
@@ -48,7 +49,8 @@ echo no build stage needed
 
 
 %install
-install -p -D -m 0644 %{SOURCE0} ${RPM_BUILD_ROOT}/%{macros_file}
+install -p -D -m 0644 %{SOURCE0} %{buildroot}/%{macros_dir}/macros.ghc
+install -p -D -m 0644 %{SOURCE6} %{buildroot}/%{macros_dir}/macros.ghc-extra
 
 install -p -D -m 0755 %{SOURCE3} %{buildroot}/%{_prefix}/lib/rpm/ghc-deps.sh
 
@@ -58,7 +60,7 @@ install -p -D -m 0755 %{SOURCE5} %{buildroot}/%{_bindir}/cabal-tweak-flag
 # 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
+cat >> %{buildroot}/%{macros_dir}/macros.ghc <<EOF
 
 # shared libraries are only supported on primary intel archs
 %%ghc_without_dynamic 1
@@ -69,15 +71,29 @@ EOF
 
 %files
 %doc COPYING AUTHORS
-%{macros_file}
+%{macros_dir}/macros.ghc
+%{macros_dir}/macros.ghc-extra
 %{_prefix}/lib/rpm/ghc-deps.sh
 %{_bindir}/cabal-tweak-dep-ver
 %{_bindir}/cabal-tweak-flag
 
 
 %changelog
+* Sat May 17 2014 Jens Petersen <petersen at redhat.com> - 0.98.7-1
+- do bcond cabal configure --enable-tests also for Bin packages
+- enable configure bcond check for tests
+- set Url field when generating subpackages
+- update license tag to GPLv3+
+- handle no _pkgdocdir in RHEL7 and docdir path different to F20+
+- abort ghc_fix_dynamic_rpath if no chrpath
+- Install macros to %%{_rpmconfigdir}/macros.d.
+- set datasubdir in cabal_configure for ghc-7.8
+- move spec section metamacros and multiple library packaging macros still
+  needed for ghc and haskell-platform to macros.ghc-extra
+
 * Wed Mar 26 2014 Jens Petersen <petersen at redhat.com> - 0.98.6-1
-- ghc_fix_dynamic_rpath: abort for non-existent executable name with error msg
+- quote the ghc_fix_dynamic_rpath error message
+- ghc_fix_dynamic_rpath: abort for non-existent executable name
 - cabal-tweak-flag: add manual field to enforce flag changes
 - fix ghc-deps.sh when bootstrapping a new ghc version
 - use objdump -p instead of ldd to read executable dependencies


More information about the scm-commits mailing list