[ghc-rpm-macros/f18] simplify cabal-tweak-flag and add %ghc_fix_dynamic_rpath

Jens Petersen petersen at fedoraproject.org
Tue Jan 22 08:49:15 UTC 2013


commit 7c5e4d74e1e58fb36ce743285603980464421eb0
Author: Jens Petersen <petersen at redhat.com>
Date:   Tue Jan 22 17:48:48 2013 +0900

    simplify cabal-tweak-flag and add %ghc_fix_dynamic_rpath

 cabal-tweak-flag    |   18 +++++++++---------
 ghc-rpm-macros.ghc  |   17 +++++++++++++++++
 ghc-rpm-macros.spec |    7 ++++++-
 3 files changed, 32 insertions(+), 10 deletions(-)
---
diff --git a/cabal-tweak-flag b/cabal-tweak-flag
index 0d54d53..2db3a72 100755
--- a/cabal-tweak-flag
+++ b/cabal-tweak-flag
@@ -1,25 +1,25 @@
 #!/bin/sh
 
 # TODO:
-# support "$0 FLAG NEW" when no upstream default
+# support setting flag when no upstream default
 
 set -e +x
 
-USAGE="Usage: $0 FLAG OLD NEW"
+USAGE="Usage: $0 FLAG [True|False]"
 
-if [ $# -ne 3 ]; then
+if [ $# -ne 2 ]; then
     echo "$USAGE"
     exit 1
 fi
 
 FLAG=$1
-OLD=$2
-NEW=$3
 
-if [ "$OLD" = "$NEW" ]; then
-  echo "Old and new value can't be the same!"
-  exit 1
-fi
+NEW=$2
+case $NEW in
+    True) OLD=False ;;
+    False) OLD=True ;;
+    *) echo "Flag value can only be set to True or False" ; exit 1 ;;
+esac
 
 CABALFILE=$(ls *.cabal)
 
diff --git a/ghc-rpm-macros.ghc b/ghc-rpm-macros.ghc
index 60ca199..c385bbb 100644
--- a/ghc-rpm-macros.ghc
+++ b/ghc-rpm-macros.ghc
@@ -281,6 +281,23 @@ find %{buildroot} -type f -exec sh -c "file {} | grep -q 'dynamically linked'" \
 %{!?1:%ghc_strip_dynlinked}\
 %{nil}
 
+# ghc_fix_dynamic_rpath prog ...
+%ghc_fix_dynamic_rpath()\
+%if %{undefined ghc_without_dynamic}\
+PDIR=$(cd ..; pwd)\
+for i in %*; do\
+  PROG=%{buildroot}%{_bindir}/$i\
+  RPATH=$(chrpath $PROG| sed -e "s@^$PROG: RPATH=@@")\
+  case $RPATH in\
+    $PDIR*)\
+      NEWRPATH=$(echo $RPATH | sed -e "s@$PDIR@%{ghclibdir}@g" -e "s@/dist/build@@g")\
+      chrpath -r $NEWRPATH $PROG\
+      ;;\
+  esac\
+done\
+%endif\
+%{nil}
+
 # - without_hscolour, without_testsuite, and ghc_bootstrapping
 #   need to be set locally in the spec file
 
diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec
index 798940e..a534f55 100644
--- a/ghc-rpm-macros.spec
+++ b/ghc-rpm-macros.spec
@@ -6,7 +6,7 @@
 #%%global without_hscolour 1
 
 Name:           ghc-rpm-macros
-Version:        0.95.9
+Version:        0.95.10
 Release:        1%{?dist}
 Summary:        Macros for building packages for GHC
 
@@ -75,6 +75,11 @@ EOF
 
 
 %changelog
+* Tue Jan 22 2013 Jens Petersen <petersen at redhat.com> - 0.95.10-1
+- simplify cabal-tweak-flag script to take one flag value
+- new ghc_fix_dynamic_rpath macro for cleaning up package executables
+  linked against their own libraries
+
 * Fri Jan 18 2013 Jens Petersen <petersen at redhat.com> - 0.95.9-1
 - be more careful about library pkgdir ownership (#893777)
 - add cabal-tweak-flag script for toggling flag default


More information about the scm-commits mailing list