-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauto-build-env
executable file
·58 lines (45 loc) · 1.11 KB
/
auto-build-env
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
#!/usr/bin/env ruby
dependencies =
"aclocal",
"autoconf",
"automake",
"autoreconf"
commands =
"aclocal",
"autoconf",
"automake --add-missing",
"autoreconf",
"automake",
"./configure"
# ASCII text coloring
def purpify(text)
"\033[1;35m" + text + "\033[0m"
end
def greenify(text)
"\033[0;32m" + text + "\033[0m"
end
def redify(text)
"\033[0;31m" + text + "\033[0m"
end
# Check dependencies
missing_dependencies = Array.new
dependencies.each do |dependency|
puts "#{purpify "build-env:"} #{greenify "checking #{dependency}"}"
if not system("which #{dependency}", :out => "/dev/null")
missing_dependencies.push dependency
end
end
if not missing_dependencies.empty?
puts redify "build-env failed..."
missing_dependencies.each do |missing|
puts redify "Missing #{missing}"
end
puts redify "Install the missing dependencies and run again."
exit 1
end
# Execute build commands
commands.each do |command|
puts "#{purpify "build-env:"} #{greenify "#{command}"}"
system("#{command}")
end
puts greenify "\nYour environment setup is complete. Run `make` to build your project.\n"