Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] Accessing environment variables in Config.in
@ 2023-07-12 23:00 Afshin Pir
  2023-07-13 20:25 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Afshin Pir @ 2023-07-12 23:00 UTC (permalink / raw)
  To: buildroot@buildroot.org


[-- Attachment #1.1: Type: text/plain, Size: 979 bytes --]

I wonder if I can access environment variables (or argument passed when running make) in buildroot .in files. For example, I like to have a Config.in file like this:

```
config BR2_PACKAGE_MY_PACKAGE
        bool "cxos_unit_test"
        select BR2_PACKAGE_XYZ if $(NEED_XYZ) = "y"
        select BR2_PACKAGE_GTEST
        help
          This is my package.
```
where NEED_XYZ is an environment variable (or make variable). Can I have such configuration file? If no, what do you suggest to achieve similar behaviour?
________________________________
This email is confidential and may contain information subject to legal privilege. If you are not the intended recipient please advise us of our error by return e-mail then delete this email and any attached files. You may not copy, disclose or use the contents in any way. The views expressed in this email may not be those of Gallagher Group Ltd or subsidiary companies thereof.
________________________________

[-- Attachment #1.2: Type: text/html, Size: 3042 bytes --]

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] Accessing environment variables in Config.in
  2023-07-12 23:00 [Buildroot] Accessing environment variables in Config.in Afshin Pir
@ 2023-07-13 20:25 ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-07-13 20:25 UTC (permalink / raw)
  To: Afshin Pir; +Cc: buildroot@buildroot.org

On Wed, 12 Jul 2023 23:00:52 +0000
Afshin Pir <Afshin.Pir@gallagher.com> wrote:

> I wonder if I can access environment variables (or argument passed when running make) in buildroot .in files. For example, I like to have a Config.in file like this:
> 
> ```
> config BR2_PACKAGE_MY_PACKAGE
>         bool "cxos_unit_test"
>         select BR2_PACKAGE_XYZ if $(NEED_XYZ) = "y"
>         select BR2_PACKAGE_GTEST
>         help
>           This is my package.
> ```
> where NEED_XYZ is an environment variable (or make variable). Can I have such configuration file? If no, what do you suggest to achieve similar behaviour?

Yes, you can. See the top-level Config.in:

config BR2_VERSION
        string
        option env="BR2_VERSION_FULL"

config BR2_HOSTARCH
        string
        option env="HOSTARCH"

config BR2_BASE_DIR
        string
        option env="BASE_DIR"

However, be careful with what you're doing, it could very well be that
you're mis-using environment variable, and that there is a much more
Buildroot-ish way of solving your problem.

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2023-07-13 20:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-12 23:00 [Buildroot] Accessing environment variables in Config.in Afshin Pir
2023-07-13 20:25 ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox