You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2019/10/07 16:31:22 UTC

[GitHub] [mynewt-newt] andrzej-kaczmarek commented on a change in pull request #336: Fix some issues with per-package custom commands

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:
users@infra.apache.org


With regards,
Apache Git Services