45 lines
1.2 KiB
Bash
45 lines
1.2 KiB
Bash
#!/bin/bash
|
|
if ! type include >/dev/null 2>&1; then
|
|
include() {
|
|
. "$(cd "$(dirname "$1")" && pwd)/${2}"
|
|
}
|
|
fi
|
|
include "${BASH_SOURCE[0]}" ../pragma_once.bash
|
|
if ! pragma_once "${BASH_SOURCE[0]}"; then
|
|
return 0
|
|
fi
|
|
include "${BASH_SOURCE[0]}" ./global_rely/export.bash
|
|
_ret_=""
|
|
case "$OSTYPE" in
|
|
linux-gnu*)
|
|
_ae_root_="${PSC_AE_ROOT:-/ae}"
|
|
;;
|
|
win32*|cygwin*|msys*)
|
|
_ae_root_="${PSC_AE_ROOT:-/d/ae/cached_external_library}"
|
|
;;
|
|
*)
|
|
log_error "未知操作系统类型: %s" "$OSTYPE"
|
|
return 1
|
|
;;
|
|
esac
|
|
_root_="${PSC_BASH_ROOT:-${_ae_root_}/bash}"
|
|
_library_root_dir_="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
_cur_log_path_=""
|
|
_install_="${_root_}/install"
|
|
_src_="${_root_}/src"
|
|
_build_="${_root_}/build"
|
|
_win_="${_root_}/win"
|
|
_iso_repo_="${_root_}/iso_repo"
|
|
_wget_cache_dir_="${_root_}/0_wget_cache_dir"
|
|
_git_cache_dir_="${_root_}/0_git_cache_dir"
|
|
_build_dir_="${_root_}/0_build_dir"
|
|
_network_status_=""
|
|
init_build_environment() {
|
|
local dir
|
|
local dirs=("$_root_" "$_install_" "$_src_" "$_win_" "$_iso_repo_" "$_wget_cache_dir_" "$_git_cache_dir_" "$_build_dir_")
|
|
for dir in "${dirs[@]}"; do
|
|
mkdir -p "$dir" || return $?
|
|
done
|
|
log_info "build environment initialized: root=%s library=%s" "$_root_" "$_library_root_dir_"
|
|
}
|