github.com/metux/go-metabuild@v0.0.0-20240118143255-d9ed5ab697f9/util/compiler/probe/ar.go (about)

     1  package probe
     2  
     3  import (
     4  	"os"
     5  
     6  	"github.com/metux/go-metabuild/util/compiler/base"
     7  )
     8  
     9  func probeArCmd(ci *base.CompilerInfo) string {
    10  	// is this the cross compiler ?
    11  	if ci.CrossForHost {
    12  		if e := os.Getenv("AR"); e != "" {
    13  			return e
    14  		}
    15  		return ci.CrossPrefix + "ar"
    16  	}
    17  
    18  	// is this the cross build system ?
    19  	if ci.CrossForBuild {
    20  		if e := os.Getenv("HOST_AR"); e != "" {
    21  			return e
    22  		}
    23  		return "ar"
    24  	}
    25  
    26  	// normal compile
    27  	if e := os.Getenv("AR"); e != "" {
    28  		return e
    29  	}
    30  	return "ar"
    31  }