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-09 10:55:53 +08:00
|
|
|
while (( $# > 0 )); do
|
|
|
|
case $1 in
|
|
|
|
--run-tests) RUN_TESTS=1; shift ;;
|
|
|
|
--online-tests) ONLINE_TESTS=1; shift ;;
|
|
|
|
*) echo "Unexpected argument $1"; exit 1 ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
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-02-09 08:37:47 +08:00
|
|
|
-DCMAKE_PREFIX_PATH="$(brew --prefix qt@5)" .
|
2022-01-05 03:11:09 +08:00
|
|
|
make -j$(sysctl -n hw.ncpu)
|
2022-03-09 10:55:53 +08:00
|
|
|
if [ ! -z ${RUN_TESTS+x} ]; then
|
|
|
|
EXCLUDE_TESTS=""
|
|
|
|
if [ -z ${ONLINE_TESTS+x} ]; then
|
|
|
|
EXCLUDE_TESTS="-E core"
|
|
|
|
fi
|
|
|
|
export CTEST_OUTPUT_ON_FAILURE=1
|
|
|
|
ctest ${EXCLUDE_TESTS} -j$(sysctl -n hw.ncpu)
|
|
|
|
fi
|
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
|