[ghc-rpm-macros] ghc-deps.sh: also support ghc-pkg for ghc build before 7.6
Jens Petersen
petersen at fedoraproject.org
Thu Oct 23 06:48:31 UTC 2014
commit 87f872d02bf8cc675f5dab8b4885ee0faa6fbff0
Author: Jens Petersen <petersen at redhat.com>
Date: Thu Oct 23 15:48:27 2014 +0900
ghc-deps.sh: also support ghc-pkg for ghc build before 7.6
Now test for "%buildroot%_bindir/ghc-pkg-$GHC_VER" and if it exists it means
we are doing a ghc build and then condition on GHC_VER to set GHC_PKG.
Otherwise just use %_bindir/ghc-pkg-$GHC_VER as usual.
There are 3 cases: 7.8, 7.6, and earlier.
ghc-deps.sh | 25 +++++++++++++++----------
ghc-rpm-macros.spec | 5 ++++-
2 files changed, 19 insertions(+), 11 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 bfff899..c8e26d5 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.3.7
+Version: 1.3.8
Release: 1%{?dist}
Summary: RPM macros for building packages for GHC
@@ -93,6 +93,9 @@ EOF
%changelog
+* Thu Oct 23 2014 Jens Petersen <petersen at redhat.com> - 1.3.8-1
+- 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.3.7-1
- ghc.attr needs to handle requires for /usr/bin files too
More information about the scm-commits
mailing list