From patchwork Mon Jan 14 20:37:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 211890 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id 68CF92C009C for ; Tue, 15 Jan 2013 07:37:25 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 656178BC11; Mon, 14 Jan 2013 20:37:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WpMhNaY9GR02; Mon, 14 Jan 2013 20:37:19 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 5DCC78BBB6; Mon, 14 Jan 2013 20:37:19 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 40D8F8F74B for ; Mon, 14 Jan 2013 20:37:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 025D9FFD04 for ; Mon, 14 Jan 2013 20:37:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id d6f7P0FmiT6K for ; Mon, 14 Jan 2013 20:37:04 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.free-electrons.com (mail.free-electrons.com [94.23.35.102]) by fraxinus.osuosl.org (Postfix) with ESMTP id B2318FFD83 for ; Mon, 14 Jan 2013 20:37:04 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 106) id 7D69A6603; Mon, 14 Jan 2013 21:37:14 +0100 (CET) Received: from localhost (humanoidz.org [82.247.183.72]) by mail.free-electrons.com (Postfix) with ESMTPSA id CA52B6DC; Mon, 14 Jan 2013 21:37:13 +0100 (CET) From: Thomas Petazzoni To: buildroot@uclibc.org Date: Mon, 14 Jan 2013 21:37:12 +0100 Message-Id: <1358195832-2674-1-git-send-email-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 1.7.9.5 Cc: melanie.bats@obeo.fr Subject: [Buildroot] [PATCH] eclipse support: document script and add checks X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net As requested by Peter, add a bit of documentation in the eclipse-register-toolchain script, and add a few more checks (even though this script is not intended to be executed manually, which is also now mentionned in the documentation). Signed-off-by: Thomas Petazzoni --- support/scripts/eclipse-register-toolchain | 48 ++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/support/scripts/eclipse-register-toolchain b/support/scripts/eclipse-register-toolchain index dd9f158..6f91998 100755 --- a/support/scripts/eclipse-register-toolchain +++ b/support/scripts/eclipse-register-toolchain @@ -1,11 +1,59 @@ #!/bin/sh +# This script registers the toolchain of a Buildroot project into the +# Eclipse plugin. To do so, it adds a new line for the Buildroot +# toolchain into the $HOME/.buildroot-eclipse.toolchains file, which +# the Eclipse Buildroot plugin reads to discover automatically the +# available Buildroot toolchains on the system. +# +# This script should typically not be called manually. Instead, one +# should enable the BR2_ECLIPSE_REGISTER configuration option, which +# will lead Buildroot to automatically call this script with the +# appropriate arguments. +# +# Usage: +# eclipse-register-toolchain project-directory toolchain-prefix architecture +# +# project-directory is the absolute path to the Buildroot project +# output directory (which contains the host/, target/, build/, +# images/, etc. subdirectories). It should be an absolute and +# canonical path. +# +# toolchain-prefix is the prefix of the cross-compilation tools, i.e +# 'arm-linux-' if the cross-compiler executable is 'arm-linux-gcc'. +# +# architecture is the lower-cased name of the architecture targetted +# by the Buildroot project. + +if test $# -ne 3; then + echo "Invalid number of arguments." + echo "Usage: $0 project-directory toolchain-prefix architecture" + exit 1 +fi + project_directory=$1 toolchain_prefix=$2 architecture=$3 +if test ! -d ${project_directory} ; then + echo "Non-existing project directory ${project_directory}" + exit 1 +fi + +if test ! -d ${project_directory}/host ; then + echo "Your project directory does not look like a Buildroot output" + exit 1 +fi + +if test ! -e ${project_directory}/host/usr/bin/${toolchain_prefix}gcc ; then + echo "Cannot find the cross-compiler in the project directory" + exit 1 +fi + TOOLCHAIN_ECLIPSE_FILE=${HOME}/.buildroot-eclipse.toolchains +# First, we remove all lines from the ${TOOLCHAIN_ECLISPE_FILE} that +# correspond to toolchains that no longer exist. if test -f ${TOOLCHAIN_ECLIPSE_FILE} ; then mv ${TOOLCHAIN_ECLIPSE_FILE} ${TOOLCHAIN_ECLIPSE_FILE}.tmp cat ${TOOLCHAIN_ECLIPSE_FILE}.tmp | while read toolchain ; do