[OE-core] [PATCH v2 5/7] toolchain-shar-extract: pass env to post-relocate
Martin Kelly
mkelly at xevo.com
Fri Jun 1 22:24:06 UTC 2018
On 06/01/2018 03:08 PM, Joshua Watt wrote:
> 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 at 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
>
>
There's one overall "SDK environment" script (the one you source as a
user to enter the SDK environment), and also customizable ones installed
by nativesdk-* packages (e.g. one that cmake uses). In this patch, I had
not intended that post-relocate scripts should be able to see the
environment scripts for every project but instead just for the global
SDK enivorment (to get at variables like OECORE_NATIVE_SYSROOT).
Let me know if I have missed something and not including the other
environments could cause breakage.
Here's what I mean from an example extracted SDK:
martin at columbia:~$ ls /opt/xos/nanopi-neo-plus2/*environment*
/opt/xos/nanopi-neo-plus2/environment-setup-aarch64-poky-linux
martin at columbia:~$ ls
/opt/xos/nanopi-neo-plus2/sysroots/x86_64-xevo-linux/environment-setup.d/
cmake.sh
In the above example, we are currently sourcing only
/opt/xos/nanopi-neo-plus2/environment-setup-aarch64-poky-linux and not
cmake.sh.
More information about the Openembedded-core
mailing list