Enhance build-libraries.sh and env.sh for improved toolchain configuration

- Updated build-libraries.sh to set up environment variables for the arm-uclinuxfdpiceabi toolchain, including compiler flags and paths.
- Removed the dependency on env.sh for initial environment setup, simplifying the script logic.
- Streamlined the export and unset of environment variables to ensure a clean build environment.
- Adjusted the handling of CFLAGS and related variables for better clarity and consistency in the build process.
This commit is contained in:
2026-03-31 17:20:11 +03:00
parent 1f31c8e0a9
commit fa5c892cce
2 changed files with 44 additions and 91 deletions

64
env.sh
View File

@@ -1,58 +1,10 @@
TOP="$(pwd)"
TOOLCHAIN_PATH=""
GLOBAL_MODE=0
CUSTOM_PATH=""
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
TOP=`pwd`
TARGET=arm-uclinuxfdpiceabi
CFLAGS_TOOLSET='-O2'
CFLAGS_TARGET='-Os -mthumb'
CFLAGS=$CFLAGS_TOOLSET CFLAGS_FOR_TARGET=$CFLAGS_TARGET CXXFLAGS_FOR_TARGET=$CFLAGS_TARGET
SUBARCH=armv7-m
SUBMODE=thumb
PATH=${TOP}/${TARGET}/bin:${PATH}
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"
fi
if [ -n "${TOOLCHAIN_PATH}" ] && [ -x "${TOOLCHAIN_PATH}/bin/arm-uclinuxfdpiceabi-gcc" ]; then
echo "Найден toolchain: ${TOOLCHAIN_PATH}/bin/arm-uclinuxfdpiceabi-gcc"
CFLAGS_TOOLSET='-O2'
CFLAGS_TARGET='-Os -mthumb'
SUBARCH=armv7-m
SUBMODE=thumb
if [ "$GLOBAL_MODE" -eq 1 ]; then
export CFLAGS="${CFLAGS_TOOLSET}"
export CFLAGS_FOR_TARGET="${CFLAGS_TARGET}"
export CXXFLAGS_FOR_TARGET="${CFLAGS_TARGET}"
export SUBARCH
export SUBMODE
export PATH="${TOOLCHAIN_PATH}/bin:${PATH}"
else
CFLAGS="${CFLAGS_TOOLSET}"
CFLAGS_FOR_TARGET="${CFLAGS_TARGET}"
CXXFLAGS_FOR_TARGET="${CFLAGS_TARGET}"
PATH="${TOOLCHAIN_PATH}/bin:${PATH}"
fi
else
echo "Ошибка: не найден ${TOOLCHAIN_PATH}/bin/arm-uclinuxfdpiceabi-gcc"
return 1 2>/dev/null || exit 1
fi