Exemple #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)
	}
}
Exemple #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")
	}
}
Exemple #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")
	}
}
Exemple #4
0
func Linker() string {
	if tpfx := build.Getenv("TOOLPREFIX"); tpfx == "" {
		return ld
	} else {
		return fmt.Sprintf("%s%s", tpfx, ld)
	}
}
Exemple #5
0
func Archiver() string {
	if tpfx := build.Getenv("TOOLPREFIX"); tpfx == "" {
		return ar
	} else {
		return fmt.Sprintf("%s%s", tpfx, ar)
	}
}
Exemple #6
0
func Compiler() string {
	if tpfx := build.Getenv("TOOLPREFIX"); tpfx == "" {
		return cc
	} else {
		return fmt.Sprintf("%s%s", tpfx, cc)
	}
}