summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorAndreas Bießmann <andreas@biessmann.de>2014-04-20 09:48:45 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2014-04-21 10:45:31 +0200
commite0978aeb89ca7c3b904b55fcd42f8c02e31502c6 (patch)
tree0a83b8bce4b519db575105f73f9114e217a64e06 /bin
parent4a2c29f240572b5b185751e0dda3bd72e0b28aa9 (diff)
downloadptxdist-e0978aeb89ca7c3b904b55fcd42f8c02e31502c6.tar.gz
ptxdist-e0978aeb89ca7c3b904b55fcd42f8c02e31502c6.tar.xz
ptxdist: check vendor for ct-ng toolchain
Before the toolchain vendor check was dedicated to OSELAS.Toolchain. This patch introduces this feature to a toolchain built with ct-ng. Signed-off-by: Andreas Bießmann <andreas@biessmann.de> Cc: Bernhard Walle <bernhard@bwalle.de> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ptxdist36
1 files changed, 29 insertions, 7 deletions
diff --git a/bin/ptxdist b/bin/ptxdist
index d83d98dde..43dad5833 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -617,11 +617,18 @@ check_compiler() {
# 3) Correct compiler version if a specific compiler version is given
#
+ local compiler_prefix="$(ptxd_get_ptxconf PTXCONF_COMPILER_PREFIX)"
local vendor_should
vendor_should="$(ptxd_get_ptxconf PTXCONF_CROSSCHAIN_VENDOR)" && {
# yea! A toolchain vendor was specified in the ptxconfig file.
- # So we check for a 'ptxconfig' file in the toolchain directory
- # and test the PTXCONF_PROJECT string therein.
+ #
+ # We have two options now:
+ # a) the provided toolchain is an OSELAS.Toolchain which contains a
+ # 'ptxconfig', so test the PTXCONF_PROJECT string therein.
+ # b) the provided toolchain is a crosstool-ng one which contains a
+ # ${compiler_prefix}-ct-ng.config, so test the
+ # CT_TOOLCHAIN_PKGVERSION therein.
+ #
if [ ! -d "${PTXDIST_TOOLCHAIN}" ]; then
echo
@@ -631,17 +638,33 @@ check_compiler() {
exit 1
fi
- local vendor_def="$(readlink -f "${PTXDIST_TOOLCHAIN}/ptxconfig")"
- if [ -z "${vendor_def}" -o \! -e "${vendor_def}" ]; then
+ local ptxdist_vendor_def="$(readlink -f "${PTXDIST_TOOLCHAIN}/ptxconfig")"
+ local ct_vendor_def="$(readlink -f "${PTXDIST_TOOLCHAIN}/${compiler_prefix}ct-ng.config")"
+
+ local vendor_is
+ if [ "${ptxdist_vendor_def}" -a -e "${ptxdist_vendor_def}" ]; then
+ vendor_is="$(source "${ptxdist_vendor_def}" && echo ${PTXCONF_PROJECT})"
+ elif [ "${ct_vendor_def}" -a -x "${ct_vendor_def}" ]; then
+ vendor_is=$(${ct_vendor_def} | awk ' \
+ /^#\s+crosstool-NG.*Configuration$/ { \
+ printf("%s %s", $2, $3) \
+ }; \
+ /^CT_TOOLCHAIN_PKGVERSION=/ { \
+ gsub(/\"/, ""); \
+ split($0,ary,"="); \
+ if (ary[1]) { \
+ printf(" - %s", ary[2]); \
+ } \
+ }')
+ else
echo
- echo "${PTXDIST_LOG_PROMPT}error: toolchain doesn't point to an OSELAS.Toolchain"
+ echo "${PTXDIST_LOG_PROMPT}error: toolchain doesn't point to an OSELAS.Toolchain nor a crosstools-ng toolchain"
echo "${PTXDIST_LOG_PROMPT}error: leave PTXCONF_CROSSCHAIN_VENDOR empty to disable vendor check"
echo
exit 1
fi
# both vendor strings are present. Check them
- local vendor_is="$(source "${vendor_def}" && echo ${PTXCONF_PROJECT})"
case "${vendor_is}" in
"${vendor_should}"*)
;;
@@ -656,7 +679,6 @@ check_compiler() {
esac
}
- local compiler_prefix="$(ptxd_get_ptxconf PTXCONF_COMPILER_PREFIX)"
local compiler_ver_should
compiler_ver_should="$(ptxd_get_ptxconf PTXCONF_CROSSCHAIN_CHECK)" && {
local compiler="${compiler_prefix}gcc"