Skip to contentSkip to conversation

package/Makefile.in: export O= to post-build/image scripts for out-of-tree builds

PATCH New Peter Korsgaard 4 participants 8 messages Jul 14, 2017 – Jul 18, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/Makefile.in: export O= to post-build/image scripts for out-of-tree builds

Sometimes it can be interesting to call back into buildroot from a post-build/image script (E.G. make printvars or similar). For this to work correctly with out-of-tree builds we need to pass O= to make, but this is currently not available in the environment of post-build/image scripts.

In concept, O could be derrived from BUILD_DIR (E.G. by stripping /build), but directly exporting O is cleaner.

O= cannot be exported globally as it interferes with various build systems, so instead add it to EXTRA_ENV.

---
 package/Makefile.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
package/Makefile.in +2 -1
index b95e5e3fa8..a2b0d90f32 100644
@@ -309,7 +309,8 @@ HOST_CONFIGURE_OPTS = \
 EXTRA_ENV = \
 	PATH=$(BR_PATH) \
 	BR2_DL_DIR=$(BR2_DL_DIR) \
-	BUILD_DIR=$(BUILD_DIR)
+	BUILD_DIR=$(BUILD_DIR) \
+	O=$(CANONICAL_O)
 
 ################################################################################
 # settings we need to pass to configure
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 package/Makefile.in: export O= to post-build/image scripts for out-of-tree builds

Peter, All,

On 2017-07-14 15:04 +0200, Peter Korsgaard spake thusly:

Quoted 5 lines

Sometimes it can be interesting to call back into buildroot from a post-build/image script (E.G. make printvars or similar). For this to work correctly with out-of-tree builds we need to pass O= to make, but this is currently not available in the environment of post-build/image scripts.

Quoted 7 lines

In concept, O could be derrived from BUILD_DIR (E.G. by stripping /build), but directly exporting O is cleaner.

O= cannot be exported globally as it interferes with various build systems, so instead add it to EXTRA_ENV.

Regards,
Yann E. MORIN.

Quoted 25 lines
---
 package/Makefile.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
package/Makefile.in +2 -1
index b95e5e3fa8..a2b0d90f32 100644
@@ -309,7 +309,8 @@ HOST_CONFIGURE_OPTS = \
 EXTRA_ENV = \
 	PATH=$(BR_PATH) \
 	BR2_DL_DIR=$(BR2_DL_DIR) \
-	BUILD_DIR=$(BUILD_DIR)
+	BUILD_DIR=$(BUILD_DIR) \
+	O=$(CANONICAL_O)
 
 ################################################################################
 # settings we need to pass to configure
Signature · 6 lines
2.11.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 package/Makefile.in: export O= to post-build/image scripts for out-of-tree builds

In reply to Peter Korsgaard

Hello,

Quoted 8 lines · Peter Korsgaard

Sometimes it can be interesting to call back into buildroot from a post-build/image script (E.G. make printvars or similar). For this to work correctly with out-of-tree builds we need to pass O= to make, but this is currently not available in the environment of post-build/image scripts.

In concept, O could be derrived from BUILD_DIR (E.G. by stripping /build), but directly exporting O is cleaner.

Quoted 7 lines

O= cannot be exported globally as it interferes with various build systems, so instead add it to EXTRA_ENV.

---
 package/Makefile.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH 1/1 package/Makefile.in: export O= to post-build/image scripts for out-of-tree builds

In reply to Peter Korsgaard
Quoted 10 lines · Peter Korsgaard

Sometimes it can be interesting to call back into buildroot from a post-build/image script (E.G. make printvars or similar). For this to work correctly with out-of-tree builds we need to pass O= to make, but this is currently not available in the environment of post-build/image scripts.

In concept, O could be derrived from BUILD_DIR (E.G. by stripping /build), but directly exporting O is cleaner.

O= cannot be exported globally as it interferes with various build systems, so instead add it to EXTRA_ENV.

I'm too late with this comment, but why is BASE_DIR not sufficient? It is
already exported, and it is set to:

BASE_DIR := $(CANONICAL_O)

O has the problem that it's too risky to lead to conflicts IMO.

IOW I vote for a revert of this patch.

Regards,
Arnout

Quoted 21 lines
---
 package/Makefile.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
package/Makefile.in +2 -1
index b95e5e3fa8..a2b0d90f32 100644
@@ -309,7 +309,8 @@ HOST_CONFIGURE_OPTS = \
 EXTRA_ENV = \
 	PATH=$(BR_PATH) \
 	BR2_DL_DIR=$(BR2_DL_DIR) \
-	BUILD_DIR=$(BUILD_DIR)
+	BUILD_DIR=$(BUILD_DIR) \
+	O=$(CANONICAL_O)
 
 ################################################################################
 # settings we need to pass to configure
Signature · 6 lines
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:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#4 lore raw

PATCH 1/1 package/Makefile.in: export O= to post-build/image scripts for out-of-tree builds

Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

Quoted 8 lines · Peter Korsgaard

Sometimes it can be interesting to call back into buildroot from a post-build/image script (E.G. make printvars or similar). For this to work correctly with out-of-tree builds we need to pass O= to make, but this is currently not available in the environment of post-build/image scripts.

In concept, O could be derrived from BUILD_DIR (E.G. by stripping /build), but directly exporting O is cleaner.

Quoted 7 lines
Quoted 2 lines

O= cannot be exported globally as it interferes with various build systems, so instead add it to EXTRA_ENV.

I'm too late with this comment, but why is BASE_DIR not sufficient? It is
already exported, and it is set to:

BASE_DIR := $(CANONICAL_O)

Yes, that can also work - Even though it is less obvious that you should run make O=${BASE_DIR} inside the post build/image scripts, instead of make O=$O

Quoted 1 line

O has the problem that it's too risky to lead to conflicts IMO.

Even for post build/image scripts? What use cases do you have in mind where there could be conflicts?

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 1/1 package/Makefile.in: export O= to post-build/image scripts for out-of-tree builds

Quoted 14 lines · Peter Korsgaard
Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

Quoted 10 lines · Peter Korsgaard

Sometimes it can be interesting to call back into buildroot from a post-build/image script (E.G. make printvars or similar). For this to work correctly with out-of-tree builds we need to pass O= to make, but this is currently not available in the environment of post-build/image scripts.

In concept, O could be derrived from BUILD_DIR (E.G. by stripping /build), but directly exporting O is cleaner.

O= cannot be exported globally as it interferes with various build systems, so instead add it to EXTRA_ENV.

Quoted 8 lines
Quoted 4 lines

I'm too late with this comment, but why is BASE_DIR not sufficient? It is
already exported, and it is set to:

BASE_DIR := $(CANONICAL_O)

Yes, that can also work - Even though it is less obvious that you should run make O=${BASE_DIR} inside the post build/image scripts, instead of make O=$O

OK, but having both exported seems a bit silly...

Quoted 4 lines
Quoted 1 line

O has the problem that it's too risky to lead to conflicts IMO.

Even for post build/image scripts? What use cases do you have in mind where there could be conflicts?

True, in EXTRA_ENV the risk is minimal - especially since Kbuild and
derivatives (like Buildroot) ignore an O passed through the environment.

Regards,
Arnout

Signature · 6 lines
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:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#6 lore raw

PATCH 1/1 package/Makefile.in: export O= to post-build/image scripts for out-of-tree builds

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

Hi,

Quoted 5 lines
Quoted 3 lines

Yes, that can also work - Even though it is less obvious that you should run make O=${BASE_DIR} inside the post build/image scripts, instead of make O=$O

OK, but having both exported seems a bit silly...

Correct. I would argue that O is somewhat nicer than BASE_DIR, as the user is already using O= (and if they don't use O=, then they also don't need to pass it in post-build/post-image scripts), but we have exported and documented BASE_DIR for some time now, so we cannot really get rid of it.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

O has the problem that it's too risky to lead to conflicts IMO.

Even for post build/image scripts? What use cases do you have in mind where there could be conflicts?

True, in EXTRA_ENV the risk is minimal - especially since Kbuild and
derivatives (like Buildroot) ignore an O passed through the environment.

Indeed.

I don't feel strongly pro/con, what do others say?

Signature · 1 line
Bye, Peter Korsgaard
#7 lore raw

PATCH 1/1 package/Makefile.in: export O= to post-build/image scripts for out-of-tree builds

Quoted 21 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

Hi,

Quoted 5 lines
Quoted 3 lines

Yes, that can also work - Even though it is less obvious that you should run make O=${BASE_DIR} inside the post build/image scripts, instead of make O=$O

OK, but having both exported seems a bit silly...

Correct. I would argue that O is somewhat nicer than BASE_DIR, as the user is already using O= (and if they don't use O=, then they also don't need to pass it in post-build/post-image scripts), but we have exported and documented BASE_DIR for some time now, so we cannot really get rid of it.

Quoted 4 lines
Quoted 4 lines
Quoted 1 line

O has the problem that it's too risky to lead to conflicts IMO.

Even for post build/image scripts? What use cases do you have in mind where there could be conflicts?

Quoted 6 lines
Quoted 2 lines

True, in EXTRA_ENV the risk is minimal - especially since Kbuild and
derivatives (like Buildroot) ignore an O passed through the environment.

Indeed.

I don't feel strongly pro/con, what do others say?

Since it's already committed, leave it in. It's no biggy.

Regards,
Arnout

Signature · 6 lines
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:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF