summaryrefslogtreecommitdiff
path: root/staging/ghc/print-provides-replaces.sh
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2012-06-12 00:01:37 +0000
committerroot <root@rshg054.dnsready.net>2012-06-12 00:01:37 +0000
commit14b46fb49966c5beb34127a600e7be2a04d0821b (patch)
tree65525e60fb02fa22c1f3acfd99f60d500606f1f8 /staging/ghc/print-provides-replaces.sh
parent306ac55c1e99cfb5801ef0d9acf2a11d3994d80d (diff)
Tue Jun 12 00:01:37 UTC 2012
Diffstat (limited to 'staging/ghc/print-provides-replaces.sh')
-rwxr-xr-xstaging/ghc/print-provides-replaces.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/staging/ghc/print-provides-replaces.sh b/staging/ghc/print-provides-replaces.sh
new file mode 100755
index 000000000..33d1da051
--- /dev/null
+++ b/staging/ghc/print-provides-replaces.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+. PKGBUILD
+
+if [[ ! -d src/ghc-${pkgver}/libraries ]]; then
+ echo "error: no directory src/ghc-${pkgver}/libraries: You must extract the source tarball under src/"
+ exit 1
+fi
+
+declare -A exclude
+# no Win32 cause we're not building on windows
+exclude['Win32']=1
+# no integer-simple because we use integer-gmp
+exclude['integer-simple']=1
+# extract excluded libraries from ghc.mk
+for exclude_pkg in $(sed 's/PKGS_THAT_ARE_INTREE_ONLY := //p' -n src/ghc-${pkgver}/ghc.mk); do
+ exclude[${exclude_pkg}]=1
+done
+
+cd src/ghc-${pkgver}/libraries
+
+# $1 is the name of the variable
+# $2 is the string for the test, either '=' or '<'
+print_var() {
+ printf "$1=("
+ for pkg in $(ls ./*/*.cabal | awk -F '/' '{ print $2 }'); do
+ [[ ${exclude[${pkg}]} ]] && continue
+ version=$(awk 'tolower($0) ~ /^version:/ {print $2 }' $pkg/$pkg.cabal)
+ printf "'haskell-$pkg$2$version'\n "
+ done
+ # also add cabal
+ version=$(awk 'tolower($0) ~ /^version:/ { print $2 }' Cabal/Cabal/Cabal.cabal)
+ printf "'haskell-cabal$2$version'\n "
+ echo -e '\b)'
+}
+
+print_var 'provides' '='
+print_var 'replaces' '<'