/
build.sh
executable file
·149 lines (97 loc) · 3.23 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
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
#!/bin/sh
set -e
#--------------------------------------------------------------------------------------------------
# Settings
#--------------------------------------------------------------------------------------------------
Sky="../.."
external="/c/dev/workspace/3rdparty"
#--------------------------------------------------------------------------------------------------
Qt4_version="4.8.7"
Qt5_version="5.11.2"
MinGW_version="5.3.0"
#--------------------------------------------------------------------------------------------------
make_arguments="-j 4"
#--------------------------------------------------------------------------------------------------
# Linux
lib64="/lib/x86_64-linux-gnu"
#--------------------------------------------------------------------------------------------------
# Syntax
#--------------------------------------------------------------------------------------------------
if [ $# != 2 -a $# != 3 ] \
|| \
[ $1 != "qt4" -a $1 != "qt5" -a $1 != "clean" ] \
|| \
[ $2 != "win32" -a $2 != "osx" -a $2 != "linux" ] \
|| \
[ $# = 3 -a "$3" != "deploy" ]; then
echo "Usage: build <qt4 | qt5 | clean> <win32 | osx | linux> [deploy]"
exit 1
fi
#--------------------------------------------------------------------------------------------------
# Configuration
#--------------------------------------------------------------------------------------------------
if [ $1 = "qt4" ]; then
Qt="$external/Qt/$Qt4_version"
else
Qt="$external/Qt/$Qt5_version"
fi
MinGW="$external/MinGW/$MinGW_version/bin"
#--------------------------------------------------------------------------------------------------
# Clean
#--------------------------------------------------------------------------------------------------
if [ $1 = "clean" ]; then
echo "CLEANING"
rm -rf build/qt4/*
rm -rf build/qt5/*
touch build/qt4/.gitignore
touch build/qt5/.gitignore
exit 0
fi
#--------------------------------------------------------------------------------------------------
# Building Sky
#--------------------------------------------------------------------------------------------------
echo "BUILDING Sky"
echo "------------"
if [ $1 = "qt4" ]; then
QT_SELECT=qt4
build="build/qt4"
else
QT_SELECT=qt5
build="build/qt5"
fi
if [ $2 = "win32" ]; then
spec=win32-g++
PATH="$Qt/bin:$MinGW:$PATH"
elif [ $2 = "osx" ]; then
spec=macx-g++
export PATH=/usr/local/opt/qt\@5.5/bin/:$PATH
export LIBRARY_PATH=/usr/local/lib:/usr/local/opt/openssl/lib
elif [ $2 = "linux" ]; then
if [ -d "/usr/lib/x86_64-linux-gnu" ]; then
spec=linux-g++-64
else
spec=linux-g++-32
fi
fi
qmake --version
echo ""
cd $build
qmake -r -spec $spec "CONFIG += release" $Sky
echo ""
if [ $2 = "win32" ]; then
mingw32-make $make_arguments
else
make $make_arguments
fi
echo "------------"
#--------------------------------------------------------------------------------------------------
# Deploying Sky
#--------------------------------------------------------------------------------------------------
if [ "$3" = "deploy" ]; then
echo ""
echo "DEPLOYING Sky"
echo "-------------"
cd $Sky
sh deploy.sh $1 $2
echo "-------------"
fi