forked from sibuserv/lxe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.sh
executable file
·118 lines (105 loc) · 2.76 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
#!/bin/bash
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}" = "-h" ] || [ "${1}" = "--help" ]
then
echo \
"Usage: ./make.sh [option] [package 1] [package 2] [package 3] ...
Options:
clean clean up (delete dist/ subdirectory with all files)
distclean full clean up (delete dist/ and src/ subdirectories with all files)
-V, --version display LXE version and exit
-h, --help display this help and exit
Examples:
./make.sh
./make.sh qt5
./make.sh qtbase qtserialport qtscript
./make.sh gdal freeglut
./make.sh clean
./make.sh distclean
Settings:
Edit file settings.sh
Configs:
Some samples are available in subdirectory etc/
"
exit 0
elif [ "${1}" = "-V" ] || [ "${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}" = "clean" ] && [ -z "${2}" ]
then
for CONFIG in ${CONFIGS}
do
PREFIX="${MAIN_DIR}/dist/${CONFIG}"
if [ -d "${PREFIX}" ]
then
echo "rm -rf \"${PREFIX}\""
rm -rf "${PREFIX}"
fi
done
exit 0
elif [ "${1}" = "distclean" ] && [ -z "${2}" ]
then
"${MAIN_DIR}/make.sh" clean
echo "rm -rf \"${MAIN_DIR}/src\""
rm -rf "${MAIN_DIR}/src"
exit 0
fi
# Make packages
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
if [ ! -z "${1}" ]
then
for ARG in ${@}
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
elif [ ! -z "${LOCAL_PKG_LIST}" ]
then
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
fi
done