コード例 #1
0
ファイル: toolchain.go プロジェクト: yl10/goxc
// Build toolchain for a given target platform
func buildToolchain(goos string, arch string, settings *config.Settings) error {
	goroot := settings.GoRoot
	scriptpath := core.GetMakeScriptPath(goroot)
	cmd := exec.Command(scriptpath)

	cmd.Dir = filepath.Join(goroot, "src")

	noClean := settings.GetTaskSettingBool(TASK_BUILD_TOOLCHAIN, "no-clean")
	if noClean {
		cmd.Args = append(cmd.Args, "--no-clean")
	}
	//0.8.5: no longer using cgoEnabled
	env := []string{"GOOS=" + goos, "GOARCH=" + arch}
	extraEnv := settings.GetTaskSettingStringSlice(TASK_BUILD_TOOLCHAIN, "extra-env")
	if settings.IsVerbose() {
		log.Printf("extra-env: %v", extraEnv)
	}
	env = append(env, extraEnv...)
	if goos == platforms.LINUX && arch == platforms.ARM {
		// see http://dave.cheney.net/2012/09/08/an-introduction-to-cross-compilation-with-go
		//NOTE: I don't think it has any effect on fp
		goarm := settings.GetTaskSettingString(TASK_BUILD_TOOLCHAIN, "GOARM")
		if goarm != "" {
			env = append(env, "GOARM="+goarm)
		}
	}

	if settings.IsVerbose() {
		log.Printf("Setting env: %v", env)
	}
	cmd.Env = append([]string{}, os.Environ()...)
	cmd.Env = append(cmd.Env, env...)
	if settings.IsVerbose() {
		log.Printf("'make' env: GOOS=%s GOARCH=%s GOROOT=%s", goos, arch, goroot)
		log.Printf("Invoking '%v' from %s", executils.PrintableArgs(cmd.Args), cmd.Dir)
	}
	executils.RedirectIO(cmd)
	err := executils.StartAndWait(cmd)
	if err != nil {
		log.Printf("Build toolchain: %s", err)
	}
	if settings.IsVerbose() {
		log.Printf("Complete")
	}
	return err
}
コード例 #2
0
ファイル: tag.go プロジェクト: yl10/goxc
func tag(tp TaskParams) error {
	vcs := tp.Settings.GetTaskSettingString(TASK_TAG, "vcs")
	prefix := tp.Settings.GetTaskSettingString(TASK_TAG, "prefix")

	if vcs == "git" {
		version := tp.Settings.GetFullVersionName()
		cmd := exec.Command("git")
		args := []string{"tag", prefix + version}
		err := executils.PrepareCmd(cmd, tp.WorkingDirectory, args, []string{}, tp.Settings.IsVerbose())
		if err != nil {
			return err
		}
		return executils.StartAndWait(cmd)
	} else {
		return errors.New("Only 'git' is supported at this stage")
	}

}
コード例 #3
0
ファイル: codesign.go プロジェクト: yl10/goxc
func signBinary(binPath string, id string) error {
	cmd := exec.Command("codesign")
	cmd.Args = append(cmd.Args, "-s", id, binPath)

	return executils.StartAndWait(cmd)
}