-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.sh
executable file
·95 lines (94 loc) · 2.49 KB
/
configure.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
#!/bin/bash
set -e
if [ "$#" -eq "0" ]; then
echo "Valid arguments are 'arm' or 'host'"
exit 1
fi
source bash-scripts/helpers.sh
update_license_copyright_year
run_shfmt_and_shellcheck ./*.sh
# Install required tools
install_packages make subversion
install_cmake
if [ "$1" == "arm" ]; then
install_gcc_arm_none_eabi
else
install_package gcc
fi
write_sourceme
download_inno() {
case "$OSTYPE" in
msys)
local result
result=$(download_unpack f5afb18883f8d9d098053dbf8789fbbc https://downloads.sourceforge.net/project/innounp/innounp/innounp%200.50/innounp050.rar "ce" "" "")
INNO="$result/innounp.exe"
;;
linux*)
install_debian_packages innoextract
;;
*)
die "Unsupported OS: $OSTYPE"
;;
esac
}
# Install qpc and qm
install_qp_qm() { #helpmsg: Install cmake
case "$OSTYPE" in
msys)
QP_VERSION="qp-windows_7.1.3"
QP_FOLDER="$TOOLS_FOLDER/$QP_VERSION"
if [ ! -d "$QP_FOLDER" ]; then
download_inno
download ebbfb54de1cd2d86b64ede1c63ccc76c https://downloads.sourceforge.net/project/qpc/QP-bundle/7.1.3/qp-windows_7.1.3.exe ""
mkdir -p "$QP_FOLDER"
cmd="$INNO -x $(cygpath -w "$TOOLS_FOLDER/$QP_VERSION.exe") -q -d$(cygpath -w "$TOOLS_FOLDER/$QP_VERSION")"
$cmd
fi
export QPC_BUNDLE="$QP_FOLDER/{app}"
;;
linux*)
local result
result=$(download_unpack 96dbd928b542b2030da6e2df94b66379 https://downloads.sourceforge.net/project/qpc/QP-bundle/7.1.3/qp-linux_7.1.3.zip "ce" "" "")
export QPC_BUNDLE="$result/qp"
chmod +x "$QPC_BUNDLE/qm/bin/qm"
;;
*)
die "Unsupported OS: $OSTYPE"
;;
esac
}
install_qp_qm
case "$OSTYPE" in
msys)
"$QPC_BUNDLE/qm/bin/qm" model/model.qm -c
;;
linux*)
install_debian_packages libqt5svg5 libqt5printsupport5
export QT_QPA_PLATFORM=offscreen
"$QPC_BUNDLE/qm/bin/qm" model/model.qm -c
;;
*)
die "Unsupported OS: $OSTYPE"
;;
esac
# Create config.cmake
echo "# Configured variables" >config.cmake
echo "# Do not edit manually!" >>config.cmake
echo "set(QPC_FOLDER $(realpath --relative-to=. "$QPC_BUNDLE"/qpc))" >>config.cmake
if [ "$OSTYPE" == "msys" ]; then
echo "set (QP_PORT \${QPC_FOLDER}/ports/win32)" >>config.cmake
else
echo "set (QP_PORT \${QPC_FOLDER}/ports/posix)" >>config.cmake
fi
# Done! Now call cmake
rm -rf CMakeFiles/
rm -f CMakeCache.txt cmake_install.cmake compile_commands.json Makefile qp_demo*
if [ "$1" == "host" ]; then
chmod +x "$QPC_BUNDLE"/qm/bin/qm
"$QPC_BUNDLE"/qm/bin/qm model/model.qm -c
call_cmake .
elif [ "$1" == "arm" ]; then
call_cmake .. -DCMAKE_TOOLCHAIN_FILE=arm-none-eabi.cmake
else
echo "Usage: $0 arm|host"
fi