ghc-rpm-macros/ghc-pkg-wrapper
Jens Petersen 1775999b4f ghc-pkg-wrapper: use $( )
from opensuse
2023-08-04 21:34:24 +01:00

24 lines
601 B
Bash
Executable File

#!/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