-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevluaBuild
More file actions
executable file
·181 lines (158 loc) · 4.38 KB
/
evluaBuild
File metadata and controls
executable file
·181 lines (158 loc) · 4.38 KB
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#!/bin/bash
# Init config file
. ./.meta && source ./.functions
install_fresh=false
PACKAGE_NAME="evlua"
MAINTAINER="support@tekenlight.com"
DESCRIPTION="EVLUA build"
print_usage() {
echo " "
echo "options:"
echo "-h, --help show brief help"
echo "-f, --fresh install fresh"
echo "-b, --base_dir specify the base dir to us. All directories/files will be installed inside this directory itself - defaulted to $HOME"
echo "-v, --version specify the release version of the package - defaulted to 0.0.1"
echo "-lp, --lua_path checks for lua instance in the path provided"
echo "-rp, --lua_rocks_path checks for lua rocks instance in the path provided"
echo "-pp, --postgres_path checks for postgres instance in the path provided"
exit 0
}
while [[ $# -gt 0 ]]; do
case "$1" in
-b | --base_dir)
if [[ -z "$2" ]]; then
echo "Error: Base dir requires an argument."
print_usage
exit 1
fi
base_dir="$2"
shift 2
;;
-v | --version)
if [[ -z "$2" ]]; then
echo "Error: version requires an argument."
print_env_usage
exit 1
fi
version="$2"
shift 2
;;
-lp | --lua_path)
if [[ -z "$2" ]]; then
echo "Error: lua path requires an argument."
print_env_usage
exit 1
fi
lua_path="$2"
shift 2
;;
-rp | --lua_rocks_path)
if [[ -z "$2" ]]; then
echo "Error: lua rocks path requires an argument."
print_env_usage
exit 1
fi
lua_rocks_path="$2"
shift 2
;;
-pp | --postgres_path)
if [[ -z "$2" ]]; then
echo "Error: postgres path requires an argument."
print_env_usage
exit 1
fi
postgres_path="$2"
shift 2
;;
-h | --help)
print_usage
exit 0
;;
-f | --fresh)
install_fresh=true
shift
;;
*)
echo "Unknown option: $1"
print_usage
exit 1
;;
esac
done
if [ ! -v base_dir ]; then
echo "base dir not set using default value $HOME"
base_dir=$HOME
fi
if [ ! -v version ]; then
echo "version not set using default value 0.0.1"
version="0.0.1"
fi
if [ ! -v lua_path ]; then
lua_path=$base_dir/lua
fi
if [ ! -v lua_rocks_path ]; then
lua_rocks_path=$base_dir/luarocks
fi
if [ ! -v postgres_path ]; then
postgres_path=$base_dir/postgres
fi
echo "base_path: $base_dir"
echo "lua_path: $lua_path"
echo "lua_rocks_path: $lua_rocks_path"
echo "postgres_path: $postgres_path"
echo "version: $version"
##################### platform ####################
platform_name=$(uname -m)
if [ "$platform_name" = "x86_64" ]; then
platform_name="amd64"
fi
################# set directories #################
# build log directory
log_dir=$base_dir/logs
rm -rf $log_dir
mkdir -p $log_dir
# evlua build directory
evlua_path=$base_dir/evlua
mkdir -p $evlua_path
# install directory
install_dir=$base_dir/installables
if [ "$install_fresh" = "true" ]; then
echo "doing fresh installation"
rm -rf $install_dir
fi
mkdir -p $install_dir
# external library directory
third_party_library=$base_dir/evlua/tp-libraries
mkdir -p $third_party_library
###################################################
function build_evlua_foundation() {
echo "evlua will be build in $evlua_path and installed in $install_dir"
foundation_clone_dir=$evlua_path/evfoundation-repos
clone_libraries foundation
foundation_build_dir=$evlua_path/build
echo "cleaning foundation's dir: $foundation_build_dir, to start fresh build"
rm -rf $foundation_build_dir
mkdir -p $foundation_build_dir
build_foundation
}
function build_lua() {
echo "custom lua will be build in $evlua_path and installed in $lua_path"
lua_clone_dir=$evlua_path/custom-lua-repos
rm -rf $lua_clone_dir
mkdir -p $lua_clone_dir
clone_libraries lua
build_custom_lua
}
function clone_and_build_evlua() {
evlua_dir=$evlua_path/evlua-repos
mkdir -p $evlua_dir
clone_libraries evlua
build_evlua
}
build_evlua_foundation
build_lua
install_luarocks_if_not_already
install_postgres_if_not_already
build_and_install_evpoco
clone_and_build_evlua
build_executable