All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Watt <jpewhacker@gmail.com>
To: Martin Kelly <mkelly@xevo.com>, openembedded-core@lists.openembedded.org
Subject: Re: [PATCH v2 5/7] toolchain-shar-extract: pass env to post-relocate
Date: Fri, 01 Jun 2018 17:08:16 -0500	[thread overview]
Message-ID: <1fa5f19ad4ac398de0dc6da40c46ead935133dbe.camel@gmail.com> (raw)
In-Reply-To: <20180601210240.14969-6-mkelly@xevo.com>

On Fri, 2018-06-01 at 14:02 -0700, Martin Kelly wrote:
> It's useful for the post-relocate scripts to be able to see the SDK
> environment, for example to see the values of CC, CXX etc. in order
> to
> dynamically generate toolchain files.
> 
> To enable this, source the SDK environment script prior to calling
> the
> relocate scripts.
> 
> Signed-off-by: Martin Kelly <mkelly@xevo.com>
> ---
>  meta/classes/toolchain-scripts.bbclass     | 17 +++++++++++++----
>  meta/recipes-core/meta/meta-environment.bb |  5 +++--
>  2 files changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/meta/classes/toolchain-scripts.bbclass
> b/meta/classes/toolchain-scripts.bbclass
> index ae7bbef034..5f99fd8c03 100644
> --- a/meta/classes/toolchain-scripts.bbclass
> +++ b/meta/classes/toolchain-scripts.bbclass
> @@ -118,11 +118,20 @@ EOF
>  }
>  
>  toolchain_create_post_relocate_script() {
> -	script=$1
> -	rm -f $script
> -	touch $script
> +	relocate_script=$1
> +	sdk_script=$2
> +	rm -f $relocate_script
> +	touch $relocate_script
> +
> +    cat >> $relocate_script <<EOF
> +# Source the SDK env script in case it is needed for the relocate
> scripts.
> +. $sdk_script

I had originally done something similar to this when I added support
for the post-relocate scripts with icecream. However, it is insufficent
because there can be multiple SDK environment scripts that need to be
sourced. In order to get a fully correct environment, I had to do:

 # Setup environment
 for env_setup_script in `ls $1/environment-setup-*`; do
 	. $env_setup_script
 done

see meta/recipes-devtools/icecc-toolchain/icecc-toolchain/icecc-
setup.sh


> +status=\$?
> +if [ \$status != 0 ]; then
> +    echo "\$0: Failed to source $sdk_script with status \$status"
> +    exit \$status
> +fi
>  
> -    cat >> $script <<EOF
>  if [ -d "${SDKPATHNATIVE}/post-relocate-setup.d/" ]; then
>      for s in ${SDKPATHNATIVE}/post-relocate-setup.d/*; do
>          \$s "\$1"
> diff --git a/meta/recipes-core/meta/meta-environment.bb
> b/meta/recipes-core/meta/meta-environment.bb
> index 09f757a087..74c0600c3d 100644
> --- a/meta/recipes-core/meta/meta-environment.bb
> +++ b/meta/recipes-core/meta/meta-environment.bb
> @@ -51,12 +51,13 @@ create_sdk_files() {
>  	# Setup site file for external use
>  	toolchain_create_sdk_siteconfig
> ${SDK_OUTPUT}/${SDKPATH}/site-config-${REAL_MULTIMACH_TARGET_SYS}
>  
> -	toolchain_create_sdk_env_script
> ${SDK_OUTPUT}/${SDKPATH}/environment-setup-
> ${REAL_MULTIMACH_TARGET_SYS}
> +	sdk_script="${SDKPATH}/environment-setup-
> ${REAL_MULTIMACH_TARGET_SYS}"
> +	toolchain_create_sdk_env_script ${SDK_OUTPUT}/${sdk_script}
>  
>  	# Add version information
>  	toolchain_create_sdk_version
> ${SDK_OUTPUT}/${SDKPATH}/version-${REAL_MULTIMACH_TARGET_SYS}
>  
> -	toolchain_create_post_relocate_script
> ${SDK_OUTPUT}/${SDKPATH}/post-relocate-setup.sh
> +	toolchain_create_post_relocate_script
> ${SDK_OUTPUT}/${SDKPATH}/post-relocate-setup.sh ${sdk_script}
>  }
>  
>  do_install() {


  reply	other threads:[~2018-06-01 22:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01 21:02 [PATCH v2 0/7] meson: implement nativesdk support Martin Kelly
2018-06-01 21:02 ` [PATCH v2 1/7] meson.bbclass: refactor native override Martin Kelly
2018-06-01 21:02 ` [PATCH v2 2/7] nativesdk-python*: suppress user site dirs Martin Kelly
2018-06-01 21:02 ` [PATCH v2 3/7] toolchain-shar-extract: allow non-sh post-relocate Martin Kelly
2018-06-01 21:02 ` [PATCH v2 4/7] toolchain-shar-extract: print post-relocate error Martin Kelly
2018-06-01 21:57   ` Joshua Watt
2018-06-01 22:00     ` Martin Kelly
2018-06-01 21:02 ` [PATCH v2 5/7] toolchain-shar-extract: pass env to post-relocate Martin Kelly
2018-06-01 22:08   ` Joshua Watt [this message]
2018-06-01 22:24     ` Martin Kelly
2018-06-04 17:20       ` Joshua Watt
2018-06-04 18:10         ` Martin Kelly
2018-06-04 18:20           ` Joshua Watt
2018-06-04 18:24             ` Martin Kelly
2018-06-04 18:42               ` Joshua Watt
2018-06-04 19:12                 ` Martin Kelly
2018-06-01 21:02 ` [PATCH v2 6/7] meson: handle exe wrappers Martin Kelly
2018-06-01 21:02 ` [PATCH v2 7/7] meson: enable nativesdk Martin Kelly
2019-01-07 12:41   ` Burton, Ross
2019-01-07 17:54     ` Martin Kelly
2019-01-07 17:55       ` Burton, Ross
2019-01-07 19:03         ` Martin Kelly

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=1fa5f19ad4ac398de0dc6da40c46ead935133dbe.camel@gmail.com \
    --to=jpewhacker@gmail.com \
    --cc=mkelly@xevo.com \
    --cc=openembedded-core@lists.openembedded.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.