[ghc-rpm-macros/epel7: 2/2] rebase to backport from F20 for ghc-7.6

Jens Petersen petersen at fedoraproject.org
Fri Mar 28 09:27:27 UTC 2014


commit 1c2b26b493402ff487e42b84b5b82733bea85c33
Author: Jens Petersen <petersen at redhat.com>
Date:   Fri Mar 28 18:26:56 2014 +0900

    rebase to backport from F20 for ghc-7.6
    
    - add ghc-rpm-macros-extra subpackage
    - fix ghc-deps.sh for ghc-pkg-7.6.3 and 7.8
    - add ghcpkgdocdir (versioned)
    - add ghc_clear_execstack
    - static only archs also gain base lib subpkgs

 ghc-deps.sh              |    9 ++-
 ghc-rpm-macros.ghc       |  145 ++--------------------------------------------
 ghc-rpm-macros.ghc-extra |   44 ++++++++++++++
 ghc-rpm-macros.spec      |   83 ++++++++++++++++++++------
 4 files changed, 119 insertions(+), 162 deletions(-)
---
diff --git a/ghc-deps.sh b/ghc-deps.sh
index 85c4488..324926c 100755
--- a/ghc-deps.sh
+++ b/ghc-deps.sh
@@ -15,8 +15,11 @@ PKGBASEDIR=$2
 PKGCONFDIR=$PKGBASEDIR/package.conf.d
 GHC_VER=$(basename $PKGBASEDIR | sed -e s/ghc-//)
 
-if [ -x "$PKGBASEDIR/ghc-pkg" ]; then
-    GHC_PKG="$PKGBASEDIR/ghc-pkg --global-conf=$PKGCONFDIR"
+if [ -x "$PKGBASEDIR/bin/ghc-pkg" ]; then
+    # ghc-7.8
+    GHC_PKG="$PKGBASEDIR/bin/ghc-pkg --global-package-db=$PKGCONFDIR"
+elif [ -x "$PKGBASEDIR/ghc-pkg" ]; then
+    GHC_PKG="$PKGBASEDIR/ghc-pkg --global-package-db=$PKGCONFDIR"
 else
     GHC_PKG="/usr/bin/ghc-pkg-${GHC_VER}"
 fi
@@ -34,7 +37,7 @@ fi
 files=$(cat)
 
 for i in $files; do
-    LIB_FILE=$(echo $i | grep /libHS | egrep -v "$PKGBASEDIR/libHS")
+    LIB_FILE=$(echo $i | grep /libHS | egrep -v "/libHSrts")
     if [ "$LIB_FILE" ]; then
 	if [ -d "$PKGCONFDIR" ]; then
 	    META=""
diff --git a/ghc-rpm-macros.ghc b/ghc-rpm-macros.ghc
index 265cc23..5d41dc8 100644
--- a/ghc-rpm-macros.ghc
+++ b/ghc-rpm-macros.ghc
@@ -2,7 +2,7 @@
 # see https://fedoraproject.org/wiki/Packaging:Haskell for more details
 
 # "cabal"
-%cabal [ -x Setup ] || ghc --make %{!?ghc_user_conf:-no-user-package-conf} %{!?ghc_without_dynamic:-dynamic} Setup\
+%cabal [ -x Setup ] || ghc --make %{!?ghc_user_conf:-no-user-package-db} %{!?ghc_without_dynamic:-dynamic} Setup\
 ./Setup
 
 # check ghc version was rebuilt against self
@@ -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=%{_docdir}/%{name}-%{version} --libsubdir='$compiler/$pkgid' --ghc %{!?ghc_without_dynamic:--enable-executable-dynamic} %{?cabal_configure_options} $cabal_configure_extra_options
 
 # install
 %cabal_install %cabal copy --destdir=%{buildroot} -v
@@ -65,10 +65,6 @@ fi\
 done\
 %{nil}
 
-%ghc_add_basepkg_file()\
-%define basepkg ghc-%{pkg_name}\
-echo "%*" >> %{basepkg}.files
-
 # compiler version
 %ghc_version %{!?ghc_version_override:%(ghc --numeric-version)}%{?ghc_version_override}
 
@@ -79,138 +75,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
@@ -222,7 +87,7 @@ This package contains the development files.
 # ghc_lib_build_without_haddock [name] [version]
 %ghc_lib_build_without_haddock()\
 %global debug_package %{nil}\
-%cabal_configure %{!?without_prof:-p} %{!?ghc_without_shared:--enable-shared} %{?pkg_name:--htmldir=%{ghclibdocdir}/%{pkg_name}-%{version}} %{?1:--docdir=%{_docdir}/ghc-%1-%2 --htmldir=%{ghclibdocdir}/%1-%2} %{!?1:--global} %{?ghc_with_lib_for_ghci:--enable-library-for-ghci}\
+%cabal_configure %{!?without_prof:-p} %{!?ghc_without_shared:--enable-shared} %{?pkg_name:--htmldir=%{ghclibdocdir}/%{pkg_name}-%{version}} %{?1:--docdir=%{_docdir}/ghc-%1-%2 --htmldir=%{ghclibdocdir}/%1-%2} %{!?1:--global} %{?ghc_with_lib_for_ghci:--enable-library-for-ghci} --ghc-option=-O2\
 %cabal build\
 %{nil}
 
@@ -289,7 +154,7 @@ done\
 %endif\
 %{nil}
 
-%ghc_pkg_recache %{_bindir}/ghc-pkg recache --no-user-package-conf || :
+%ghc_pkg_recache %{_bindir}/ghc-pkg recache --no-user-package-db || :
 
 # - without_hscolour, without_testsuite, and ghc_bootstrapping
 #   need to be set locally in the spec file
diff --git a/ghc-rpm-macros.ghc-extra b/ghc-rpm-macros.ghc-extra
new file mode 100644
index 0000000..3cfc35a
--- /dev/null
+++ b/ghc-rpm-macros.ghc-extra
@@ -0,0 +1,44 @@
+# 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}\
+%package -n %{basepkg}\
+Summary:        Haskell %{pkgname} library\
+%{?1:Version:        %{pkgver}}\
+%{-l:License:        %{-l*}}\
+%{?ghc_pkg_obsoletes:Obsoletes:      %(echo "%{ghc_pkg_obsoletes}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1/g")}\
+\
+%description -n %{basepkg}\
+This package provides the Haskell %{pkgname} library.\
+\
+%package -n %{basepkg}-devel\
+Summary:        Haskell %{pkgname} library development files\
+%{?1:Version:        %{pkgver}}\
+%{-l:License:        %{-l*}}\
+Requires(post): ghc-compiler = %{ghc_version}\
+Requires(postun): ghc-compiler = %{ghc_version}\
+Requires:       ghc-%{pkgname}%{?_isa} = %{pkgver}-%{release}\
+%{?ghc_pkg_c_deps:Requires:       %{ghc_pkg_c_deps}}\
+%{-c:Requires:       %{-c*}}\
+%{?ghc_pkg_obsoletes:Obsoletes:      %{ghc_pkg_obsoletes}}\
+\
+%description -n %{basepkg}-devel\
+This package provides the Haskell %{pkgname} library development files.\
+\
+%post -n %{basepkg}-devel\
+%ghc_pkg_recache\
+\
+%postun -n %{basepkg}-devel\
+%ghc_pkg_recache\
+\
+%files -n %{basepkg} -f %{basepkg}.files\
+%{?base_doc_files:%doc %base_doc_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..ffecb8d 100644
--- a/ghc-rpm-macros.spec
+++ b/ghc-rpm-macros.spec
@@ -1,12 +1,12 @@
 %global debug_package %{nil}
 
-%global macros_file %{_sysconfdir}/rpm/macros.ghc
+%global macros_dir %{_sysconfdir}/rpm
 
 # uncomment to bootstrap without hscolour
 #%%global without_hscolour 1
 
 Name:           ghc-rpm-macros
-Version:        0.98.6
+Version:        1.0.4.1
 Release:        1%{?dist}
 Summary:        RPM macros for building packages for GHC
 
@@ -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
@@ -38,6 +39,13 @@ of the Fedora Haskell SIG.  ghc needs to be installed in order to make use of
 these macros.
 
 
+%package extra
+Summary:        Extra RPM macros for building Haskell packages with several libs
+Requires:       %{name} = %{version}-%{release}
+
+%description extra
+
+
 %prep
 %setup -c -T
 cp %{SOURCE1} %{SOURCE2} .
@@ -48,7 +56,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 +67,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,39 +78,75 @@ EOF
 
 %files
 %doc COPYING AUTHORS
-%{macros_file}
+%{macros_dir}/macros.ghc
 %{_prefix}/lib/rpm/ghc-deps.sh
 %{_bindir}/cabal-tweak-dep-ver
 %{_bindir}/cabal-tweak-flag
 
 
+%files extra
+%{macros_dir}/macros.ghc-extra
+
+
 %changelog
-* Wed Mar 26 2014 Jens Petersen <petersen at redhat.com> - 0.98.6-1
+* Fri Mar 28 2014 Jens Petersen <petersen at redhat.com> - 1.0.4.1-1
+- backport recent changes from F20:
 - ghc_fix_dynamic_rpath: abort for non-existent executable name with error msg
 - cabal-tweak-flag: add manual field to enforce flag changes
+- ghc-deps.sh: fix ghc-pkg path when bootstrapping new ghc version
 - fix ghc-deps.sh when bootstrapping a new ghc version
 - use objdump -p instead of ldd to read executable dependencies
-- add --global to cabal_configure if not subpackaging libs
-
-* Fri Oct 25 2013 Jens Petersen <petersen at redhat.com> - 0.98.5-1
-- add versioned ghcpkgdocdir
-- drop ghc_docdir in favor of _pkgdocdir
+- update ghc-deps.sh to handling ghc-7.8 rts
+- ghcpkgdocdir should be versioned (for F20 and earlier)
+- add ghcpkgdocdir, which like _pkgdocdir allows for unversioned haddock dirs
 
-* Fri Jul 26 2013 Jens Petersen <petersen at redhat.com> - 0.98.4-1
-- add ghc_docdir for package docdir
+* Thu Jul 11 2013 Jens Petersen <petersen at redhat.com> - 1.0.4-1
+- check for bindir before looking for executables in ghc_clear_execstack
 
-* Thu Jul 11 2013 Jens Petersen <petersen at redhat.com> - 0.98.3-1
-- add new ghc_clear_execstack to ghc_bin_install and ghc_lib_install (#973512)
+* Wed Jul 10 2013 Jens Petersen <petersen at redhat.com> - 1.0.3-1
+- add ghc_clear_execstack and use it also in ghc_lib_install (#973512)
   and require prelink for execstack
-- create lib base package also when ghc_without_shared is set (#983137)
-  and other ghc_without_shared cleanup
 
-* Thu Jun 20 2013 Jens Petersen <petersen at redhat.com> - 0.98.2-1
+* Tue Jul  9 2013 Jens Petersen <petersen at redhat.com> - 1.0.2-1
+- drop doc and prof obsoletes and provides from ghc_lib_subpackage
+- clear executable stack flag when installing package executables (#973512)
+
+* Thu Jun 20 2013 Jens Petersen <petersen at redhat.com> - 1.0.1-1
+- only configure with --global if not subpackaging libs
+
+* Thu Jun 20 2013 Jens Petersen <petersen at redhat.com> - 1.0-3
+- reenable hscolour
+
+* Thu Jun 20 2013 Jens Petersen <petersen at redhat.com> - 1.0-2
+- turn off hscolour for bootstrap
+
+* Wed Jun 19 2013 Jens Petersen <petersen at redhat.com> - 1.0-1
+- add --global to cabal_configure
+
+* Mon Jun 17 2013 Jens Petersen <petersen at redhat.com> - 0.99.4-1
+- merge remaining extra macros into ghc_lib_subpackage
+
+* Thu Jun  6 2013 Jens Petersen <petersen at redhat.com> - 0.99.3-1
+- configure builds with ghc -O2 (#880135)
+
+* Wed Jun  5 2013 Jens Petersen <petersen at redhat.com> - 0.99.2-1
+- drop -h option from extra macros and make -m work again
+
+* Fri May 17 2013 Jens Petersen <petersen at redhat.com> - 0.99.1-1
+- drop new ghc_compiler macro since it is not good for koji
 - ghc_fix_dynamic_rpath: do not assume first RPATH
+
+* Tue Apr 23 2013 Jens Petersen <petersen at redhat.com> - 0.99-1
+- update for simplified revised Haskell Packaging Guidelines
+  (https://fedorahosted.org/fpc/ticket/194)
 - packaging for without_shared is now done the same way as shared
   to make non-shared arch packages same as shared ones:
   so all archs will now have base library binary packages
-- remove deprecated ghc_exclude_docdir
+- move spec section metamacros and multiple library packaging macros still
+  needed for ghc and haskell-platform to new extra subpackage
+- drop ghc_add_basepkg_file macro and ghc_exclude_docdir
+- for ghc-7.6 --global-package-db replaces --global-conf and
+  --no-user-package-db deprecates --no-user-package-conf
 
 * Wed Mar 20 2013 Ralf Corsépius <corsepiu at fedoraproject.org> - 0.98.1-4
 - Remove %%config from %%{_sysconfdir}/rpm/macros.*


More information about the scm-commits mailing list