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.
epel9
Jens Petersen 10 years ago
parent 9914f51b1b
commit 87f872d02b

@ -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

@ -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@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@redhat.com> - 1.3.7-1
- ghc.attr needs to handle requires for /usr/bin files too

Loading…
Cancel
Save