-
Notifications
You must be signed in to change notification settings - Fork 15
/
build.sh
executable file
·93 lines (63 loc) · 1.84 KB
/
build.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
#!/bin/sh
# Run through the (standard) build steps.
# This is mainly to simplify things for the user, who may not be familiar with
# the standard Linux configure/make steps.
# If any of the commands fail, just die.
set -e
# Make sure we're actually in the project directory.
cd "$(dirname "$0")"
# The build stages.
generate_project() {
# Generate the build system, configure, and build the project.
# Make sure we've got autoconf installed.
if ! autoreconf --version >/dev/null 2>&1
then
echo "I couldn't find autoreconf."
echo "This probably means you don't have autoconf or automake installed."
echo "Please install all the dependencies in README.md."
exit 1
fi
echo "Regenerating the project build system..."
./autogen.sh
configure_project
}
configure_project() {
# Configure and build the project.
echo "Configuring the project..."
./configure
build_project
}
build_project() {
# Build the project with make.
# Make sure we've got make installed.
if ! make --version >/dev/null 2>&1
then
echo "I couldn't find make."
echo "This probably means you don't have make installed."
echo "Please install all the dependencies in README.md."
exit 1
fi
echo "Building the project..."
make
}
# Determine what stage to start at, depending on what part of the build system
# has been generated.
if [ -e Makefile ]
then
# Our build system's already ready.
# Just build it.
build_project
elif [ -e configure ]
then
# Our build system's created, but needs to be configured before building.
configure_project
elif [ -e configure.ac ]
then
# We need to regenerate the build system before building it.
generate_project
else
# None of the build system files exist.
echo "ERROR: Cannot find the build system files."
echo "Do you have a clean and uncorrupted source tree?"
exit 2
fi