This repository has been archived by the owner on Jun 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
install
executable file
·142 lines (122 loc) · 3.3 KB
/
install
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/usr/bin/env bash
DESCRIPTION="\
Description: Fetch, merge, and build the components of the
LunarGLASS project
"
DEPENDENCIES="\
Dependencies: bash, wget, libffi-dev, flex, bison, git, subversion
"
USAGE="\
Usage: ./install [options] [fetch|merge|build|all]
Just running ./install with no arguments will fetch, then merge, then
build the LunarGLASS project. Note for developers: this script will
destory any uncommitted changes.
Options:
-h --help Print out this Usage info
--version=<version> Specify a revision to use
Commands:
fetch Get the code from the Mesa and the LLVM projects
merge Merge in LunarGLASS changes
build Build LunarGLASS
all [Default] perform a fetch, merge, and build
"
# Main functionality
function fetch {
echo "Fetching ..."
echo "Fetching Mesa"
rm -rf mesa MesaLib-7.10.1* || exit 1
wget ftp://freedesktop.org/pub/mesa/7.10.1/MesaLib-7.10.1.tar.bz2 || exit 1
tar -xjf MesaLib-7.10.1.tar.bz2 || exit 1
mv Mesa-7.10.1 mesa || exit 1
rm MesaLib-7.10.1* || exit 1
echo "Mesa fetched"
echo
echo "Fetching LLVM"
pushd Core
rm -rf LLVM
mkdir LLVM
pushd LLVM
wget http://llvm.org/releases/2.9/llvm-2.9.tgz || exit 1
tar -zxf llvm-2.9.tgz || exit 1
rm llvm-2.9.tgz || exit 1
popd
popd
echo "LLVM fetched"
echo "Fetching done"
echo
}
function merge {
echo "Merging LunarGLASS changes ..."
# Undo the effect of having checked out LunarGLASS before
find . -name ".svn" | while read i; do rm -rf $i; done
svn checkout -r $VERSION --force https://lunarglass.googlecode.com/svn/trunk/ . || exit 1
# Revert all the directories (but leave the scripts intact to preserve local changes)
find ./* -prune -type d -exec svn revert --depth=infinity {} \+ || exit 1
echo "Merging done"
echo
}
function build {
echo "Building ..."
echo "Building LLVM, this may take a while"
mkdir -p Core/LLVM/llvm-2.9/build || exit 1
pushd Core/LLVM/llvm-2.9/build
../configure || exit 1
make || exit 1
make install DESTDIR=`pwd`/install || exit 1
popd
echo "LLVM built"
echo
echo "Building LunarGLASS"
pushd Standalone
make || exit 1
install StandAlone ../tools/LunarGLASS || exit 1
popd
echo "LunarGLASS built"
echo
echo "Building done, binary located at tools/LunarGLASS"
echo "Tests located in test"
echo "Example run: ./tools/LunarGLASS test/test.frag"
}
function all {
fetch
merge
build
}
function showHelp {
echo "$DESCRIPTION"
echo "$DEPENDENCIES"
echo "$USAGE"
}
VERSION="HEAD"
# Command-line argument Handling
# No arguments passed
if [[ -z "$*" ]]; then all; fi;
# Arguments passed
for i in $*; do
case $i in
fetch)
fetch
;;
merge)
merge
;;
build)
build
;;
all)
all
;;
-h|--h)
showHelp
exit 0
;;
--version=*)
VERSION=`echo $i | sed 's/[-a-zA-Z0-9]*=//'`
;;
*)
showHelp
exit 1
;;
esac
done
echo "Done"