forked from heroku/heroku-buildpack-hello
/
compile
executable file
·61 lines (44 loc) · 1.24 KB
/
compile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
# bin/compile <build-dir> <cache-dir>
mktmpdir() {
dir=$(mktemp -t node-$1-XXXX)
rm -rf $dir
mkdir -p $dir
echo $dir
}
function indent() {
c='s/^/ /'
case $(uname) in
Darwin) sed -l "$c";;
*) sed -u "$c";;
esac
}
S3_BUCKET="cl-heroku"
CCL_PACKAGE="http://${S3_BUCKET}.s3.amazonaws.com/ccl-1.7.tgz"
# parse and derive params
BUILD_DIR=$1
CACHE_DIR=$2
CACHE_QUICKLISP_DIR="$CACHE_DIR/quicklisp/"
BUILD_QUICKLISP_DIR="$BUILD_DIR/quicklisp/"
CCL_DIR="$(mktmpdir ccl)"
# don't we only want to do this if not there?
echo "-----> Fetching ccl"
mkdir -p $CCL_DIR && curl $CCL_PACKAGE -s -o - | tar xzf - -C $CCL_DIR
# add to slug
cp -r $CCL_DIR $BUILD_DIR/ccl
echo echo "ccl installed" | indent
# setting up paths for building
# unpack existing cache
# nodejs is more elaborate; this ought work
if [ -d $CACHE_QUICKLISP_DIR ]; then
cp -r $CACHE_QUICKLISP_DIR $BUILD_QUICKLISP_DIR
fi
echo "-----> Installing dependencies with quicklisp"
# run lisp to load quicklisp packages
ccl/scripts/ccl -l compile.lisp
echo "dependencies installed" | indent
# copy quicklisp back to cache
if [ -d $CACHE_QUICKLISP_DIR ]; then
rm -rf $CACHE_QUICKLISP_DIR
cp -r $BUILD_QUICKLISP_DIR $CACHE_QUICKLISP_DIR
fi