simplify cabal-tweak-flag and add %ghc_fix_dynamic_rpath

This commit is contained in:
Jens Petersen 2013-01-22 17:48:48 +09:00
parent be71f209c4
commit 7c5e4d74e1
3 changed files with 32 additions and 10 deletions

View File

@ -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)

View File

@ -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

View File

@ -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@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@redhat.com> - 0.95.9-1
- be more careful about library pkgdir ownership (#893777)
- add cabal-tweak-flag script for toggling flag default