MCPcopy Create free account
hub / github.com/celer-pkg/celer / setEnvFlags

Method setEnvFlags

buildsystems/buildconfig_envs.go:330–364  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

328}
329
330func (b *BuildConfig) setEnvFlags() {
331 rootfs := b.Ctx.Platform().GetRootFS()
332 tmpDepsDir := filepath.Join(dirs.TmpDepsDir, b.PortConfig.LibraryDir)
333 hostBuild := b.DevDep || b.HostDev
334
335 // sysroot and tmp dir.
336 if rootfs != nil && !hostBuild {
337 // Set sysroot.
338 sysrootDir := rootfs.GetAbsDir()
339 b.envBackup.setenv("SYSROOT", sysrootDir)
340
341 // Update CFLAGS/CXXFLAGS
342 b.appendIncludeDir(filepath.Join(tmpDepsDir, "include"))
343 for _, item := range rootfs.GetIncludeDirs() {
344 includeDir := filepath.Join(sysrootDir, item)
345 b.appendIncludeDir(includeDir)
346 }
347
348 // Update LDFLAGS
349 // Add dependency lib dir first (so it takes higher priority than sysroot lib dirs).
350 b.appendLibDir(filepath.Join(tmpDepsDir, "lib"))
351
352 // Add sysroot lib dirs.
353 for _, item := range rootfs.GetLibDirs() {
354 libDir := filepath.Join(sysrootDir, item)
355 if fileio.PathExists(libDir) {
356 b.appendLibDir(libDir)
357 }
358 }
359 } else {
360 // Update CFLAGS/CXXFLAGS/LDFLAGS
361 b.appendIncludeDir(filepath.Join(tmpDepsDir, "include"))
362 b.appendLibDir(filepath.Join(tmpDepsDir, "lib"))
363 }
364}
365
366func (b BuildConfig) rollbackEnvs() {
367 b.envBackup.rollback()

Callers 1

setupEnvsMethod · 0.95

Calls 9

appendIncludeDirMethod · 0.95
appendLibDirMethod · 0.95
PathExistsFunction · 0.92
setenvMethod · 0.80
GetRootFSMethod · 0.65
PlatformMethod · 0.65
GetAbsDirMethod · 0.65
GetIncludeDirsMethod · 0.65
GetLibDirsMethod · 0.65

Tested by

no test coverage detected