mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
Bugfix
This commit is contained in:
@@ -424,15 +424,18 @@ find_toolchain()
|
||||
local dist=10
|
||||
local toolchain=""
|
||||
# extract target major.minor version from expression
|
||||
local target_ver=$(grep -oE "[[:digit:]]+\.[[:digit:]]+" <<< "$expression")
|
||||
local target_ver=$(grep -oE "[[:digit:]]+\.[[:digit:]]" <<< "$expression")
|
||||
for dir in $SRC/cache/toolchains/*/; do
|
||||
# check if is a toolchain for current $ARCH
|
||||
[[ ! -f ${dir}bin/${compiler}gcc ]] && continue
|
||||
# get toolchain major.minor version
|
||||
local gcc_ver=$(${dir}bin/${compiler}gcc -dumpversion | grep -oE "^[[:digit:]]+\.[[:digit:]]+")
|
||||
local gcc_ver=$(${dir}bin/${compiler}gcc -dumpversion | grep -oE "^[[:digit:]]+\.[[:digit:]]")
|
||||
# check if toolchain version satisfies requirement
|
||||
awk "BEGIN{exit ! ($gcc_ver $expression)}" >/dev/null || continue
|
||||
# check if found version is the closest to target
|
||||
# may need different logic here with more than 1 digit minor version numbers
|
||||
# numbers: 3.9 > 3.10; versions: 3.9 < 3.10
|
||||
# dpkg --compare-versions can be used here if operators are changed
|
||||
local d=$(awk '{x = $1 - $2}{printf "%.1f\n", (x > 0) ? x : -x}' <<< "$target_ver $gcc_ver")
|
||||
if awk "BEGIN{exit ! ($d < $dist)}" >/dev/null ; then
|
||||
dist=$d
|
||||
|
||||
Reference in New Issue
Block a user