Esempio n. 1
0
func init() {

	CCENV = append(CCENV, fmt.Sprintf("%s=%s", "C_INCLUDE_PATH", "include"))
	CCENV = append(CCENV, fmt.Sprintf("%s=%s", "LIBRARY_PATH", "lib"))

	if cc = build.Getenv("CC"); cc == "" {
		cc = "CC"
	}
	if ld = build.Getenv("LD"); ld == "" {
		ld = "ld"
	}
	if ar = build.Getenv("AR"); ar == "" {
		ar = "ar"
	}

	if out, err := exec.Command(cc, "--version").Output(); err != nil {
		CCVersion = "deadbeef"
	} else {
		CCVersion = strings.TrimSpace(string(out))
	}
	if err := ast.Register("cc_library", CLib{}); err != nil {
		log.Fatal(err)
	}
	if err := ast.Register("cxx_library", CLib{}); err != nil {
		log.Fatal(err)
	}
	if err := ast.Register("cc_binary", CBin{}); err != nil {
		log.Fatal(err)
	}
}
Esempio n. 2
0
// Had to be done
func Copier() string {
	if tpfx := build.Getenv("TOOLPREFIX"); tpfx == "" {
		return "objcopy"
	} else {
		return fmt.Sprintf("%s%s", tpfx, "objcopy")
	}
}
Esempio n. 3
0
// Had to be done
func Stripper() string {
	if tpfx := build.Getenv("TOOLPREFIX"); tpfx == "" {
		return "strip"
	} else {
		return fmt.Sprintf("%s%s", tpfx, "strip")
	}
}
Esempio n. 4
0
func Linker() string {
	if tpfx := build.Getenv("TOOLPREFIX"); tpfx == "" {
		return ld
	} else {
		return fmt.Sprintf("%s%s", tpfx, ld)
	}
}
Esempio n. 5
0
func Archiver() string {
	if tpfx := build.Getenv("TOOLPREFIX"); tpfx == "" {
		return ar
	} else {
		return fmt.Sprintf("%s%s", tpfx, ar)
	}
}
Esempio n. 6
0
func Compiler() string {
	if tpfx := build.Getenv("TOOLPREFIX"); tpfx == "" {
		return cc
	} else {
		return fmt.Sprintf("%s%s", tpfx, cc)
	}
}