-
Notifications
You must be signed in to change notification settings - Fork 17
/
gen_install.sh
executable file
·165 lines (140 loc) · 4.73 KB
/
gen_install.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
#!/usr/bin/env bash
# Useful script to generate installer
################# PROJECT SPECIFIC VARIABLES
cmake_opt="-DBUILD_HIVE_TESTS=FALSE -DENABLE_HIVE_CPACK=TRUE -DENABLE_CODE_SIGNING=TRUE -DENABLE_HIVE_FEATURE_SPARKLE=FALSE"
############################ DO NOT MODIFY AFTER THAT LINE #############
# Get absolute folder for this script
selfFolderPath="`cd "${BASH_SOURCE[0]%/*}"; pwd -P`/" # Command to get the absolute path
# Check if setup_fresh_env has been called
if [ ! -f "${selfFolderPath}.initialized" ]; then
echo "ERROR: Please run setup_fresh_env.sh (just once) after having cloned this repository."
exit 4
fi
# Include default values
. "${selfFolderPath}.defaults.sh"
# Include utils functions
. "${selfFolderPath}3rdparty/avdecc/scripts/bashUtils/utils.sh"
# Include config file extension
. "${selfFolderPath}extend_config_file.sh"
# Include config file functions
. "${selfFolderPath}3rdparty/avdecc/scripts/bashUtils/load_config_file.sh"
# Load config file
configFile=".hive_config"
loadConfigFile
use_sparkle=0
if [ "x${params["use_sparkle"]}" == "xtrue" ]; then
use_sparkle=1
fi
if [ $use_sparkle -eq 1 ]; then
cmake_opt="${cmake_opt} -DENABLE_HIVE_FEATURE_SPARKLE=TRUE"
if [[ $OSTYPE == darwin* ]]; then
# Get DSA public key (macOS needs it in the plist)
if [ ! -f "${selfFolderPath}resources/dsa_pub.pem" ]; then
echo "ERROR: Please run setup_fresh_env.sh (just once) after having having changed use_sparkle value in config file."
exit 4
fi
dsaPubKey="$(< "${selfFolderPath}resources/dsa_pub.pem")"
cmake_opt="${cmake_opt} -DHIVE_DSA_PUB_KEY=${dsaPubKey}"
fi
fi
do_notarize=1
do_appcast=$use_sparkle
function extend_gi_fnc_help()
{
local default_path=""
get_default_qt_path default_path
echo " -qtvers <Qt Version> -> Override the default Qt version (v${default_qt_version}) with the specified one."
echo " -qtdir <Qt CMake Folder> -> Override default Qt path (${default_path}) with the specified one."
if isMac; then
echo " -no-notarize -> Do not notarize installer (Default: Do notarize)"
fi
if [ $use_sparkle -eq 1 ]; then
echo " -no-appcast -> Do not generate appcast (Default: Do appcast)"
fi
}
function extend_gi_fnc_unhandled_arg()
{
case "$1" in
-qtvers)
shift
if [ $# -lt 1 ]; then
echo "ERROR: Missing parameter for -qtvers option, see help (-h)"
exit 4
fi
gen_cmake_additional_options+=("-qtvers")
gen_cmake_additional_options+=("$1")
return 2
;;
-qtdir)
shift
if [ $# -lt 1 ]; then
echo "ERROR: Missing parameter for -qtdir option, see help (-h)"
exit 4
fi
gen_cmake_additional_options+=("-qtdir")
gen_cmake_additional_options+=("$1")
return 2
;;
-no-notarize)
do_notarize=0
return 1
;;
-no-appcast)
if [ $use_sparkle -eq 1 ]; then
do_appcast=0
return 1
fi
return 0
;;
esac
return 0
}
# execute gen_install script from bashUtils
. "${selfFolderPath}3rdparty/avdecc/scripts/bashUtils/gen_install.sh"
appcastInstallerName="${fullInstallerName}"
# macOS specific code
if isMac; then
# Call notarization
if [ $do_notarize -eq 1 ]; then
if [ ! "x${params["notarization_profile"]}" == "x" ]; then
"${selfFolderPath}3rdparty/avdecc/scripts/bashUtils/notarize_binary.sh" "${deliverablesFolder}${fullInstallerName}" "${params["notarization_profile"]}"
if [ $? -ne 0 ]; then
echo "Failed to notarize installer"
exit 1
fi
fi
fi
# Tar the installer as Sparkle do not support PKG
if [ $do_appcast -eq 1 ]; then
appcastInstallerName="${fullInstallerName}.tar"
pushd "${deliverablesFolder}" &> /dev/null
tar cf "${appcastInstallerName}" "${fullInstallerName}" &> /dev/null
rm -f "${fullInstallerName}" &> /dev/null
popd &> /dev/null
fi
fi
# Generate appcast
if [ $do_appcast -eq 1 ]; then
appcastURL="${params["appcast_releases"]}"
installerSubUrl="release"
if [ $is_release -eq 0 ];
then
appcastURL="${params["appcast_betas"]}"
installerSubUrl="beta"
fi
# Get URL of folder containing appcast file
updateBaseURL="${appcastURL%/*}/"
# Generate appcast file
"${selfFolderPath}3rdparty/sparkleHelper/scripts/generate_appcast.sh" "${deliverablesFolder}${appcastInstallerName}" "${releaseVersion}${beta_tag}" "${internalVersion}" "resources/dsa_priv.pem" "${updateBaseURL}changelog.php?lastKnownVersion=next" "${updateBaseURL}${installerSubUrl}/${appcastInstallerName}" "/S /NOPCAP /LAUNCH"
# Move appcast file to deliverablesFolder
mv "appcastItem-${releaseVersion}${beta_tag}.xml" "${deliverablesFolder}"
# Copy CHANGELOG.MD to deliverablesFolder
cp "${selfFolderPath}CHANGELOG.md" "${deliverablesFolder}"
echo "Do not forget to upload:"
echo " - CHANGELOG.MD"
echo " - Installer file: ${appcastInstallerName}"
echo " - Updated appcast file(s)"
fi
echo ""
echo "All files copied to ${deliverablesFolder}"
exit 0