diff --git a/ghc-deps.sh b/ghc-deps.sh index dce4e65..57e2433 100755 --- a/ghc-deps.sh +++ b/ghc-deps.sh @@ -1,24 +1,24 @@ #!/bin/sh # find rpm provides and requires for Haskell GHC libraries -[ $# -lt 2 ] && echo "Usage: $(basename $0) [--provides|--requires] %{buildroot}%{ghclibdir} [%{?ghc_name}]" && exit 1 +[ $# -lt 2 ] && echo "Usage: $(basename $0) [--provides|--requires] %{buildroot} %{ghclibdir} [%{?ghc_name}]" && exit 1 set +x MODE=$1 -PKGBASEDIR=$2 -if [ -z "$3" ]; +BUILDROOT=$2 +PKGBASEDIR=$3 +if [ -z "$4" ]; then GHCPREFIX=ghc -else GHCPREFIX=$3 +else GHCPREFIX=$4 fi -if [ -d $PKGBASEDIR/lib ]; +if [ -d $BUILDROOT$PKGBASEDIR/lib ]; then PKGBASELIB=$PKGBASEDIR/lib - LIB=lib/ else PKGBASELIB=$PKGBASEDIR fi PKGCONFDIR=$PKGBASELIB/package.conf.d -GHC_PKG="/usr/lib/rpm/ghc-pkg-wrapper $PKGBASEDIR" +GHC_PKG="/usr/lib/rpm/ghc-pkg-wrapper $BUILDROOT$PKGBASEDIR" case $MODE in --provides) field=id ;; @@ -34,7 +34,7 @@ for i in $files; do meta="" case $i in # exclude rts.conf - $PKGCONFDIR/*-*.conf) + $BUILDROOT$PKGCONFDIR/*-*.conf) name=$(grep "^name: " $i | sed -e "s/name: //") ids=$($GHC_PKG field $name $field | sed -e "s/\(^\| \)rts\( \|$\)/ /") for d in $ids; do @@ -57,7 +57,7 @@ for i in $files; do echo "$GHCPREFIX-prof($d)" ;; *) - if [ -f /usr/lib*/ghc-*/$LIB*/libHS${d}_p.a -o -f $PKGBASELIB/*/libHS${d}_p.a ]; then + if [ -f $PKGBASELIB/*/libHS${d}_p.a -o -f $BUILDROOT$PKGBASELIB/*/libHS${d}_p.a ]; then echo "$GHCPREFIX-prof($d)" fi ;; diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec index 3df2720..b0b0ce4 100644 --- a/ghc-rpm-macros.spec +++ b/ghc-rpm-macros.spec @@ -7,7 +7,7 @@ %endif Name: ghc-rpm-macros -Version: 2.3.16 +Version: 2.4.0 Release: 1%{?dist} Summary: RPM macros for building Haskell packages for GHC @@ -183,6 +183,10 @@ EOF %changelog +* Fri Jun 10 2022 Jens Petersen - 2.4.0-1 +- change ghc-deps.sh, splitting buildroot path from ghclibdir + so that the ghc version can be used more precisely + * Wed Jun 8 2022 Jens Petersen - 2.3.16-1 - define ghc_prefix (used for ghcX.Y packaging) - add _ghc_doc_dir diff --git a/ghc.attr b/ghc.attr index 8e62be6..560c331 100644 --- a/ghc.attr +++ b/ghc.attr @@ -1,3 +1,3 @@ -%__ghc_provides %{_rpmconfigdir}/ghc-deps.sh --provides %{buildroot}%{ghclibdir} %{?ghc_name:ghc-%{ghc_version}} -%__ghc_requires %{_rpmconfigdir}/ghc-deps.sh --requires %{buildroot}%{ghclibdir} %{?ghc_name:ghc-%{ghc_version}} +%__ghc_provides %{_rpmconfigdir}/ghc-deps.sh --provides %{buildroot} %{ghclibdir} %{?ghc_name:ghc-%{ghc_version}} +%__ghc_requires %{_rpmconfigdir}/ghc-deps.sh --requires %{buildroot} %{ghclibdir} %{?ghc_name:ghc-%{ghc_version}} %__ghc_path ^(%{ghcliblib}/package.conf.d/.*\.conf|%{ghclibplatform}/.*/libHS.*_p\.a)$