ghc-rpm-macros/ghc-pkg-wrapper

23 lines
596 B
Plaintext
Raw Normal View History

#!/bin/sh
2021-12-19 17:21:45 +00:00
[ $# -lt 1 ] && echo "Usage: `basename $0` %{buildroot}%{ghclibdir} ..." && exit 1
set +x
PKGBASEDIR=$1
shift
2021-12-19 17:21:45 +00:00
if [ -d $PKGBASEDIR/lib ];
then PKGCONFDIR=$PKGBASEDIR/lib/package.conf.d
else PKGCONFDIR=$PKGBASEDIR/package.conf.d
fi
# for a ghc build use the new ghc-pkg
2021-12-19 17:21:45 +00:00
if [ -x "$PKGBASEDIR/bin/ghc-pkg" ]; then
GHC_PKG="env LD_LIBRARY_PATH=$(dirname $PKGBASEDIR) $PKGBASEDIR/bin/ghc-pkg --global-package-db=$PKGCONFDIR"
else
2021-12-19 17:21:45 +00:00
GHC_VER=$(basename $PKGBASEDIR | sed -e s/ghc-//)
GHC_PKG="/usr/bin/ghc-pkg-${GHC_VER} -f $PKGCONFDIR"
fi
$GHC_PKG -v0 --simple-output $* | uniq