You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ghc-rpm-macros/ghc-pkg-wrapper

24 lines
600 B

#!/bin/sh
[ $# -lt 1 ] && echo "Usage: `basename $0` %{buildroot}%{ghclibdir} ..." && exit 1
set +x -e
PKGBASEDIR=$1
shift
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
if [ -x "$PKGBASEDIR/bin/ghc-pkg" ]; then
GHC_PKG="env LD_LIBRARY_PATH=$(dirname $PKGBASEDIR) $PKGBASEDIR/bin/ghc-pkg --global-package-db=$PKGCONFDIR"
else
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