-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup.sh
executable file
·52 lines (45 loc) · 1.2 KB
/
setup.sh
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
#!/bin/bash
set -euxo pipefail
# Setup directories
readonly PREFIX=$HOME/.local
readonly BINDIR=$PREFIX/bin
mkdir -p $BINDIR
# Get stack if we don't have it already
if [[ ! -x $BINDIR/stack ]]; then
if [[ $TRAVIS_OS_NAME == "osx" ]]; then
readonly WILDCARDS=
else
readonly WILDCARDS=--wildcards
fi
curl -L https://www.stackage.org/stack/$TRAVIS_OS_NAME-x86_64 | tar xz --strip-components=1 $WILDCARDS -C $BINDIR '*/stack'
fi
# Get NASM if we don't have it already
# To upgrade, we need to remove the cache first
readonly NASMVER=2.15.05
if [[ ! -x $BINDIR/nasm ]]; then
readonly SRCDIR=$HOME/src
readonly NASMDIR=$SRCDIR/nasm-$NASMVER
mkdir -p $SRCDIR
pushd $SRCDIR
case $TRAVIS_OS_NAME in
linux)
curl -L https://www.nasm.us/pub/nasm/releasebuilds/$NASMVER/nasm-$NASMVER.tar.gz | tar xz
pushd $NASMDIR
./configure --prefix=$PREFIX
make install
popd
;;
osx)
curl -O -L https://www.nasm.us/pub/nasm/releasebuilds/$NASMVER/macosx/nasm-$NASMVER-macosx.zip
unzip nasm-$NASMVER-macosx.zip
cp $NASMDIR/nasm $BINDIR
;;
*)
echo "Unsupported OS: $TRAVIS_OS_NAME"
exit 1
;;
esac
popd
fi
stack --version
nasm -v