Refactor build-libraries.sh and env.sh for improved environment setup

- Updated build-libraries.sh to use --global and --path options for environment registration, enhancing clarity and consistency.
- Modified env.sh to support custom paths and improved error handling for the --path argument, streamlining toolchain path resolution.
- Removed redundant SYSROOT_DIR assignments to simplify the script logic.
This commit is contained in:
2026-03-31 13:54:49 +03:00
parent fa0e0243e1
commit 08e372eaf2
2 changed files with 29 additions and 14 deletions

28
env.sh
View File

@@ -1,15 +1,31 @@
TOP="$(pwd)"
TOOLCHAIN_PATH=""
GLOBAL_MODE=0
CUSTOM_PATH=""
for arg in "$@"; do
if [ "$arg" = "--global" ]; then
GLOBAL_MODE=1
break
fi
while [ $# -gt 0 ]; do
case "$1" in
--global)
GLOBAL_MODE=1
shift
;;
--path)
if [ -z "$2" ]; then
echo "Ошибка: для --path нужно указать путь"
return 1 2>/dev/null || exit 1
fi
CUSTOM_PATH="$2"
shift 2
;;
*)
shift
;;
esac
done
if [ -d "${TOP}/arm-uclinuxfdpiceabi" ]; then
if [ -n "${CUSTOM_PATH}" ]; then
TOOLCHAIN_PATH="${CUSTOM_PATH}"
elif [ -d "${TOP}/arm-uclinuxfdpiceabi" ]; then
TOOLCHAIN_PATH="${TOP}/arm-uclinuxfdpiceabi"
elif [ -d "${TOP}/build/install" ]; then
TOOLCHAIN_PATH="${TOP}/build/install"