andrzej-kaczmarek commented on a change in pull request #336: Fix some issues
with per-package custom commands
URL: https://github.com/apache/mynewt-newt/pull/336#discussion_r332117550
##########
File path: newt/builder/buildutil.go
##########
@@ -149,17 +150,35 @@ func (b *Builder) binBasePath() (string, error) {
}
// BasicEnvVars calculates the basic set of environment variables passed to all
-// external scripts. `binBase` is the result of calling `binBasePath()`.
+// external scripts. `binBase` is the result of calling `binBasePath()`, or ""
+// if you don't need the "BIN_BASENAME" setting.
func BasicEnvVars(binBase string, bspPkg *pkg.BspPackage) map[string]string {
coreRepo := project.GetProject().FindRepo("apache-mynewt-core")
bspPath := bspPkg.BasePath()
- return map[string]string{
+ newtPath, _ := osext.Executable()
+
+ m := map[string]string{
"CORE_PATH": coreRepo.Path(),
"BSP_PATH": bspPath,
- "BIN_BASENAME": binBase,
"BIN_ROOT": BinRoot(),
"MYNEWT_PROJECT_ROOT": ProjectRoot(),
+ "MYNEWT_NEWT_PATH": newtPath,
+ }
+
+ if binBase != "" {
+ m["BIN_BASENAME"] = binBase
+ }
+
+ return m
+}
+
+func ToolchainEnvVars(c *toolchain.Compiler) map[string]string {
+ return map[string]string{
+ "MYNEWT_CC_PATH": c.GetCcPath(),
+ "MYNEWT_CPP_PATH": c.GetCppPath(),
+ "MYNEWT_AS_PATH": c.GetAsPath(),
+ "MYNEWT_AR_PATH": c.GetArPath(),
Review comment:
at least `objcopy` is also useful to manipulate objects, but perhaps we
should just expose everything so also `objdump` and `objsize`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services