All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] pkg-cmaketargets.mk: do not hardcode absolute path in toolchainfile.cmake
@ 2014-03-01 17:16 Samuel Martin
  2014-03-03  7:05 ` Arnout Vandecappelle
  0 siblings, 1 reply; 7+ messages in thread
From: Samuel Martin @ 2014-03-01 17:16 UTC (permalink / raw)
  To: buildroot

The patch allows sharing or moving the toolchains.

This is a step toward making the toolchain/sdk relocatable.

Closes #6818

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Cc: Uwe Strempel <u.strempel@googlemail.com>
---
 package/pkg-cmake.mk | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index f7e454b..4effb15 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -159,16 +159,18 @@ host-cmake-package = $(call inner-cmake-package,host-$(pkgname),$(call UPPERCASE
 $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
 	@mkdir -p $(@D)
 	@echo -en "\
+	get_filename_component(_HOST_DIR \$${CMAKE_CURRENT_LIST_FILE} PATH)\n\
+	set(_HOST_DIR \"\$${_HOST_DIR}/../../..\")\n\
 	set(CMAKE_SYSTEM_NAME Linux)\n\
-	set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\
-	set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))\n\
+	set(CMAKE_C_COMPILER \"\$${_HOST_DIR}/$(subst $(HOST_DIR)/,,$(TARGET_CROSS))gcc\")\n\
+	set(CMAKE_CXX_COMPILER \"\$${_HOST_DIR}/$(subst $(HOST_DIR)/,,$(TARGET_CROSS))g++\")\n\
 	set(CMAKE_C_FLAGS \"\$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)\" CACHE STRING \"Buildroot CFLAGS\" FORCE)\n\
 	set(CMAKE_CXX_FLAGS \"\$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)\" CACHE STRING \"Buildroot CXXFLAGS\" FORCE)\n\
 	set(CMAKE_INSTALL_SO_NO_EXE 0)\n\
-	set(CMAKE_PROGRAM_PATH \"$(HOST_DIR)/usr/bin\")\n\
-	set(CMAKE_FIND_ROOT_PATH \"$(STAGING_DIR)\")\n\
+	set(CMAKE_PROGRAM_PATH \"\$${_HOST_DIR}/usr/bin\")\n\
+	set(CMAKE_FIND_ROOT_PATH \"\$${_HOST_DIR}/$(STAGING_SUBDIR)\")\n\
 	set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\
 	set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\
 	set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n\
-	set(ENV{PKG_CONFIG_SYSROOT_DIR} \"$(STAGING_DIR)\")\n\
+	set(ENV{PKG_CONFIG_SYSROOT_DIR} \"\$${_HOST_DIR}/$(STAGING_SUBDIR)\")\n\
 	" > $@
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] pkg-cmaketargets.mk: do not hardcode absolute path in toolchainfile.cmake
  2014-03-01 17:16 [Buildroot] [PATCH] pkg-cmaketargets.mk: do not hardcode absolute path in toolchainfile.cmake Samuel Martin
@ 2014-03-03  7:05 ` Arnout Vandecappelle
  2014-04-19 21:59   ` Thomas Petazzoni
  2014-04-20  9:04   ` Samuel Martin
  0 siblings, 2 replies; 7+ messages in thread
From: Arnout Vandecappelle @ 2014-03-03  7:05 UTC (permalink / raw)
  To: buildroot

On 01/03/14 18:16, Samuel Martin wrote:
> The patch allows sharing or moving the toolchains.
> 
> This is a step toward making the toolchain/sdk relocatable.
> 
> Closes #6818
> 
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> Cc: Uwe Strempel <u.strempel@googlemail.com>
> ---
>  package/pkg-cmake.mk | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
> index f7e454b..4effb15 100644
> --- a/package/pkg-cmake.mk
> +++ b/package/pkg-cmake.mk
> @@ -159,16 +159,18 @@ host-cmake-package = $(call inner-cmake-package,host-$(pkgname),$(call UPPERCASE
>  $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
>  	@mkdir -p $(@D)
>  	@echo -en "\
> +	get_filename_component(_HOST_DIR \$${CMAKE_CURRENT_LIST_FILE} PATH)\n\
> +	set(_HOST_DIR \"\$${_HOST_DIR}/../../..\")\n\
>  	set(CMAKE_SYSTEM_NAME Linux)\n\
> -	set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\
> -	set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))\n\
> +	set(CMAKE_C_COMPILER \"\$${_HOST_DIR}/$(subst $(HOST_DIR)/,,$(TARGET_CROSS))gcc\")\n\

 Wouldn't it be more natural to write

set(CMAKE_C_COMPILER \"$(subst $(HOST_DIR)/,\$${_HOST_DIR}/,$(TARGET_CC_NOCCACHE)\")\n\

?

 And BTW this entire piece of code could benefit from a
change in quoting style (' instead of ") and using printf
instead of echo -en. But that's of course unrelated :-)


 Regards,
 Arnout

> +	set(CMAKE_CXX_COMPILER \"\$${_HOST_DIR}/$(subst $(HOST_DIR)/,,$(TARGET_CROSS))g++\")\n\
>  	set(CMAKE_C_FLAGS \"\$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)\" CACHE STRING \"Buildroot CFLAGS\" FORCE)\n\
>  	set(CMAKE_CXX_FLAGS \"\$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)\" CACHE STRING \"Buildroot CXXFLAGS\" FORCE)\n\
>  	set(CMAKE_INSTALL_SO_NO_EXE 0)\n\
> -	set(CMAKE_PROGRAM_PATH \"$(HOST_DIR)/usr/bin\")\n\
> -	set(CMAKE_FIND_ROOT_PATH \"$(STAGING_DIR)\")\n\
> +	set(CMAKE_PROGRAM_PATH \"\$${_HOST_DIR}/usr/bin\")\n\
> +	set(CMAKE_FIND_ROOT_PATH \"\$${_HOST_DIR}/$(STAGING_SUBDIR)\")\n\
>  	set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\
>  	set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\
>  	set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n\
> -	set(ENV{PKG_CONFIG_SYSROOT_DIR} \"$(STAGING_DIR)\")\n\
> +	set(ENV{PKG_CONFIG_SYSROOT_DIR} \"\$${_HOST_DIR}/$(STAGING_SUBDIR)\")\n\
>  	" > $@
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] pkg-cmaketargets.mk: do not hardcode absolute path in toolchainfile.cmake
  2014-03-03  7:05 ` Arnout Vandecappelle
@ 2014-04-19 21:59   ` Thomas Petazzoni
  2014-04-20  8:57     ` Samuel Martin
  2014-04-20  9:04   ` Samuel Martin
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2014-04-19 21:59 UTC (permalink / raw)
  To: buildroot

Samuel,

On Mon, 03 Mar 2014 08:05:39 +0100, Arnout Vandecappelle wrote:

> >  $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
> >  	@mkdir -p $(@D)
> >  	@echo -en "\
> > +	get_filename_component(_HOST_DIR \$${CMAKE_CURRENT_LIST_FILE} PATH)\n\
> > +	set(_HOST_DIR \"\$${_HOST_DIR}/../../..\")\n\
> >  	set(CMAKE_SYSTEM_NAME Linux)\n\
> > -	set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\
> > -	set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))\n\
> > +	set(CMAKE_C_COMPILER \"\$${_HOST_DIR}/$(subst $(HOST_DIR)/,,$(TARGET_CROSS))gcc\")\n\
> 
>  Wouldn't it be more natural to write
> 
> set(CMAKE_C_COMPILER \"$(subst $(HOST_DIR)/,\$${_HOST_DIR}/,$(TARGET_CC_NOCCACHE)\")\n\
> 
> ?

Can you reply to Arnout comment, and/or resend an updated version of
this patch? Or take some other action about it?

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] pkg-cmaketargets.mk: do not hardcode absolute path in toolchainfile.cmake
  2014-04-19 21:59   ` Thomas Petazzoni
@ 2014-04-20  8:57     ` Samuel Martin
  0 siblings, 0 replies; 7+ messages in thread
From: Samuel Martin @ 2014-04-20  8:57 UTC (permalink / raw)
  To: buildroot

Hi all,

On Sat, Apr 19, 2014 at 11:59 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Samuel,
>
> On Mon, 03 Mar 2014 08:05:39 +0100, Arnout Vandecappelle wrote:
>
>> >  $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
>> >     @mkdir -p $(@D)
>> >     @echo -en "\
>> > +   get_filename_component(_HOST_DIR \$${CMAKE_CURRENT_LIST_FILE} PATH)\n\
>> > +   set(_HOST_DIR \"\$${_HOST_DIR}/../../..\")\n\
>> >     set(CMAKE_SYSTEM_NAME Linux)\n\
>> > -   set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\
>> > -   set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))\n\
>> > +   set(CMAKE_C_COMPILER \"\$${_HOST_DIR}/$(subst $(HOST_DIR)/,,$(TARGET_CROSS))gcc\")\n\
>>
>>  Wouldn't it be more natural to write
>>
>> set(CMAKE_C_COMPILER \"$(subst $(HOST_DIR)/,\$${_HOST_DIR}/,$(TARGET_CC_NOCCACHE)\")\n\
>>
>> ?
>
> Can you reply to Arnout comment, and/or resend an updated version of
> this patch? Or take some other action about it?

I'm on it

Regards,

>
> Thanks,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com



-- 
Samuel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] pkg-cmaketargets.mk: do not hardcode absolute path in toolchainfile.cmake
  2014-03-03  7:05 ` Arnout Vandecappelle
  2014-04-19 21:59   ` Thomas Petazzoni
@ 2014-04-20  9:04   ` Samuel Martin
  2014-04-22 16:55     ` Arnout Vandecappelle
  1 sibling, 1 reply; 7+ messages in thread
From: Samuel Martin @ 2014-04-20  9:04 UTC (permalink / raw)
  To: buildroot

Hi Arnout, all,

On Mon, Mar 3, 2014 at 8:05 AM, Arnout Vandecappelle <arnout@mind.be> wrote:
> On 01/03/14 18:16, Samuel Martin wrote:
>> The patch allows sharing or moving the toolchains.
>>
>> This is a step toward making the toolchain/sdk relocatable.
>>
>> Closes #6818
>>
>> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
>> Cc: Uwe Strempel <u.strempel@googlemail.com>
>> ---
>>  package/pkg-cmake.mk | 12 +++++++-----
>>  1 file changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
>> index f7e454b..4effb15 100644
>> --- a/package/pkg-cmake.mk
>> +++ b/package/pkg-cmake.mk
>> @@ -159,16 +159,18 @@ host-cmake-package = $(call inner-cmake-package,host-$(pkgname),$(call UPPERCASE
>>  $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
>>       @mkdir -p $(@D)
>>       @echo -en "\
>> +     get_filename_component(_HOST_DIR \$${CMAKE_CURRENT_LIST_FILE} PATH)\n\
>> +     set(_HOST_DIR \"\$${_HOST_DIR}/../../..\")\n\
>>       set(CMAKE_SYSTEM_NAME Linux)\n\
>> -     set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\
>> -     set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))\n\
>> +     set(CMAKE_C_COMPILER \"\$${_HOST_DIR}/$(subst $(HOST_DIR)/,,$(TARGET_CROSS))gcc\")\n\
>
>  Wouldn't it be more natural to write
>
> set(CMAKE_C_COMPILER \"$(subst $(HOST_DIR)/,\$${_HOST_DIR}/,$(TARGET_CC_NOCCACHE)\")\n\
>
> ?

Good point! Will do.

>
>  And BTW this entire piece of code could benefit from a
> change in quoting style (' instead of ") and using printf
> instead of echo -en. But that's of course unrelated :-)

Agree for printf, but the quoting seems not so easy...
I run some tests [1], it seems that changing the quoting style may not work.
BTW, any tip about how to change/fix this is more than welcome.

Regards,

[1] http://code.bulix.org/9v6wcw-86080


-- 
Samuel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] pkg-cmaketargets.mk: do not hardcode absolute path in toolchainfile.cmake
  2014-04-20  9:04   ` Samuel Martin
@ 2014-04-22 16:55     ` Arnout Vandecappelle
  2014-04-22 23:35       ` Samuel Martin
  0 siblings, 1 reply; 7+ messages in thread
From: Arnout Vandecappelle @ 2014-04-22 16:55 UTC (permalink / raw)
  To: buildroot

On 20/04/14 11:04, Samuel Martin wrote:
> Hi Arnout, all,
> 
> On Mon, Mar 3, 2014 at 8:05 AM, Arnout Vandecappelle <arnout@mind.be> wrote:
>> On 01/03/14 18:16, Samuel Martin wrote:
>>> The patch allows sharing or moving the toolchains.
>>>
>>> This is a step toward making the toolchain/sdk relocatable.
>>>
>>> Closes #6818
>>>
>>> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
>>> Cc: Uwe Strempel <u.strempel@googlemail.com>
>>> ---
>>>  package/pkg-cmake.mk | 12 +++++++-----
>>>  1 file changed, 7 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
>>> index f7e454b..4effb15 100644
>>> --- a/package/pkg-cmake.mk
>>> +++ b/package/pkg-cmake.mk
>>> @@ -159,16 +159,18 @@ host-cmake-package = $(call inner-cmake-package,host-$(pkgname),$(call UPPERCASE
>>>  $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
>>>       @mkdir -p $(@D)
>>>       @echo -en "\
>>> +     get_filename_component(_HOST_DIR \$${CMAKE_CURRENT_LIST_FILE} PATH)\n\
>>> +     set(_HOST_DIR \"\$${_HOST_DIR}/../../..\")\n\
>>>       set(CMAKE_SYSTEM_NAME Linux)\n\
>>> -     set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\
>>> -     set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))\n\
>>> +     set(CMAKE_C_COMPILER \"\$${_HOST_DIR}/$(subst $(HOST_DIR)/,,$(TARGET_CROSS))gcc\")\n\
>>
>>  Wouldn't it be more natural to write
>>
>> set(CMAKE_C_COMPILER \"$(subst $(HOST_DIR)/,\$${_HOST_DIR}/,$(TARGET_CC_NOCCACHE)\")\n\
>>
>> ?
> 
> Good point! Will do.
> 
>>
>>  And BTW this entire piece of code could benefit from a
>> change in quoting style (' instead of ") and using printf
>> instead of echo -en. But that's of course unrelated :-)
> 
> Agree for printf, but the quoting seems not so easy...
> I run some tests [1], it seems that changing the quoting style may not work.
> BTW, any tip about how to change/fix this is more than welcome.
> 
> Regards,
> 
> [1] http://code.bulix.org/9v6wcw-86080

 Right, I forgot that the backslash is still passed. This would work, but
is not much better:

@printf \
'get_filename_component(_HOST_DIR $${CMAKE_CURRENT_LIST_FILE} PATH)\n'\
'...'\


 Or this works as well:

 @printf '$(subst $(sep),\n,$(TOOLCHAINFILE_CMAKE))' > $@


define TOOLCHAINFILE_CMAKE
  get_filename_component(_HOST_DIR $${CMAKE_CURRENT_LIST_FILE} PATH)
  ...
endef

 But I'm not 100% convinced that that is better either.


 Regards,
 Arnout

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] pkg-cmaketargets.mk: do not hardcode absolute path in toolchainfile.cmake
  2014-04-22 16:55     ` Arnout Vandecappelle
@ 2014-04-22 23:35       ` Samuel Martin
  0 siblings, 0 replies; 7+ messages in thread
From: Samuel Martin @ 2014-04-22 23:35 UTC (permalink / raw)
  To: buildroot

Hi Arnout, all,

On Tue, Apr 22, 2014 at 6:55 PM, Arnout Vandecappelle <arnout@mind.be> wrote:
[...]
>  Right, I forgot that the backslash is still passed. This would work, but
> is not much better:
>
> @printf \
> 'get_filename_component(_HOST_DIR $${CMAKE_CURRENT_LIST_FILE} PATH)\n'\
> '...'\
>
>
>  Or this works as well:
>
>  @printf '$(subst $(sep),\n,$(TOOLCHAINFILE_CMAKE))' > $@
>
>
> define TOOLCHAINFILE_CMAKE
>   get_filename_component(_HOST_DIR $${CMAKE_CURRENT_LIST_FILE} PATH)
>   ...
> endef
>
>  But I'm not 100% convinced that that is better either.
>

Thanks a lot for the tips.

I think I'll go for the 2nd solution, with the least quotes and the
content of "define ... endef" the closest to the one of the
toolchainfile.cmake file (only $ needs to be escaped).

However I have no strong opinion about this, so if someone thinks to a
better solution, please speak up.

Regards,

-- 
Samuel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-04-22 23:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-01 17:16 [Buildroot] [PATCH] pkg-cmaketargets.mk: do not hardcode absolute path in toolchainfile.cmake Samuel Martin
2014-03-03  7:05 ` Arnout Vandecappelle
2014-04-19 21:59   ` Thomas Petazzoni
2014-04-20  8:57     ` Samuel Martin
2014-04-20  9:04   ` Samuel Martin
2014-04-22 16:55     ` Arnout Vandecappelle
2014-04-22 23:35       ` Samuel Martin

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.