diff options
| -rw-r--r-- | bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml index 64f08157f6..d4f73ae145 100644 --- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml +++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml | |||
| @@ -476,6 +476,53 @@ | |||
| 476 | </section> | 476 | </section> |
| 477 | </section> | 477 | </section> |
| 478 | 478 | ||
| 479 | <section id='exporting-variables-to-the-environment'> | ||
| 480 | <title>Exporting Variables to the Environment</title> | ||
| 481 | |||
| 482 | <para> | ||
| 483 | You can export variables to the environment of running | ||
| 484 | tasks by using the <filename>export</filename> keyword. | ||
| 485 | For example, in the following example, the | ||
| 486 | <filename>do_foo</filename> task prints "value from | ||
| 487 | the environment" when run: | ||
| 488 | <literallayout class='monospaced'> | ||
| 489 | export ENV_VARIABLE | ||
| 490 | ENV_VARIABLE = "value from the environment" | ||
| 491 | |||
| 492 | do_foo() { | ||
| 493 | bbplain "$ENV_VARIABLE" | ||
| 494 | } | ||
| 495 | </literallayout> | ||
| 496 | <note> | ||
| 497 | BitBake does not expand <filename>$ENV_VARIABLE</filename> | ||
| 498 | in this case because it lacks the obligatory | ||
| 499 | <filename>{}</filename>. | ||
| 500 | Rather, <filename>$ENV_VARIABLE</filename> is expanded | ||
| 501 | by the shell. | ||
| 502 | </note> | ||
| 503 | It does not matter whether | ||
| 504 | <filename>export ENV_VARIABLE</filename> appears before or | ||
| 505 | after assignments to <filename>ENV_VARIABLE</filename>. | ||
| 506 | </para> | ||
| 507 | |||
| 508 | <para> | ||
| 509 | It is also possible to combine <filename>export</filename> | ||
| 510 | with setting a value for the variable. | ||
| 511 | Here is an example: | ||
| 512 | <literallayout class='monospaced'> | ||
| 513 | export ENV_VARIABLE = "<replaceable>variable-value</replaceable>" | ||
| 514 | </literallayout> | ||
| 515 | In the output of <filename>bitbake -e</filename>, variables | ||
| 516 | that are exported to the environment are preceded by "export". | ||
| 517 | </para> | ||
| 518 | |||
| 519 | <para> | ||
| 520 | Among the variables commonly exported to the environment | ||
| 521 | are <filename>CC</filename> and <filename>CFLAGS</filename>, | ||
| 522 | which are picked up by many build systems. | ||
| 523 | </para> | ||
| 524 | </section> | ||
| 525 | |||
| 479 | <section id='conditional-syntax-overrides'> | 526 | <section id='conditional-syntax-overrides'> |
| 480 | <title>Conditional Syntax (Overrides)</title> | 527 | <title>Conditional Syntax (Overrides)</title> |
| 481 | 528 | ||
