2023-04-23 07:57:55 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
2023-04-24 08:09:36 +00:00
|
|
|
APP_ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
|
|
|
ROOT_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
|
|
|
. "$APP_ROOT_DIR/config.sh"
|
2023-04-23 07:57:55 +00:00
|
|
|
|
|
|
|
function usage {
|
|
|
|
cat >&2 <<DONE
|
|
|
|
Usage: $0 -p platforms
|
|
|
|
Options
|
|
|
|
-p PLATFORMS Platforms to build (m=Mac, w=Windows, l=Linux)
|
|
|
|
-t add devtools
|
|
|
|
-q quick build (skip compression and other optional steps for faster restarts during development)
|
|
|
|
DONE
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
DEVTOOLS=0
|
|
|
|
PLATFORM=""
|
|
|
|
quick_build=0
|
|
|
|
while getopts "tp:q" opt; do
|
|
|
|
case $opt in
|
|
|
|
t)
|
|
|
|
DEVTOOLS=1
|
|
|
|
;;
|
|
|
|
p)
|
|
|
|
for i in `seq 0 1 $((${#OPTARG}-1))`
|
|
|
|
do
|
|
|
|
case ${OPTARG:i:1} in
|
|
|
|
m) PLATFORM="m";;
|
|
|
|
w) PLATFORM="w";;
|
|
|
|
l) PLATFORM="l";;
|
|
|
|
*)
|
|
|
|
echo "$0: Invalid platform option ${OPTARG:i:1}"
|
|
|
|
usage
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
q)
|
|
|
|
quick_build=1
|
|
|
|
;;
|
|
|
|
\?)
|
|
|
|
echo "Invalid option: -$OPTARG" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ -z $PLATFORM ]]; then
|
|
|
|
if [ "`uname`" = "Darwin" ]; then
|
|
|
|
PLATFORM="m"
|
|
|
|
elif [ "`uname`" = "Linux" ]; then
|
|
|
|
PLATFORM="l"
|
|
|
|
elif [ "`uname -o 2> /dev/null`" = "Cygwin" ]; then
|
|
|
|
PLATFORM="w"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
CHANNEL="source"
|
|
|
|
|
2023-04-24 08:09:36 +00:00
|
|
|
PARAMS=""
|
|
|
|
if [ $DEVTOOLS -eq 1 ]; then
|
|
|
|
PARAMS+=" -t"
|
2023-04-23 07:57:55 +00:00
|
|
|
fi
|
2023-04-24 08:09:36 +00:00
|
|
|
if [ $quick_build -eq 1 ]; then
|
|
|
|
PARAMS+=" -q"
|
|
|
|
fi
|
|
|
|
|
|
|
|
hash=`git -C "$ROOT_DIR" rev-parse --short HEAD`
|
|
|
|
|
|
|
|
build_dir=`mktemp -d`
|
|
|
|
function cleanup {
|
|
|
|
rm -rf $build_dir
|
|
|
|
}
|
|
|
|
trap cleanup EXIT
|
|
|
|
|
|
|
|
"$SCRIPT_DIR/prepare_build" -s "$ROOT_DIR/build" -o "$build_dir" -c $CHANNEL -m $hash
|
|
|
|
"$APP_ROOT_DIR/build.sh" -d "$build_dir" -p $PLATFORM -c $CHANNEL -s $PARAMS
|
2023-04-23 07:57:55 +00:00
|
|
|
|
|
|
|
echo Done
|