2016-08-11 03:34:27 +08:00
|
|
|
#!/bin/bash
|
2019-06-24 22:01:18 +08:00
|
|
|
|
2022-01-05 03:11:09 +08:00
|
|
|
# Copyright © 2016-2021 by The qTox Project Contributors
|
2016-08-11 03:34:27 +08:00
|
|
|
#
|
|
|
|
# This program is libre software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
2016-08-11 17:51:53 +08:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2016-08-11 03:34:27 +08:00
|
|
|
|
|
|
|
# Fail out on error
|
2018-10-22 04:55:19 +08:00
|
|
|
set -eu -o pipefail
|
2016-08-11 03:34:27 +08:00
|
|
|
|
2019-01-18 22:00:35 +08:00
|
|
|
readonly BIN_NAME="qTox.dmg"
|
|
|
|
|
2022-03-03 19:04:24 +08:00
|
|
|
SCRIPT_DIR=$(dirname $(realpath "$0"))
|
|
|
|
|
|
|
|
source "${SCRIPT_DIR}/../buildscripts/build_utils.sh"
|
|
|
|
|
|
|
|
# kind of a hack.. but we want to extract DEP_PREFIX from it
|
|
|
|
parse_arch --arch macos --supported macos --dep macos
|
|
|
|
|
|
|
|
if [ "$1" == "user" ]; then
|
|
|
|
DEPLOYMENT_TARGET=""
|
|
|
|
PREFIX_PATH="$(brew --prefix qt@5)"
|
|
|
|
elif [ "$1" == "dist" ]; then
|
|
|
|
DEPLOYMENT_TARGET="-DCMAKE_OSX_DEPLOYMENT_TARGET=$MACOS_MINIMUM_SUPPORTED_VERSION"
|
|
|
|
PREFIX_PATH="$DEP_PREFIX;$(brew --prefix qt@5)"
|
|
|
|
else
|
|
|
|
echo "Unknown arg $1"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-01-05 03:11:09 +08:00
|
|
|
build_qtox() {
|
|
|
|
cmake -DUPDATE_CHECK=ON \
|
|
|
|
-DSPELL_CHECK=OFF \
|
|
|
|
-DSTRICT_OPTIONS=ON \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
2022-03-03 19:04:24 +08:00
|
|
|
"${DEPLOYMENT_TARGET}" \
|
|
|
|
"-DCMAKE_PREFIX_PATH=${PREFIX_PATH}" .
|
2022-01-05 03:11:09 +08:00
|
|
|
make -j$(sysctl -n hw.ncpu)
|
2022-03-13 17:59:01 +08:00
|
|
|
export CTEST_OUTPUT_ON_FAILURE=1
|
|
|
|
ctest -j$(sysctl -n hw.ncpu)
|
2022-01-05 03:11:09 +08:00
|
|
|
make install
|
2016-09-27 19:34:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
check() {
|
|
|
|
if [[ ! -s "$BIN_NAME" ]]
|
|
|
|
then
|
2022-01-05 03:11:09 +08:00
|
|
|
echo "There's no $BIN_NAME!"
|
2016-09-27 19:34:05 +08:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-01-18 22:00:35 +08:00
|
|
|
make_hash() {
|
|
|
|
shasum -a 256 "$BIN_NAME" > "$BIN_NAME".sha256
|
|
|
|
}
|
|
|
|
|
2016-09-27 19:34:05 +08:00
|
|
|
main() {
|
2022-01-05 03:11:09 +08:00
|
|
|
build_qtox
|
2016-09-27 19:34:05 +08:00
|
|
|
check
|
2019-01-18 22:00:35 +08:00
|
|
|
make_hash
|
2016-09-27 19:34:05 +08:00
|
|
|
}
|
|
|
|
main
|