-
Notifications
You must be signed in to change notification settings - Fork 1
/
make.sh
executable file
·203 lines (187 loc) · 4.75 KB
/
make.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
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#!/bin/bash
#
# This file is part of LXE project. See LICENSE file for licensing information.
export MAIN_DIR="$(dirname $(realpath -s ${0}))"
# Setup
cd "${MAIN_DIR}"
. "${MAIN_DIR}/settings.sh"
. "${MAIN_DIR}/tools/define-paths.sh"
. "${MAIN_DIR}/tools/configure-options.sh"
. "${MAIN_DIR}/tools/util.sh"
# Help, version, clean up an full clean up
if [ "${1}" = "help" ]
then
echo \
"Usage: make [option] [package 1] [package 2] [package 3] ...
Options:
all build all available packages
list display the list of available packages
download download sources without build of packages
clean clean up (delete dist/ subdirectory with all files)
distclean full clean up (delete dist/ and src/ subdirectories with all files)
version display LXE version and exit
help display this help and exit
Examples:
make
make all
make qt5 qwt
make qtbase qtserialport qtscript
make gdal freeglut
make \"download\"
make \"download all\"
make \"download ffmpeg sdl2\"
make clean
make distclean
Settings:
Edit file settings.sh or add file settings.sh.<any-suffix>
Configs:
Some samples are available in subdirectory etc/
"
exit 0
elif [ "${1}" = "version" ]
then
if [ -d "${MAIN_DIR}/.git" ] && which git &>/dev/null
then
git describe --tags
elif [ -e "${MAIN_DIR}/changelog" ]
then
grep '^--- ' "${MAIN_DIR}/changelog" | head -n1 | \
sed -ne "s|^--- \(.*\) ---$|\1|p"
else
echo "Version can not be determined!"
echo "Clone original git repo or copy original"\
"tarball with sources of this project."
exit 1
fi
exit 0
elif [ "${1}" = "list" ]
then
grep 'PKG=' "${MAIN_DIR}/pkg"/*.sh | sed -ne "s|.*pkg/\(.*\)\.sh:.*|\1|p"
exit 0
elif [ "${1}" = "clean" ] && [ -z "${2}" ]
then
read -p "Do you wish to delete all files from \"dist\" subdirectory? [y/N] " REPLY
case "${REPLY}" in
"y" | "Y" | "yes" | "Yes")
echo "rm -rf \"${MAIN_DIR}/dist\""
rm -rf "${MAIN_DIR}/dist"
;;
*)
echo "Aborted."
;;
esac
exit 0
elif [ "${1}" = "distclean" ] && [ -z "${2}" ]
then
"${MAIN_DIR}/make.sh" clean
read -p "Do you wish to delete all files from \"src\" subdirectory? [y/N] " REPLY
case "${REPLY}" in
"y" | "Y" | "yes" | "Yes")
echo "rm -rf \"${MAIN_DIR}/src\""
rm -rf "${MAIN_DIR}/src"
;;
*)
echo "Aborted."
;;
esac
if [ "${LXE_USE_CCACHE}" = "true" ]
then
read -p "Do you wish to delete all files from \"cache\" subdirectory? [y/N] " REPLY
case "${REPLY}" in
"y" | "Y" | "yes" | "Yes")
echo "rm -rf \"${MAIN_DIR}/cache\""
rm -rf "${MAIN_DIR}/cache"
;;
*)
echo "Aborted."
;;
esac
fi
exit 0
elif [ "${1}" = "download" ]
then
export DOWNLOAD_ONLY="true"
fi
# Make packages
BuildPackages()
{
if [ ! -z "${1}" ]
then
if [ "${1}" = "all" ]
then
BuildAllPackages
elif [ "${1}" = "download" ]
then
if [ "${2}" = "all" ]
then
BuildAllPackages
elif [ ! -z "${2}" ]
then
BuildPackagesFromOptions ${@}
else
BuildPackagesFromSettings
fi
else
BuildPackagesFromOptions ${@}
fi
elif [ ! -z "${LOCAL_PKG_LIST}" ]
then
BuildPackagesFromSettings
fi
}
BuildAllPackages()
{
for ARG in $(${0} list)
do
IsOption "${ARG}" && continue || true
IsIgnoredPackage "${ARG}" && continue || true
if [ -e "${MAIN_DIR}/pkg/${ARG}.sh" ]
then
. "${MAIN_DIR}/pkg/${ARG}.sh" || exit 1
else
echo "Package ${ARG} does not exist!"
exit 1
fi
done
}
BuildPackagesFromOptions()
{
for ARG in ${@}
do
IsOption "${ARG}" && continue || true
if [ -e "${MAIN_DIR}/pkg/${ARG}.sh" ]
then
. "${MAIN_DIR}/pkg/${ARG}.sh" || exit 1
else
echo "Package ${ARG} does not exist!"
exit 1
fi
done
}
BuildPackagesFromSettings()
{
for ARG in ${LOCAL_PKG_LIST}
do
if [ -e "${MAIN_DIR}/pkg/${ARG}.sh" ]
then
. "${MAIN_DIR}/pkg/${ARG}.sh" || exit 1
else
echo "Package ${ARG} does not exist!"
exit 1
fi
done
}
for CONFIG in ${CONFIGS}
do
if [ -e "${MAIN_DIR}/etc/${CONFIG}.sh" ]
then
. "${MAIN_DIR}/etc/${CONFIG}.sh"
else
echo "Config ${CONFIG} does not exist!"
exit 1
fi
DefinePaths
PrepareDirs
PrepareConfigureOpts
BuildPackages ${@}
done