sdk: zephyr: check for minimum required version of SDK
Error out when old SDK versions are being used. Jira: ZEP-584 Change-Id: If3515f38cc75d8a378614ef77d8946ba2d9ab28d Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
2aa754497d
commit
806ac751d4
2 changed files with 53 additions and 0 deletions
|
@ -12,8 +12,18 @@
|
|||
#
|
||||
#######################################################################
|
||||
|
||||
REQUIRED_SDK_VER=0.8.2
|
||||
|
||||
ifndef ZEPHYR_SDK_INSTALL_DIR
|
||||
|
||||
$(error ZEPHYR_SDK_INSTALL_DIR is not set)
|
||||
else
|
||||
SDK_VERSION = $(shell cat ${ZEPHYR_SDK_INSTALL_DIR}/sdk_version)
|
||||
SDK_CHECK = $(shell vercomp $(REQUIRED_SDK_VER) $(SDK_VERSION) || echo $$?)
|
||||
|
||||
ifeq ($(SDK_CHECK),1)
|
||||
$(error (The SDK version you are using is old, please update your SDK. You need at least SDK version $(REQUIRED_SDK_VER)))
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HOST_OS),MINGW)
|
||||
|
|
43
scripts/vercomp
Executable file
43
scripts/vercomp
Executable file
|
@ -0,0 +1,43 @@
|
|||
#!/bin/bash
|
||||
|
||||
# `vercomp()` is copied from: http://stackoverflow.com/a/4025065
|
||||
|
||||
# Usage: vercomp <version 1> <version 2>
|
||||
# return codes:
|
||||
# 0: version 1 and version 2 are the same
|
||||
# 1: version 1 is higher
|
||||
# 2: version 2 is higher
|
||||
|
||||
|
||||
vercomp () {
|
||||
if [[ $1 == $2 ]]
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
local IFS=.
|
||||
local i ver1=($1) ver2=($2)
|
||||
# fill empty fields in ver1 with zeros
|
||||
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
|
||||
do
|
||||
ver1[i]=0
|
||||
done
|
||||
for ((i=0; i<${#ver1[@]}; i++))
|
||||
do
|
||||
if [[ -z ${ver2[i]} ]]
|
||||
then
|
||||
# fill empty fields in ver2 with zeros
|
||||
ver2[i]=0
|
||||
fi
|
||||
if ((10#${ver1[i]} > 10#${ver2[i]}))
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
if ((10#${ver1[i]} < 10#${ver2[i]}))
|
||||
then
|
||||
return 2
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
vercomp $1 $2
|
Loading…
Add table
Add a link
Reference in a new issue