|
|
|
# Determine the architecture and version
|
|
|
|
architecture=$(uname -m)
|
|
|
|
version=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
|
|
|
|
|
|
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
|
|
|
|
|
|
|
# Define the supported architectures and corresponding bin directories
|
|
|
|
declare -A supported_architectures=(
|
|
|
|
["linux-amd64"]="_output/bin/platforms/linux/amd64"
|
|
|
|
["linux-arm64"]="_output/bin/platforms/linux/arm64"
|
|
|
|
["linux-mips64"]="_output/bin/platforms/linux/mips64"
|
|
|
|
["linux-mips64le"]="_output/bin/platforms/linux/mips64le"
|
|
|
|
["linux-ppc64le"]="_output/bin/platforms/linux/ppc64le"
|
|
|
|
["linux-s390x"]="_output/bin/platforms/linux/s390x"
|
|
|
|
["darwin-amd64"]="_output/bin/platforms/darwin/amd64"
|
|
|
|
["windows-amd64"]="_output/bin/platforms/windows/amd64"
|
|
|
|
["linux-x86_64"]="_output/bin/platforms/linux/amd64" # Alias for linux-amd64
|
|
|
|
["darwin-x86_64"]="_output/bin/platforms/darwin/amd64" # Alias for darwin-amd64
|
|
|
|
)
|
|
|
|
|
|
|
|
# Check if the architecture and version are supported
|
|
|
|
if [[ -z ${supported_architectures["$version-$architecture"]} ]]; then
|
|
|
|
echo "================> Unsupported architecture: $architecture or version: $version"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "================> Architecture: $architecture"
|
|
|
|
|
|
|
|
# Set the BIN_DIR based on the architecture and version
|
|
|
|
BIN_DIR=${supported_architectures["$version-$architecture"]}
|
|
|
|
|
|
|
|
echo "================> BIN_DIR: $OPENIM_ROOT/$BIN_DIR"
|
|
|
|
|
|
|
|
|
|
|
|
# Don't put the space between "="
|
|
|
|
openim_msggateway="openim-msggateway"
|
|
|
|
msg_gateway_binary_root= $OPENIM_ROOT/$BIN_DIR/
|
|
|
|
msg_gateway_source_root="../cmd/msggateway/"
|
|
|
|
|
|
|
|
msg_name="openim-rpc-msg"
|
|
|
|
msg_binary_root=$OPENIM_ROOT/$BIN_DIR
|
|
|
|
msg_source_root="../cmd/rpc/msg/"
|
|
|
|
|
|
|
|
push_name="openim-push"
|
|
|
|
push_binary_root=$OPENIM_ROOT/$BIN_DIR
|
|
|
|
push_source_root="../cmd/push/"
|
|
|
|
|
|
|
|
openim_msgtransfer="openim-rpc-msg_transfer"
|
|
|
|
msg_transfer_binary_root=$OPENIM_ROOT/$BIN_DIR
|
|
|
|
msg_transfer_source_root="../cmd/msgtransfer/"
|
|
|
|
msg_transfer_service_num=4
|
|
|
|
|
|
|
|
cron_task_name="openim-crontask"
|
|
|
|
cron_task_binary_root=$OPENIM_ROOT/$BIN_DIR
|
|
|
|
cron_task_source_root="../cmd/crontask/"
|
|
|
|
|
|
|
|
|
|
|
|
cmd_utils_name="openim_cmd_utils"
|
|
|
|
cmd_utils_binary_root=$OPENIM_ROOT/$BIN_DIR
|
|
|
|
cmd_utils_source_root="../cmd/cmduitls/"
|
|
|
|
|
|
|
|
# Global configuration file default dir
|
|
|
|
config_path="../config/config.yaml"
|
|
|
|
|
|
|
|
# servicefile dir path
|
|
|
|
service_source_root=(
|
|
|
|
# api service file
|
|
|
|
"../cmd/api/"
|
|
|
|
# rpc service file
|
|
|
|
"../cmd/rpc/user/"
|
|
|
|
"../cmd/rpc/friend/"
|
|
|
|
"../cmd/rpc/group/"
|
|
|
|
"../cmd/rpc/auth/"
|
|
|
|
"../cmd/rpc/conversation/"
|
|
|
|
"../cmd/rpc/third/"
|
|
|
|
"../cmd/crontask"
|
|
|
|
"${msg_gateway_source_root}"
|
|
|
|
"${msg_transfer_source_root}"
|
|
|
|
"${msg_source_root}"
|
|
|
|
"${push_source_root}"
|
|
|
|
# "${sdk_server_source_root}"
|
|
|
|
)
|
|
|
|
|
|
|
|
# service filename
|
|
|
|
service_names=(
|
|
|
|
# api service filename
|
|
|
|
"openim-api"
|
|
|
|
# rpc service filename
|
|
|
|
"openim-rpc-user"
|
|
|
|
"openim-rpc-friend"
|
|
|
|
"openim-rpc-group"
|
|
|
|
"openim-rpc-auth"
|
|
|
|
"openim-rpc-conversation"
|
|
|
|
"openim-rpc-third"
|
|
|
|
"openim-crontask"
|
|
|
|
"${openim_msggateway}"
|
|
|
|
"${openim_msgtransfer}"
|
|
|
|
"${msg_name}"
|
|
|
|
"${push_name}"
|
|
|
|
# "${sdk_server_name}"
|
|
|
|
)
|