[ghc-rpm-macros] fix ghc-deps.sh to handle obsoleted meta libraries

Jens Petersen petersen at fedoraproject.org
Mon Mar 2 04:23:53 UTC 2015


commit 0b6b0198da94b80c4f5aff7c3f8d8fa0b58855c3
Author: Jens Petersen <petersen at redhat.com>
Date:   Mon Mar 2 13:21:32 2015 +0900

    fix ghc-deps.sh to handle obsoleted meta libraries
    
    use --disable-shared for %ghc_without_shared

 ghc-deps.sh         | 60 +++++++++++++++++++++++++----------------------------
 ghc-rpm-macros.spec |  7 ++++++-
 macros.ghc          |  2 +-
 3 files changed, 35 insertions(+), 34 deletions(-)
---
diff --git a/ghc-deps.sh b/ghc-deps.sh
index e3a681e..a305b0e 100755
--- a/ghc-deps.sh
+++ b/ghc-deps.sh
@@ -35,42 +35,38 @@ case $MODE in
     *) echo "`basename $0`: Need --provides or --requires" ; exit 1
 esac
 
-if [ -d "$PKGBASEDIR" ]; then
-  SHARED=$(find $PKGBASEDIR -type f -name '*.so')
-fi
-
 files=$(cat)
 
 for i in $files; do
-    LIB_FILE=$(echo $i | grep /libHS | egrep -v "/libHSrts")
-    if [ "$LIB_FILE" ]; then
-	if [ -d "$PKGCONFDIR" ]; then
-	    META=""
-	    SELF=""
-	    case $LIB_FILE in
-		*.so) META=ghc ;;
-		*.a) META=ghc-devel
-		    if [ "$SHARED" ]; then
-			SELF=ghc
-		    fi
-		    ;;
-	    esac
-	    if [ "$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 "$META($i)" ;;
-			*) ;;
-		    esac
-		done
-		if [ "$MODE" = "--requires" -a "$SELF" ]; then
-		    HASHS=$(${GHC_PKG} -f $PKGCONFDIR field $PKGVER id | sed -e "s/^id: \+//")
-		    for i in $HASHS; do
-			echo "$SELF($i)"
-		    done
-		fi
+    META=""
+    SELF=""
+    case $i in
+        */libHSrts.*) ;;
+        */libHS*.so)
+            META=ghc
+	    PKGVER=$(echo $i | sed -e "s%$PKGBASEDIR/\([^/]\+\)/libHS.*%\1%")
+            ;;
+        */package.conf.d/*.conf)
+            META=ghc-devel
+	    PKGVER=$(echo $i | sed -e "s%$PKGCONFDIR/\(.\+\).conf%\1%")
+	    if [ -f $PKGBASEDIR/$PKGVER/libHS$PKGVER-*.so ]; then
+		SELF=ghc
 	    fi
+            ;;
+    esac
+    if [ "$META" -a -d "$PKGCONFDIR" ]; then
+	HASHS=$(${GHC_PKG} -f $PKGCONFDIR field $PKGVER $FIELD | sed -e "s/^$FIELD: \+//")
+	for i in $HASHS; do
+	    case $i in
+		*-*) echo "$META($i)" ;;
+		*) ;;
+	    esac
+	done
+	if [ "$MODE" = "--requires" -a "$SELF" ]; then
+	    HASHS=$(${GHC_PKG} -f $PKGCONFDIR field $PKGVER id | sed -e "s/^id: \+//")
+	    for i in $HASHS; do
+		echo "$SELF($i)"
+	    done
 	fi
     elif [ "$MODE" = "--requires" ]; then
 	if file $i | grep -q 'executable, .* dynamically linked'; then
diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec
index d7d5c0d..ca8b083 100644
--- a/ghc-rpm-macros.spec
+++ b/ghc-rpm-macros.spec
@@ -6,7 +6,7 @@
 #%%global without_hscolour 1
 
 Name:           ghc-rpm-macros
-Version:        1.4.10
+Version:        1.4.11
 Release:        1%{?dist}
 Summary:        RPM macros for building packages for GHC
 
@@ -32,6 +32,7 @@ Requires:       redhat-rpm-config > 20-1.fc21
 # for ghc_version
 Requires:       ghc-compiler
 %if %{undefined without_hscolour}
+# could use ghc_arches here
 %ifarch %{ix86} %{ix86} x86_64 ppc ppc64 alpha sparcv9 armv7hl armv5tel s390 s390x ppc64le aarch64
 Requires:       hscolour
 %endif
@@ -88,6 +89,10 @@ install -p -D -m 0755 %{SOURCE5} %{buildroot}/%{_bindir}/cabal-tweak-flag
 
 
 %changelog
+* Mon Mar  2 2015 Jens Petersen <petersen at redhat.com> - 1.4.11-1
+- fix ghc-deps.sh to handle meta-packages
+- configure --disable-shared if ghc_without_shared
+
 * Fri Feb 27 2015 Jens Petersen <petersen at fedoraproject.org> - 1.4.10-1
 - have to turn off hardening in cabal_configure: set _hardened_ldflags to nil
 
diff --git a/macros.ghc b/macros.ghc
index 756c223..8486cfa 100644
--- a/macros.ghc
+++ b/macros.ghc
@@ -106,7 +106,7 @@ install -D --mode=0644 %{pkgnamever}.conf %{buildroot}%{ghclibdir}/package.conf.
 # ghc_lib_build_without_haddock [name] [version]
 %ghc_lib_build_without_haddock()\
 %global debug_package %{nil}\
-%cabal_configure %{!?without_prof:-p} %{!?ghc_without_shared:--enable-shared} %{?pkg_name:--htmldir=%{ghclibdocdir}/%{pkg_name}-%{version}} %{?1:--docdir=%{_docdir}/ghc-%1%{!?fedora:-%2} --htmldir=%{ghclibdocdir}/%1-%2} %{!?1:--global} %{?ghc_with_lib_for_ghci:--enable-library-for-ghci}\
+%cabal_configure %{!?without_prof:-p} %{?ghc_without_shared:--disable-shared} %{?pkg_name:--htmldir=%{ghclibdocdir}/%{pkg_name}-%{version}} %{?1:--docdir=%{_docdir}/ghc-%1%{!?fedora:-%2} --htmldir=%{ghclibdocdir}/%1-%2} %{!?1:--global} %{?ghc_with_lib_for_ghci:--enable-library-for-ghci}\
 %cabal build\
 %{nil}
 


More information about the scm-commits mailing list