From aa60c13ee0784cc2e8765c55a224b035d57ee64f Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Fri, 6 Jul 2018 05:25:22 -0400 Subject: Updated gi script to match g script. --- gi | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/gi b/gi index 907baf11..833cac1b 100755 --- a/gi +++ b/gi @@ -1,24 +1,49 @@ #!/bin/bash + +rootname=$(cat /etc/debian_chroot 2>/dev/null) +echo $PATH | grep '\.stack' >/dev/null && rootname="stack" +BUILDB= +for b in build/b/Presence/monitortty.o .stack-work/dist/x86_64-linux/Cabal-*/build/Presence/monitortty.o; do + if [ -f $b ]; then + BUILDB=$(dirname $(dirname $b)) + break + fi +done +[ -z "$BUILDB" ] && { echo "Where is monitortty.o?"; exit 1; } + warn="-freverse-errors -fwarn-unused-imports -Wmissing-signatures -fdefer-typed-holes" exts="-XOverloadedStrings -XRecordWildCards" -defs="-DXMPP -DBENCODE_AESON -DTHREAD_DEBUG" -hide="-hide-package crypto-random -hide-package crypto-api -hide-package crypto-numbers -hide-package cryptohash -hide-package prettyclass" +defs="-DBENCODE_AESON -DTHREAD_DEBUG" +hidden="crypto-random crypto-api crypto-numbers cryptohash prettyclass" +[ "$rootname" == "stack" ] && hidden="" +hide="" +for h in $hidden;do + # too slow. + # ghc-pkg latest $h && hide="$hide -hide-package $h" + hide="$hide -hide-package $h" +done + +if [ "$rootname" == "stretch" ] + then + echo "Building with cryptonite backport. (chroot = $rootname)" + defs="$defs -DCRYPTONITE_BACKPORT -icryptonite-backport" + warn="$BUILDB/cbits/cryptonite_salsa.o $BUILDB/cbits/cryptonite_xsalsa.o $warn" + fi root=${0%/*} cd "$root" me=${0##*/} me=${me%.*} +set -x ghci -fobject-code \ $hide \ $exts \ $defs \ - -hidir build/$me -odir build/$me \ + -hidir build/$me$rootname -odir build/$me$rootname \ -iPresence \ -iArchive \ -isrc \ - build/b/Presence/monitortty.o \ - build/b/cbits/cryptonite_salsa.o \ - build/b/cbits/cryptonite_xsalsa.o\ + $BUILDB/Presence/monitortty.o \ $warn \ "$@" -- cgit v1.2.3