Permalink
Browse files

more fixings

  • Loading branch information...
1 parent da3eb31 commit 7452e20604509c7a5548b6d249877b107a65e17a @luciferous committed May 10, 2012
Showing with 38 additions and 38 deletions.
  1. +29 −33 bin/compile
  2. +6 −4 bin/detect
  3. +3 −1 bin/release
View
@@ -1,52 +1,48 @@
#!/usr/bin/env bash
# bin/compile <build-dir> <cache-dir>
-# fail fast
-set -e
+# Fail fast and fail hard.
+set -eo pipefail
-BIN_DIR=$(dirname $0)
BUILD_DIR=$1
CACHE_DIR=$2
-# include .files when moving things around
-shopt -s dotglob
-
cd $BUILD_DIR
-# move app things to www
-mkdir -p $CACHE_DIR/www
-mv * $CACHE_DIR/www
-mv $CACHE_DIR/www .
+mkdir -p $CACHE_DIR
-# keep Procfile
-if [ -f www/Procfile ]; then
- mv www/Procfile .
-fi
+cp -R $CACHE_DIR/ghc ghc &> /dev/null || true
+cp -R $CACHE_DIR/cabal .cabal &> /dev/null || true
-GHC_URL="http://lcfrs.org/heroku-buildpack-haskell/ghc.tar.gz"
-echo "-----> Bundling GHC"
-curl --silent --max-time 60 --location "$GHC_URL" | tar xz
+if [ ! -e ghc ]; then
+ GHC_URL="http://s3.amazonaws.com/heroku-buildpack-haskell/ghc.tar.gz"
+ echo "-----> Downloading GHC"
+ curl -# --max-time 120 -L "$GHC_URL" | tar xz
+fi
-CABAL_URL="http://lcfrs.org/heroku-buildpack-haskell/cabal.tar.gz"
-echo "-----> Bundling Cabal"
-curl --silent --max-time 60 --location "$CABAL_URL" | tar xz
+if [ ! -e .cabal ]; then
+ CABAL_URL="http://s3.amazonaws.com/heroku-buildpack-haskell/cabal.tar.gz"
+ echo "-----> Bundling Cabal"
+ curl -# --max-time 120 -L "$CABAL_URL" | tar xz
+fi
-# make ghc and cabal available in bin
mkdir -p bin
-ln -s /app/ghc/bin/ghc bin/ghc
-ln -s /app/.cabal/bin/cabal bin/cabal
+ln -s ghc/bin/ghc bin/ghc
+ln -s .cabal/bin/cabal bin/cabal
-mkdir -p /app/usr/lib
-ln -s /usr/lib/libgmp.so.3 /app/usr/lib/libgmp.so
+mkdir -p lib
+ln -s /usr/lib/libgmp.so.3 lib/libgmp.so
-cat >>boot.sh <<EOF
-export LD_LIBRARY_PATH=/app/usr/lib
-EOF
+ghc/bin/ghc-pkg describe base > base.conf
+sed -i "s#ld-options:#ld-options: -L`pwd`/lib#"
+ghc/bin/ghc-pkg update base.conf
+rm base.conf
-cd $BUILD_DIR
-bin/cabal install
+.cabal/bin/cabal update
+.cabal/bin/cabal install
-chmod +x boot.sh
+rm -rf $CACHE_DIR/ghc
+cp -R ghc $CACHE_DIR/ghc
-# clean the cache
-rm -rf $CACHE_DIR/*
+rm -rf $CACHE_DIR/cabal
+cp -R .cabal $CACHE_DIR/cabal
View
@@ -1,7 +1,9 @@
#!/usr/bin/env bash
+set -e
-if [ -f $1/*.cabal ]; then
- echo "Haskell" && exit 0
-else
- echo "no" && exit 1
+echo $1
+
+if test -n "$(find "$1" -maxdepth 1 -name '*.cabal' -print -quit)"
+then echo Haskell
+else echo no; exit 1
fi
View
@@ -1,7 +1,9 @@
#!/bin/sh
+$BUILD_DIR=$1
+
cat <<EOF
---
config_vars:
- PATH: /app/.cabal/bin:/app/bin:/usr/local/bin:/usr/bin:/bin
+ PATH: $BUILD_DIR/.cabal/bin:$BUILD_DIR/bin:/usr/local/bin:/usr/bin:/bin
EOF

0 comments on commit 7452e20

Please sign in to comment.