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 BACKUP=.orig
fi 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 [ $# -ne 2 ] && echo "Usage: `basename $0` [--provides|--requires] %{buildroot}%{ghclibdir}" && exit 1
set +x
MODE=$1 MODE=$1
PKGBASEDIR=$2 PKGBASEDIR=$2
PKGCONFDIR=$PKGBASEDIR/package.conf.d PKGCONFDIR=$PKGBASEDIR/package.conf.d
GHC_VER=$(basename $PKGBASEDIR | sed -e s/ghc-//) 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" GHC_PKG="$PKGBASEDIR/ghc-pkg --global-package-db=$PKGCONFDIR"
else else
GHC_PKG="/usr/bin/ghc-pkg" GHC_PKG="/usr/bin/ghc-pkg-${GHC_VER}"
fi fi
case $MODE in case $MODE in
@ -29,14 +34,10 @@ if [ -d "$PKGBASEDIR" ]; then
SHARED=$(find $PKGBASEDIR -type f -name '*.so') SHARED=$(find $PKGBASEDIR -type f -name '*.so')
fi fi
GHCVERSION=$(ghc --numeric-version)
files=$(cat) files=$(cat)
#set -x
for i in $files; do 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 [ "$LIB_FILE" ]; then
if [ -d "$PKGCONFDIR" ]; then if [ -d "$PKGCONFDIR" ]; then
META="" META=""
@ -68,7 +69,7 @@ for i in $files; do
fi fi
elif [ "$MODE" = "--requires" ]; then elif [ "$MODE" = "--requires" ]; then
if file $i | grep -q 'executable, .* dynamically linked'; 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 if [ -d "$PKGCONFDIR" ]; then
PACKAGE_CONF_OPT="--package-conf=$PKGCONFDIR" PACKAGE_CONF_OPT="--package-conf=$PKGCONFDIR"
fi fi

View File

@ -138,6 +138,7 @@ fi
PDIR=$(cd ..; pwd)\ PDIR=$(cd ..; pwd)\
for i in %*; do\ for i in %*; do\
PROG=%{buildroot}%{_bindir}/$i\ PROG=%{buildroot}%{_bindir}/$i\
if [ -x "$PROG" ]; then\
RPATH=$(chrpath $PROG| sed -e "s@^$PROG: RPATH=@@")\ RPATH=$(chrpath $PROG| sed -e "s@^$PROG: RPATH=@@")\
case $RPATH in\ case $RPATH in\
*$PDIR*)\ *$PDIR*)\
@ -145,6 +146,10 @@ for i in %*; do\
chrpath -r $NEWRPATH $PROG\ chrpath -r $NEWRPATH $PROG\
;;\ ;;\
esac\ esac\
else\
echo "%%ghc_fix_dynamic_rpath: no such file $PROG"\
exit 1\
fi\
done\ done\
%endif\ %endif\
%{nil} %{nil}

View File

@ -6,7 +6,7 @@
#%%global without_hscolour 1 #%%global without_hscolour 1
Name: ghc-rpm-macros Name: ghc-rpm-macros
Version: 1.0.7.2 Version: 1.0.7.3
Release: 1%{?dist} Release: 1%{?dist}
Summary: RPM macros for building packages for GHC Summary: RPM macros for building packages for GHC
@ -90,6 +90,14 @@ EOF
%changelog %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 * Fri Oct 25 2013 Jens Petersen <petersen@redhat.com> - 1.0.7.2-1
- ghcpkgdocdir should be versioned (for F20 and earlier) - ghcpkgdocdir should be versioned (for F20 and earlier)