From 192fd2f9c323b9ec2b4e0092bfb65a6f79343e61 Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Tue, 8 Jun 2021 21:20:51 +0800 Subject: [PATCH] restore %ghc_fix_rpath for compat and drop it from %ghc_libs_install --- ghc-rpm-macros.spec | 6 +++++- macros.ghc | 40 ++++++++++++++++++++++++++++++++++++++++ macros.ghc-extra | 1 - 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec index 7f4e2c2..197ca22 100644 --- a/ghc-rpm-macros.spec +++ b/ghc-rpm-macros.spec @@ -10,7 +10,7 @@ #%%global without_hscolour 1 Name: ghc-rpm-macros -Version: 2.2.1 +Version: 2.2.2 Release: 1%{?dist} Summary: RPM macros for building Haskell packages for GHC @@ -190,6 +190,10 @@ EOF %changelog +* Tue Jun 8 2021 Jens Petersen - 2.2.2-1 +- restore ghc_fix_rpath for now for backward compatibility + and drop it from ghc_libs_install + * Tue Jun 8 2021 Jens Petersen - 2.2.1-1 - ghc-rpm-macros needs to require chrpath now instead of ghc-rpm-macros-extra diff --git a/macros.ghc b/macros.ghc index 1e52175..9736686 100644 --- a/macros.ghc +++ b/macros.ghc @@ -196,6 +196,46 @@ for i in $(find %{buildroot} -type f -executable -exec sh -c "file {} | grep -q done\ %endif +# deprecated by ghc_delete_rpaths in F35 +%ghc_fix_rpath()\ +%if %{undefined disable_ghc_fix_rpath}\ +if ! type chrpath > /dev/null; then exit 1; fi\ +echo "ghc_fix_rpath %*"\ +for i in $(find %{buildroot} -type f -executable -exec sh -c "file {} | grep -q 'dynamically linked'" \\; -print); do\ +for lib in %*; do\ + if [ -x "$i" ]; then\ + rpath=$(chrpath $i | sed -e "s@^$i: R.*PATH=@@")\ + case $rpath in\ + *$PWD/$lib/dist/build*)\ + case %{ghc_version} in\ + 7.10.*)\ + pkgid=$(cd %{buildroot}%{ghclibdir}/package.conf.d; ls ${lib}* | sed -e "s/.conf$//")\ + syspath=$(%{_rpmconfigdir}/ghc-pkg-wrapper %{buildroot}%{ghclibdir} --global --package-db=%{buildroot}%{ghclibdir}/package.conf.d field $pkgid library-dirs) ;;\ + 8.0)\ + pkgid=$(cd %{buildroot}%{ghclibdir}; echo ${lib}*)\ + syspath=$(%{_rpmconfigdir}/ghc-pkg-wrapper %{buildroot}%{ghclibdir} --global --package-db=%{buildroot}%{ghclibdir}/package.conf.d field $lib library-dirs | grep $pkgid) ;;\ + *)\ + syspath="" ;;\ + esac\ + newrpath=$(echo $rpath | sed -e "s@$PWD/$lib/dist/build@${syspath}@g" -e "s/::/:/" -e "s/^://" -e "s/:$//")\ + if [ "$newrpath" = "%{_libdir}" ]; then\ + chrpath -d $i\ + else\ + chrpath -r $newrpath $i\ + fi\ + ;;\ + %{_libdir})\ + chrpath -d $i\ + ;;\ + esac\ + else\ + echo "%%ghc_fix_rpath: no $i executable"\ + exit 1\ + fi\ +done\ +done\ +%endif + # deprecated for f31 %ghc_pkg_recache %{_bindir}/ghc-pkg-%{ghc_version} recache --no-user-package-db || : diff --git a/macros.ghc-extra b/macros.ghc-extra index cea1d27..e992ed5 100644 --- a/macros.ghc-extra +++ b/macros.ghc-extra @@ -119,5 +119,4 @@ ver=$(echo $i | sed -e "s/.*-\\(.*\\)/\\1/")\ %ghc_lib_install $name $ver\ cd ..\ done\ -%ghc_fix_rpath $args\ %{nil}