ghc-rpm-macros/ghc-pkg-wrapper
Jens Petersen 37fe2b4ab7 support packaging Cabal bundled internal libraries
for some reason installing with Cabal (rather than cabal-install)
gives different hashes for the sublibrary

simplification of initial work in opensuse by Ondřej Súkup
https://github.com/fedora-haskell/ghc-rpm-macros/pull/7

testcase was haddock-library-1.4.5
2018-05-25 19:24:07 +09:00

33 lines
846 B
Bash
Executable File

#!/bin/sh
[ $# -lt 1 ] && echo "Usage: `basename $0` %{buildroot}%{ghclibdir} ..." && exit 1
set +x
PKGBASEDIR=$1
shift
PKGCONFDIR=$PKGBASEDIR/package.conf.d
GHC_VER=$(basename $PKGBASEDIR | sed -e s/ghc-//)
# 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.4.*)
GHC_PKG="$PKGBASEDIR/ghc-pkg --global-conf=$PKGCONFDIR"
;;
7.6.*)
GHC_PKG="$PKGBASEDIR/ghc-pkg --global-package-db=$PKGCONFDIR"
;;
# 7.8 and 7.10
*)
GHC_PKG="env LD_LIBRARY_PATH=$(dirname $PKGBASEDIR) $PKGBASEDIR/bin/ghc-pkg --global-package-db=$PKGCONFDIR"
;;
esac
else
GHC_PKG="/usr/bin/ghc-pkg-${GHC_VER} -f $PKGCONFDIR"
fi
$GHC_PKG -v0 --simple-output $* | uniq