From 1f4312aeaa80f62ab15895512d68745db1c20190 Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Thu, 10 Feb 2011 22:11:02 +1000 Subject: [PATCH] fix ghc-deps.sh for without_shared libraries --- ghc-deps.sh | 76 ++++++++++++++++++++++++--------------------- ghc-rpm-macros.ghc | 3 ++ ghc-rpm-macros.spec | 7 +++-- 3 files changed, 49 insertions(+), 37 deletions(-) diff --git a/ghc-deps.sh b/ghc-deps.sh index 37263a6..b964ce9 100755 --- a/ghc-deps.sh +++ b/ghc-deps.sh @@ -18,6 +18,8 @@ case $MODE in *) echo "`basename $0`: Need --provides or --requires" ; exit 1 esac +SHARED=$(find $PKGBASEDIR -type f -name '*.so') + GHCVERSION=$(ghc --numeric-version) files=$(cat) @@ -25,42 +27,46 @@ files=$(cat) #set -x for i in $files; do - LIB_FILE=$(echo $i | grep /libHS | egrep -v "$PKGBASEDIR/libHS") - if [ -n "$LIB_FILE" ]; then - if [ -d "$PKGCONFDIR" ]; then - META="" - SELF="" - case $LIB_FILE in - *.so) META=ghc ;; - *_p.a) META=ghc-prof SELF=ghc-devel ;; - *.a) META=ghc-devel SELF=ghc ;; - esac - if [ -n "$META" ]; then - PKGVER=$(echo $LIB_FILE | sed -e "s%$PKGBASEDIR/\([^/]\+\)/libHS.*%\1%") - HASHS=$(ghc-pkg -f $PKGCONFDIR field $PKGVER $FIELD | sed -e "s/^$FIELD: \+//") - for i in $HASHS; do - case $i in - *-*) echo $i | sed -e "s/\(.*\)-\(.*\)/$META(\1) = \2/" ;; - *) ;; - esac - done - if [ "$MODE" = "--requires" -a -n "$SELF" ]; then - HASHS=$(ghc-pkg -f $PKGCONFDIR field $PKGVER id | sed -e "s/^id: \+//") - for i in $HASHS; do - echo $i | sed -e "s/\(.*\)-\(.*\)/$SELF(\1) = \2/" - done - fi + LIB_FILE=$(echo $i | grep /libHS | egrep -v "$PKGBASEDIR/libHS") + if [ -n "$LIB_FILE" ]; then + if [ -d "$PKGCONFDIR" ]; then + META="" + SELF="" + case $LIB_FILE in + *.so) META=ghc ;; + *_p.a) META=ghc-prof SELF=ghc-devel ;; + *.a) META=ghc-devel + if [ -n "$SHARED" ]; then + SELF=ghc + fi + ;; + esac + if [ -n "$META" ]; then + PKGVER=$(echo $LIB_FILE | sed -e "s%$PKGBASEDIR/\([^/]\+\)/libHS.*%\1%") + HASHS=$(ghc-pkg -f $PKGCONFDIR field $PKGVER $FIELD | sed -e "s/^$FIELD: \+//") + for i in $HASHS; do + case $i in + *-*) echo $i | sed -e "s/\(.*\)-\(.*\)/$META(\1) = \2/" ;; + *) ;; + esac + done + if [ "$MODE" = "--requires" -a -n "$SELF" ]; then + HASHS=$(ghc-pkg -f $PKGCONFDIR field $PKGVER id | sed -e "s/^id: \+//") + for i in $HASHS; do + echo $i | sed -e "s/\(.*\)-\(.*\)/$SELF(\1) = \2/" + done + fi + fi + 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%") + for p in ${BIN_DEPS}; do + HASH=$(ghc-pkg --global field $p id | sed -e "s/^id: \+//") + echo $HASH | sed -e "s/\(.*\)-\(.*\)/ghc(\1) = \2/" + done + fi fi - 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%") - for p in ${BIN_DEPS}; do - HASH=$(ghc-pkg --global field $p id | sed -e "s/^id: \+//") - echo $HASH | sed -e "s/\(.*\)-\(.*\)/ghc(\1) = \2/" - done - fi - fi done echo $files | tr [:blank:] '\n' | /usr/lib/rpm/rpmdeps $MODE diff --git a/ghc-rpm-macros.ghc b/ghc-rpm-macros.ghc index 00f48cf..f2d229b 100644 --- a/ghc-rpm-macros.ghc +++ b/ghc-rpm-macros.ghc @@ -1,3 +1,6 @@ +# RPM Macros for packaging Haskell cabalized packages +# see https://fedoraproject.org/wiki/PackagingDrafts/Haskell for more details + # "cabal" %cabal [ -x Setup ] || ghc --make -dynamic Setup\ ./Setup diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec index bc2c2f0..036a487 100644 --- a/ghc-rpm-macros.spec +++ b/ghc-rpm-macros.spec @@ -1,6 +1,6 @@ Name: ghc-rpm-macros -Version: 0.11.6 -Release: 2%{?dist} +Version: 0.11.7 +Release: 1%{?dist} Summary: Macros for building packages for GHC Group: Development/Libraries @@ -47,6 +47,9 @@ install -p %{SOURCE3} ${RPM_BUILD_ROOT}/%{_prefix}/lib/rpm %changelog +* Thu Feb 10 2011 Jens Petersen - 0.11.7-1 +- fix ghc-deps.sh for without_shared libraries + * Tue Feb 08 2011 Fedora Release Engineering - 0.11.6-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild