From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Afshin Pir <Afshin.Pir@gallagher.com>
Cc: "buildroot@buildroot.org" <buildroot@buildroot.org>
Subject: Re: [Buildroot] Accessing environment variables in Config.in
Date: Thu, 13 Jul 2023 22:25:27 +0200 [thread overview]
Message-ID: <20230713222527.3c1166c2@windsurf> (raw)
In-Reply-To: <SY2PR01MB27786466E6AB5D0D52F21CDB9436A@SY2PR01MB2778.ausprd01.prod.outlook.com>
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
prev parent reply other threads:[~2023-07-13 20:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-12 23:00 [Buildroot] Accessing environment variables in Config.in Afshin Pir
2023-07-13 20:25 ` Thomas Petazzoni via buildroot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230713222527.3c1166c2@windsurf \
--to=buildroot@buildroot.org \
--cc=Afshin.Pir@gallagher.com \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox