backport ghc-deps.sh support for ghc-7.8 and cabal-tweak-flag manual field

- ghc_fix_dynamic_rpath: abort for non-existent executable name with error msg
- cabal-tweak-flag: add manual field to enforce flag changes
- ghc-deps.sh fixes for bootstrapping new ghc version
  - use objdump -p instead of ldd to read executable dependencies
  - update for ghc-7.8 rts
This commit is contained in:
Jens Petersen 2014-02-04 12:55:27 +09:00
parent c3e1d45228
commit 0be5b40270
4 changed files with 31 additions and 17 deletions

View File

@ -47,4 +47,4 @@ if [ ! -f $CABALFILE.orig ]; then
BACKUP=.orig
fi
sed -i$BACKUP -e "/[Ff]lag *$FLAG/,/[Dd]efault: *$OLD/ s/\([Dd]efault: *\)$OLD/\1$NEW/" $CABALFILE
sed -i$BACKUP -e "/[Ff]lag *$FLAG/,/[Dd]efault: *$OLD/ s/\( \+\)\([Dd]efault:[ \t]*\)$OLD/\1\2$NEW\n\1manual: True/" $CABALFILE

View File

@ -8,15 +8,20 @@
[ $# -ne 2 ] && echo "Usage: `basename $0` [--provides|--requires] %{buildroot}%{ghclibdir}" && exit 1
set +x
MODE=$1
PKGBASEDIR=$2
PKGCONFDIR=$PKGBASEDIR/package.conf.d
GHC_VER=$(basename $PKGBASEDIR | sed -e s/ghc-//)
if [ ! -x "/usr/bin/ghc-pkg-${GHC_VER}" -a -x "$PKGBASEDIR/ghc-pkg" ]; then
if [ -x "$PKGBASEDIR/bin/ghc-pkg" ]; then
# ghc-7.8
GHC_PKG="$PKGBASEDIR/bin/ghc-pkg --global-package-db=$PKGCONFDIR"
elif [ -x "$PKGBASEDIR/ghc-pkg" ]; then
GHC_PKG="$PKGBASEDIR/ghc-pkg --global-package-db=$PKGCONFDIR"
else
GHC_PKG="/usr/bin/ghc-pkg"
GHC_PKG="/usr/bin/ghc-pkg-${GHC_VER}"
fi
case $MODE in
@ -29,14 +34,10 @@ if [ -d "$PKGBASEDIR" ]; then
SHARED=$(find $PKGBASEDIR -type f -name '*.so')
fi
GHCVERSION=$(ghc --numeric-version)
files=$(cat)
#set -x
for i in $files; do
LIB_FILE=$(echo $i | grep /libHS | egrep -v "$PKGBASEDIR/libHS")
LIB_FILE=$(echo $i | grep /libHS | egrep -v "/libHSrts")
if [ "$LIB_FILE" ]; then
if [ -d "$PKGCONFDIR" ]; then
META=""
@ -68,7 +69,7 @@ for i in $files; do
fi
elif [ "$MODE" = "--requires" ]; then
if file $i | grep -q 'executable, .* dynamically linked'; then
BIN_DEPS=$(ldd $i | grep libHS | grep -v libHSrts | sed -e "s%^\\tlibHS\(.*\)-ghc${GHCVERSION}.so =.*%\1%")
BIN_DEPS=$(objdump -p $i | grep NEEDED | grep libHS | grep -v libHSrts | sed -e "s%^ *NEEDED *libHS\(.*\)-ghc${GHC_VER}.so%\1%")
if [ -d "$PKGCONFDIR" ]; then
PACKAGE_CONF_OPT="--package-conf=$PKGCONFDIR"
fi

View File

@ -138,13 +138,18 @@ fi
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\
if [ -x "$PROG" ]; then\
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\
else\
echo "%%ghc_fix_dynamic_rpath: no such file $PROG"\
exit 1\
fi\
done\
%endif\
%{nil}

View File

@ -6,7 +6,7 @@
#%%global without_hscolour 1
Name: ghc-rpm-macros
Version: 1.0.7.2
Version: 1.0.7.3
Release: 1%{?dist}
Summary: RPM macros for building packages for GHC
@ -90,6 +90,14 @@ EOF
%changelog
* Tue Feb 4 2014 Jens Petersen <petersen@redhat.com> - 1.0.7.3-1
- ghc_fix_dynamic_rpath: abort for non-existent executable name with error msg
- cabal-tweak-flag: add manual field to enforce flag changes
- ghc-deps.sh: fix ghc-pkg path when bootstrapping new ghc version
- fix ghc-deps.sh when bootstrapping a new ghc version
- use objdump -p instead of ldd to read executable dependencies
- update ghc-deps.sh to handling ghc-7.8 rts
* Fri Oct 25 2013 Jens Petersen <petersen@redhat.com> - 1.0.7.2-1
- ghcpkgdocdir should be versioned (for F20 and earlier)