transient-example/compile.sh

51 lines
1.3 KiB
Bash
Raw Normal View History

2016-09-19 12:44:51 +00:00
#!/usr/bin/env bash
2016-08-11 13:39:04 +00:00
2016-09-14 07:59:54 +00:00
minnodeversion=6.5.0
2016-09-19 12:44:51 +00:00
if command -v docker >/dev/null 2>&1;
then :
else
echo "docker doesn't seem to be installed. Please install docker." >&2
exit 1
fi
2016-09-14 07:59:54 +00:00
if command -v node >/dev/null 2>&1
then
function version_gt() { test "$(echo "$@" | tr " " "\n" | sort -t '.' -k 1,1 -k 2,2 -k 3,3 -g | head -n 1)" != "$1"; }
version=$(node --version|sed 's/^v//')
if version_gt $minnodeversion $version; then
2016-09-19 12:44:51 +00:00
echo "You should upgrade node.js to at least 6.5.0" >&2
2016-09-14 07:59:54 +00:00
exit 1
fi
else
2016-09-19 12:44:51 +00:00
echo "node.js is needed, please install a recent version (>=6.5.0)" >&2
2016-09-14 07:59:54 +00:00
exit 1
fi
2016-08-11 13:39:04 +00:00
if command -v stack >/dev/null 2>&1
2016-09-02 15:58:12 +00:00
then echo "stack is already installed."
2016-08-11 13:39:04 +00:00
else
echo "stack is not installed. I will try to install it."
curl -sSL https://get.haskellstack.org/ | sh
fi
2016-09-14 07:59:54 +00:00
if command -v stack >/dev/null 2>&1
then :
else
2016-09-19 12:44:51 +00:00
echo "stack failed to install. Please install it manually." >&2
echo "See informations at http://haskellstack.org" >&2
2016-09-14 07:59:54 +00:00
exit 1
fi
2016-08-11 13:39:04 +00:00
# Downloading Haskell Compiler this can be very long
stack setup
stack --stack-yaml stack-ghcjs.yaml setup
# Building the project the first time it will also download and compile
# library
stack build
stack --stack-yaml stack-ghcjs.yaml build
# Link GHCJS result to the correct directory (static/out.jsexe)
./mklink.sh