-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·134 lines (120 loc) · 2.57 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
#!/bin/sh
export QT_DIR="${HOME}/Qt"
export QT_VERSION="5.13.1"
export QT_API="5.13.0"
package="./cmd/firefly"
binary_name="firefly"
platform_windows="windows_64_shared"
platform_linux="linux"
platform_darwin="darwin"
build()
{
echo ">> build"
# calling go build directly is slightly faster (one second on my machine which rougly equals 8%)
export CGO_CXXFLAGS="-g -O2 -D QT_NO_DEPRECATED_WARNINGS"
go build -ldflags '-s -w' -mod=vendor -o $binary_name -v $package
# qtdeploy -fast build desktop $package
}
deploy()
{
case $1 in
"all") deploy_windows; deploy_linux; deploy_macos
;;
"windows") deploy_windows
;;
"linux") deploy_linux
;;
"macos") deploy_macos
;;
*) echo ">> deploy";
qtdeploy build desktop $package
;;
esac
}
deploy_windows()
{
echo ">> deploy for windows"
qtdeploy -docker build $platform_windows $package
}
deploy_linux()
{
echo ">> deploy for linux"
qtdeploy -docker build $platform_linux $package
}
deploy_macos()
{
echo ">> deploy for macOS"
qtdeploy -vagrant build $platform_darwin $package
}
rcc()
{
echo ">> resource compiler"
qtrcc desktop $package
}
moc()
{
echo ">> meta object compiler"
qtmoc desktop $package
}
minimal()
{
echo ">> minimal"
qtminimal desktop $package
}
setup()
{
echo ">> qt setup"
qtsetup
}
clean()
{
echo ">> clean"
go clean
rm $binary_name
}
help()
{
echo "Firefly build script"
echo ""
echo "Usage:"
echo " build.sh Build for the local platform."
echo " build.sh <command>"
echo ""
echo "Commands:"
echo " build Build for the local platform."
echo " deploy [<platform>] Deploy Firefly for a specific platform."
echo " rcc Run the resource compiler."
echo " moc Run the meta object compiler."
echo " minimal Run qtminimal."
echo " setup Setup qt bindings."
echo " clean Clean go build files."
echo " help Print this help."
echo ""
echo "Supported Platforms:"
echo " windows"
echo " linux"
echo " macos"
}
case $1 in
"build") build
;;
"deploy") deploy $2
;;
"rcc") rcc
;;
"moc") moc
;;
"minimal") minimal
;;
"setup") setup
;;
"clean") clean
;;
"") build
;;
"help" | "h" | "--help" | "-h" | "-help" | "--h") help
;;
*) echo "unknown command \"$1\"";
echo "use help for usage"
;;
esac