[commit: packages/directory] master: Hacky way to support sandbox installations (0371514)

git at git.haskell.org git at git.haskell.org
Fri Dec 18 09:50:16 UTC 2015


Repository : ssh://git@git.haskell.org/directory

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/03715140eced9c0531f700e643bc75cb3ff43289/directory

>---------------------------------------------------------------

commit 03715140eced9c0531f700e643bc75cb3ff43289
Author: Phil Ruffwind <rf at rufflewind.com>
Date:   Fri Apr 10 22:20:02 2015 -0400

    Hacky way to support sandbox installations


>---------------------------------------------------------------

03715140eced9c0531f700e643bc75cb3ff43289
 tools/run-tests | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/tools/run-tests b/tools/run-tests
index 44a675b..cfc1c74 100755
--- a/tools/run-tests
+++ b/tools/run-tests
@@ -16,9 +16,28 @@ then db=conf
 else db=db
 fi
 
-[ -z "$HSFLAGS" ] || HSFLAGS=\ $HSFLAGS
-HSFLAGS="-package-$db ../dist/package.conf.inplace$HSFLAGS"
-HSFLAGS="-optP-include -optP../dist/build/autogen/cabal_macros.h $HSFLAGS"
+# guess which package db(s) we should use;
+# very dirty hack but cabal doesn't expose it to us directly
+if [ -f cabal.sandbox.config ]
+then
+    patt="s/'/'\\\\''/g"
+    dbfn=`grep 'package-db: [^, }]*' cabal.sandbox.config \
+        | sed 's/^[^:]*: //'`
+    HSFLAGS="-package-$db $dbfn "$HSFLAGS
+fi
+if [ -f dist/package.conf.inplace ]
+then
+    HSFLAGS="-package-$db ../dist/package.conf.inplace "$HSFLAGS
+fi
+if [ -f dist/build/autogen/cabal_macros.h ]
+then
+    cabal_macros='-optP-include -optP../dist/build/autogen/cabal_macros.h'
+elif [ -f build/autogen/cabal_macros.h ]
+then
+    cabal_macros='-optP-include -optP../build/autogen/cabal_macros.h'
+fi
+HSFLAGS="$cabal_macros "$HSFLAGS
+HSFLAGS=`printf "%s" "$HSFLAGS" | sed 's/ *$//'`
 export HSFLAGS
 
 # extract the test framework if needed



More information about the ghc-commits mailing list