ghc-rpm-macros/ghc-deps.sh
Petr Šabata 7b45c3d854 RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/ghc-rpm-macros#78bda0dce526795284ef1644e7d0dd6e0b3511dc
2020-10-15 01:21:28 +02:00

62 lines
1.8 KiB
Bash
Executable File

#!/bin/sh
# find rpm provides and requires for Haskell GHC libraries
[ $# -ne 2 ] && echo "Usage: $(basename $0) [--provides|--requires] %{buildroot}%{ghclibdir}" && exit 1
set +x
MODE=$1
PKGBASEDIR=$2
PKGCONFDIR=$PKGBASEDIR/package.conf.d
GHC_PKG="/usr/lib/rpm/ghc-pkg-wrapper $PKGBASEDIR"
case $MODE in
--provides) field=id ;;
--requires) field=depends ;;
*) echo "$(basename $0): Need --provides or --requires"
exit 1
;;
esac
files=$(cat)
for i in $files; do
meta=""
case $i in
# exclude rts.conf
$pkgconfdir/*-*.conf)
name=$(grep "^name: " $i | sed -e "s/name: //")
ids=$($GHC_PKG field $name $field | sed -e "s/ rts\b//" -e "s/bin-package-db-[^ ]\+//")
for d in $ids; do
case $d in
*-*-internal) ;;
*-*) echo "ghc-devel($d)" ;;
*) ;;
esac
done
;;
*/libHS*_p.a)
pkgver=$(basename $(dirname $i))
ids=$($GHC_PKG field $pkgver $field | sed -e "s/ rts\b//" -e "s/bin-package-db-[^ ]\+//")
for d in $ids; do
case $d in
*-*-internal) ;;
*-*)
case $field in
id)
echo "ghc-prof($d)"
;;
*)
if [ -f /usr/lib*/ghc-*/*/libHS${d}_p.a -o -f $PKGBASEDIR/*/libHS${d}_p.a ]; then
echo "ghc-prof($d)"
fi
;;
esac
;;
esac
done
;;
esac
done