[ghc-rpm-macros/f21] backport various recent improvements from rawhide

Jens Petersen petersen at fedoraproject.org
Fri Nov 14 09:28:01 UTC 2014


commit afcae244ac8cca572db3ae41630e449643ec8ead
Author: Jens Petersen <petersen at redhat.com>
Date:   Fri Nov 14 18:27:31 2014 +0900

    backport various recent improvements from rawhide
    
    - split ghc.attr into ghc_lib.attr and ghc_bin.attr for finer grained handling
    - require ghc-compiler for ghc_version
    - macros.ghc: cabal_configure now passes CFLAGS and LDFLAGS to ghc (#1138982)
      (thanks to Sergei Trofimovich and Ville Skyttä)
    - ghc-deps.sh: support ghc-pkg for ghc build <= 7.4.2 as well

 ghc-deps.sh         |   25 +++++++++++++++----------
 ghc-rpm-macros.spec |   20 ++++++++++++++++----
 ghc.attr            |    3 ---
 ghc_bin.attr        |    3 +++
 ghc_lib.attr        |    3 +++
 macros.ghc          |    4 +++-
 6 files changed, 40 insertions(+), 18 deletions(-)
---
diff --git a/ghc-deps.sh b/ghc-deps.sh
index 9186ca1..e3a681e 100755
--- a/ghc-deps.sh
+++ b/ghc-deps.sh
@@ -1,11 +1,6 @@
 #!/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}
-#   %define __find_provides /usr/lib/rpm/ghc-deps.sh --provides %{buildroot}%{ghclibdir}
-
 [ $# -ne 2 ] && echo "Usage: `basename $0` [--provides|--requires] %{buildroot}%{ghclibdir}" && exit 1
 
 set +x
@@ -15,11 +10,21 @@ PKGBASEDIR=$2
 PKGCONFDIR=$PKGBASEDIR/package.conf.d
 GHC_VER=$(basename $PKGBASEDIR | sed -e s/ghc-//)
 
-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"
+# for a ghc build use the new ghc-pkg
+INPLACE_GHCPKG=$PKGBASEDIR/../../bin/ghc-pkg-$GHC_VER
+
+if [ -x "$INPLACE_GHCPKG" ]; then
+    case $GHC_VER in
+        7.8.*)
+            GHC_PKG="$PKGBASEDIR/bin/ghc-pkg --global-package-db=$PKGCONFDIR"
+            ;;
+        7.6.*)
+            GHC_PKG="$PKGBASEDIR/ghc-pkg --global-package-db=$PKGCONFDIR"
+            ;;
+        *)
+            GHC_PKG="$PKGBASEDIR/ghc-pkg --global-conf=$PKGCONFDIR"
+            ;;
+    esac
 else
     GHC_PKG="/usr/bin/ghc-pkg-${GHC_VER}"
 fi
diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec
index 635a83f..79fb939 100644
--- a/ghc-rpm-macros.spec
+++ b/ghc-rpm-macros.spec
@@ -6,7 +6,7 @@
 #%%global without_hscolour 1
 
 Name:           ghc-rpm-macros
-Version:        1.2.16
+Version:        1.2.17
 Release:        1%{?dist}
 Summary:        RPM macros for building packages for GHC
 
@@ -24,10 +24,13 @@ Source3:        ghc-deps.sh
 Source4:        cabal-tweak-dep-ver
 Source5:        cabal-tweak-flag
 Source6:        macros.ghc-extra
-Source7:        ghc.attr
+Source7:        ghc_bin.attr
+Source8:        ghc_lib.attr
 Requires:       ghc-srpm-macros
 # macros.ghc-srpm moved out from redhat-rpm-config-21
 Requires:       redhat-rpm-config > 20-1.fc21
+# for ghc_version
+Requires:       ghc-compiler
 %if %{undefined without_hscolour}
 %ifarch %{ix86} %{ix86} x86_64 ppc ppc64 alpha sparcv9 armv7hl armv5tel s390 s390x ppc64le aarch64
 Requires:       hscolour
@@ -67,7 +70,8 @@ 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
-install -p -D -m 0644 %{SOURCE7} %{buildroot}/%{_prefix}/lib/rpm/fileattrs/ghc.attr
+install -p -D -m 0644 %{SOURCE7} %{buildroot}/%{_prefix}/lib/rpm/fileattrs/ghc_bin.attr
+install -p -D -m 0644 %{SOURCE8} %{buildroot}/%{_prefix}/lib/rpm/fileattrs/ghc_lib.attr
 
 install -p -D -m 0755 %{SOURCE4} %{buildroot}/%{_bindir}/cabal-tweak-dep-ver
 install -p -D -m 0755 %{SOURCE5} %{buildroot}/%{_bindir}/cabal-tweak-flag
@@ -86,7 +90,8 @@ EOF
 %files
 %doc COPYING AUTHORS
 %{macros_dir}/macros.ghc
-%{_prefix}/lib/rpm/fileattrs/ghc.attr
+%{_prefix}/lib/rpm/fileattrs/ghc_bin.attr
+%{_prefix}/lib/rpm/fileattrs/ghc_lib.attr
 %{_prefix}/lib/rpm/ghc-deps.sh
 %{_bindir}/cabal-tweak-dep-ver
 %{_bindir}/cabal-tweak-flag
@@ -97,6 +102,13 @@ EOF
 
 
 %changelog
+* Fri Nov 14 2014 Jens Petersen <petersen at redhat.com> - 1.2.17-1
+- split ghc.attr into ghc_lib.attr and ghc_bin.attr for finer grained handling
+- require ghc-compiler for ghc_version
+- macros.ghc: cabal_configure now passes CFLAGS and LDFLAGS to ghc (#1138982)
+  (thanks to Sergei Trofimovich and Ville Skyttä)
+- ghc-deps.sh: support ghc-pkg for ghc build <= 7.4.2 as well
+
 * Thu Oct 16 2014 Jens Petersen <petersen at redhat.com> - 1.2.16-1
 - ghc.attr needs to handle requires for /usr/bin files too
 
diff --git a/ghc_bin.attr b/ghc_bin.attr
new file mode 100644
index 0000000..4563546
--- /dev/null
+++ b/ghc_bin.attr
@@ -0,0 +1,3 @@
+%__ghc_bin_requires	%{_rpmconfigdir}/ghc-deps.sh --requires %{buildroot}%{ghclibdir}
+%__ghc_bin_magic	executable, .* dynamically linked
+%__ghc_bin_flags	exeonly
diff --git a/ghc_lib.attr b/ghc_lib.attr
new file mode 100644
index 0000000..c3722c0
--- /dev/null
+++ b/ghc_lib.attr
@@ -0,0 +1,3 @@
+%__ghc_lib_provides	%{_rpmconfigdir}/ghc-deps.sh --provides %{buildroot}%{ghclibdir}
+%__ghc_lib_requires	%{_rpmconfigdir}/ghc-deps.sh --requires %{buildroot}%{ghclibdir}
+%__ghc_lib_path		^%{ghclibdir}/.*/libHS.*\\.(so|a)$
diff --git a/macros.ghc b/macros.ghc
index ab4a149..aa0e19a 100644
--- a/macros.ghc
+++ b/macros.ghc
@@ -21,7 +21,9 @@ fi
 # configure
 %cabal_configure\
 %ghc_check_bootstrap\
-%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
+CFLAGS="${CFLAGS:-%optflags}"; export CFLAGS\
+LDFLAGS="${LDFLAGS:-%__global_ldflags}"; export LDFLAGS\
+%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} --ghc-options="$(echo ' '$CFLAGS | sed -e 's/ / -optc/g') $(echo ' '$LDFLAGS | sed -e 's/ / -optl/g')" %{?cabal_configure_options} $cabal_configure_extra_options
 
 # install
 %cabal_install %cabal copy --destdir=%{buildroot} -v


More information about the scm-commits mailing list