mirror of
https://github.com/eosswedenorg/antelope-api-healthcheck
synced 2026-06-17 04:50:02 +02:00
Adding compile.sh
This commit is contained in:
parent
d30f4e16bc
commit
41cb29703b
1 changed files with 75 additions and 0 deletions
75
compile.sh
Executable file
75
compile.sh
Executable file
|
|
@ -0,0 +1,75 @@
|
|||
#!/bin/bash
|
||||
|
||||
SYSTEMS=( windows linux freebsd )
|
||||
|
||||
ARCHS=( 386 amd64 amd64p32 arm arm64 ppc ppc64 )
|
||||
|
||||
function usage() {
|
||||
echo "Usage: ${0##*/} [ -h|--help ] [ --target <system> ] [ -a|--arch <arch> ] [ -p|--package ]"
|
||||
echo ""
|
||||
echo " Valid systems:"
|
||||
for i in "${SYSTEMS[@]}"; do
|
||||
echo " * ${i}"
|
||||
done
|
||||
echo ""
|
||||
echo " Valid architectures:"
|
||||
for i in "${ARCHS[@]}"; do
|
||||
echo " * ${i}"
|
||||
done
|
||||
echo ""
|
||||
exit 1
|
||||
}
|
||||
|
||||
options=$(getopt -n "${0##*/}" -o "ht:a:p" -l "help,target:,arch:,package" -- "$@")
|
||||
|
||||
[ $? -eq 0 ] || usage
|
||||
|
||||
eval set -- "$options"
|
||||
|
||||
MAKE_TARGET="all"
|
||||
|
||||
while true; do
|
||||
|
||||
case $1 in
|
||||
-p|--package)
|
||||
MAKE_TARGET="package_deb"
|
||||
;;
|
||||
-t|--target)
|
||||
shift
|
||||
REGEX=$(echo "${SYSTEMS[@]}" | sed 's/[[:space:]]/|/g')
|
||||
[[ ! "$1" =~ ^($REGEX)$ ]] && {
|
||||
echo "Incorrect system '$1' provided"
|
||||
usage
|
||||
}
|
||||
export GOOS=$1
|
||||
;;
|
||||
-a|--arch)
|
||||
shift
|
||||
REGEX=$(echo "${ARCHS[@]}" | sed 's/[[:space:]]/|/g')
|
||||
[[ ! "$1" =~ ^($REGEX)$ ]] && {
|
||||
echo "Incorrect architecture '$1' provided"
|
||||
usage
|
||||
}
|
||||
export GOARCH=$1
|
||||
;;
|
||||
-h|--help) usage ;;
|
||||
--) shift
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
MESSAGE=""
|
||||
if [ ! -z "${GOOS}" ]; then
|
||||
MESSAGE="[\e[34m::\e[0m] Crosscompiling for: ${GOOS}"
|
||||
fi
|
||||
|
||||
if [ ! -z "${GOARCH}" ]; then
|
||||
MESSAGE="${MESSAGE} (${GOARCH})"
|
||||
fi
|
||||
|
||||
|
||||
[ ! -z "${MESSAGE}" ] && echo -e "" $MESSAGE
|
||||
|
||||
make -B ${MAKE_TARGET}
|
||||
Loading…
Add table
Add a link
Reference in a new issue