mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: "Andreas Bießmann" <andreas@biessmann.de>
To: PTXdist ML <ptxdist@pengutronix.de>
Cc: "Andreas Bießmann" <andreas@biessmann.de>
Subject: [ptxdist] [PATCH] ptxdist: check vendor for ct-ng toolchain
Date: Thu, 20 Feb 2014 14:28:54 +0100	[thread overview]
Message-ID: <1392902934-21165-1-git-send-email-andreas@biessmann.de> (raw)

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>

---
I know that Pengutronix develops and distributes OSELAS.Toolchain. I switched
however for some targets to the ct-ng toolchain and found the really useful
feature of toolchain versioning broken when using that other toolchain. This
patch is hopefully even so accepted ;)

 bin/ptxdist |   26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/bin/ptxdist b/bin/ptxdist
index 663c41e..67fa28d 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -608,11 +608,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
@@ -622,17 +629,23 @@ 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} | sed -n -e 's/"//g' -e 's/^CT_TOOLCHAIN_PKGVERSION=//p')
+		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}"*)
 			;;
@@ -647,7 +660,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"
-- 
1.7.10.4


-- 
ptxdist mailing list
ptxdist@pengutronix.de

             reply	other threads:[~2014-02-20 13:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-20 13:28 Andreas Bießmann [this message]
2014-03-16 16:07 ` Andreas Bießmann
2014-03-18  9:07   ` Bernhard Walle
2014-03-18 15:13     ` Andreas Bießmann
2014-03-18 15:49       ` Michael Olbrich
2014-04-20  7:48 ` [ptxdist] [PATCH v2] " Andreas Bießmann
2014-04-21  8:51   ` Michael Olbrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392902934-21165-1-git-send-email-andreas@biessmann.de \
    --to=andreas@biessmann.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox