-
Notifications
You must be signed in to change notification settings - Fork 9
/
config.sh
executable file
·126 lines (97 loc) · 3.39 KB
/
config.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/bash
export HVM=~/.hvm
# source default versions
source $HVM/versions.sh
# source current versions if they exist
if [ -e $HVM/current.sh ]; then
source $HVM/current.sh
fi
# source local versions if they exist
if [ -e .hvmrc ]; then
source .hvmrc
fi
# source the current platform
source $HVM/platform.sh
# configure paths
HAXEPATH=$HVM/versions/haxe/$HAXE
export HAXE_STD_PATH=$HAXEPATH/std
export HAXE_LIBRARY_PATH=$HAXEPATH/std
export HAXELIBPATH=$HVM/versions/haxelib/$HAXELIB
export NEKOPATH=$HVM/versions/neko/$NEKO
export DYLD_FALLBACK_LIBRARY_PATH=$NEKOPATH
export LD_LIBRARY_PATH=$NEKOPATH
# install haxe if needed
if [ ! -d "$HAXEPATH" ]; then
mkdir -p "$HVM/versions/haxe"
ARCHIVE="$HAXEPATH.tar.gz"
DOWNLOADS="http://haxe.org/website-content/downloads"
case $PLATFORM in
'OSX') URL="$DOWNLOADS/$HAXE/downloads/haxe-$HAXE-osx.tar.gz" ;;
'LINUX32') URL="$DOWNLOADS/$HAXE/downloads/haxe-$HAXE-linux32.tar.gz" ;;
'LINUX64') URL="$DOWNLOADS/$HAXE/downloads/haxe-$HAXE-linux64.tar.gz" ;;
esac
if [ "$HAXE" == "dev" ]; then
case $PLATFORM in
'OSX') URL="http://hxbuilds.s3-website-us-east-1.amazonaws.com/builds/haxe/mac/haxe_latest.tar.gz" ;;
'LINUX32') URL="http://hxbuilds.s3-website-us-east-1.amazonaws.com/builds/haxe/linux32/haxe_latest.tar.gz" ;;
'LINUX64') URL="http://hxbuilds.s3-website-us-east-1.amazonaws.com/builds/haxe/linux64/haxe_latest.tar.gz" ;;
esac
fi
echo "downloading $URL"
curl "$URL" -o "$ARCHIVE" -# -L
mkdir -p "$HAXEPATH"
tar -xzf "$ARCHIVE" -C "$HAXEPATH" --strip-components=1
rm "$ARCHIVE"
fi
# install neko if needed
if [ ! -d "$NEKOPATH" ]; then
mkdir -p "$HVM/versions/neko"
ARCHIVE="$NEKOPATH.tar.gz"
case $PLATFORM in
'OSX') URL="http://nekovm.org/_media/neko-$NEKO-osx64.tar.gz?id=download&cache=cache" ;;
'LINUX32') URL="http://nekovm.org/_media/neko-$NEKO-linux.tar.gz?id=download&cache=cache" ;;
'LINUX64') URL="http://nekovm.org/_media/neko-$NEKO-linux64.tar.gz?id=download&cache=cache" ;;
esac
if [ "$NEKO" == "dev" ]; then
case $PLATFORM in
'OSX') URL="http://hxbuilds.s3-website-us-east-1.amazonaws.com/builds/neko/mac/neko_latest.tar.gz" ;;
'LINUX32') URL="http://hxbuilds.s3-website-us-east-1.amazonaws.com/builds/neko/linux32/neko_latest.tar.gz" ;;
'LINUX64') URL="http://hxbuilds.s3-website-us-east-1.amazonaws.com/builds/neko/linux64/neko_latest.tar.gz" ;;
esac
fi
echo "downloading $URL"
curl "$URL" -o "$ARCHIVE" -# -L
mkdir -p "$NEKOPATH"
if [ "$NEKO" == "dev" ]; then
tar -xzf "$ARCHIVE" -C "$NEKOPATH" --strip-components=2
else
tar -xzf "$ARCHIVE" -C "$NEKOPATH" --strip-components=1
fi
rm "$ARCHIVE"
fi
# install haxelib if needed
if [ ! -d "$HAXELIBPATH" ]; then
mkdir -p "$HVM/versions/haxelib"
VERSION=$( echo "$HAXELIB" | tr "." "," )
URL="http://lib.haxe.org/files/3.0/haxelib_client-$VERSION.zip"
ARCHIVE="$HAXELIBPATH.zip"
if [ "$HAXELIB" == "dev" ]; then
URL="https://github.com/HaxeFoundation/haxelib/archive/master.zip"
fi
echo "downloading $URL"
curl "$URL" -o "$ARCHIVE" -# -L
unzip -qq "$ARCHIVE" -d "$HAXELIBPATH"
rm "$ARCHIVE"
if [ -d $HAXELIBPATH/package ]; then
mv $HAXELIBPATH/package/* $HAXELIBPATH
rmdir $HAXELIBPATH/package
fi
if [ -d $HAXELIBPATH/haxelib-master/src ]; then
mv $HAXELIBPATH/haxelib-master/src/* $HAXELIBPATH
rm -rf $HAXELIBPATH/haxelib-master
fi
if [ -d $HAXELIBPATH/src ]; then
mv $HAXELIBPATH/src/* $HAXELIBPATH
rm -rf $HAXELIBPATH/src
fi
fi