mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 10:43:29 +00:00
builder: don't use precompiled libraries
We used these libraries in the past, but stopped doing so a while ago. This is a small cleanup to remove support for these entirely.
This commit is contained in:
committed by
Ron Evans
parent
91e20a53e0
commit
8486e07377
+1
-6
@@ -48,13 +48,8 @@ type Library struct {
|
|||||||
// target config. In other words, pass this libc if the library needs a libc to
|
// target config. In other words, pass this libc if the library needs a libc to
|
||||||
// compile.
|
// compile.
|
||||||
func (l *Library) load(config *compileopts.Config, tmpdir string, libc *compileJob) (job *compileJob, abortLock func(), err error) {
|
func (l *Library) load(config *compileopts.Config, tmpdir string, libc *compileJob) (job *compileJob, abortLock func(), err error) {
|
||||||
outdir, precompiled := config.LibcPath(l.name)
|
outdir := config.LibcPath(l.name)
|
||||||
archiveFilePath := filepath.Join(outdir, "lib.a")
|
archiveFilePath := filepath.Join(outdir, "lib.a")
|
||||||
if precompiled {
|
|
||||||
// Found a precompiled library for this OS/architecture. Return the path
|
|
||||||
// directly.
|
|
||||||
return dummyCompileJob(archiveFilePath), func() {}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a lock on the output (if supported).
|
// Create a lock on the output (if supported).
|
||||||
// This is a bit messy, but avoids a deadlock because it is ordered consistently with other library loads within a build.
|
// This is a bit messy, but avoids a deadlock because it is ordered consistently with other library loads within a build.
|
||||||
|
|||||||
+7
-16
@@ -247,10 +247,9 @@ func MuslArchitecture(triple string) string {
|
|||||||
return CanonicalArchName(triple)
|
return CanonicalArchName(triple)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LibcPath returns the path to the libc directory. The libc path will be either
|
// LibcPath returns the path to the libc directory. The libc path will be a libc
|
||||||
// a precompiled libc shipped with a TinyGo build, or a libc path in the cache
|
// path in the cache directory (which might not yet be built).
|
||||||
// directory (which might not yet be built).
|
func (c *Config) LibcPath(name string) string {
|
||||||
func (c *Config) LibcPath(name string) (path string, precompiled bool) {
|
|
||||||
archname := c.Triple()
|
archname := c.Triple()
|
||||||
if c.CPU() != "" {
|
if c.CPU() != "" {
|
||||||
archname += "-" + c.CPU()
|
archname += "-" + c.CPU()
|
||||||
@@ -266,17 +265,9 @@ func (c *Config) LibcPath(name string) (path string, precompiled bool) {
|
|||||||
archname += "-" + c.Target.Libc
|
archname += "-" + c.Target.Libc
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to load a precompiled library.
|
|
||||||
precompiledDir := filepath.Join(goenv.Get("TINYGOROOT"), "pkg", archname, name)
|
|
||||||
if _, err := os.Stat(precompiledDir); err == nil {
|
|
||||||
// Found a precompiled library for this OS/architecture. Return the path
|
|
||||||
// directly.
|
|
||||||
return precompiledDir, true
|
|
||||||
}
|
|
||||||
|
|
||||||
// No precompiled library found. Determine the path name that will be used
|
// No precompiled library found. Determine the path name that will be used
|
||||||
// in the build cache.
|
// in the build cache.
|
||||||
return filepath.Join(goenv.Get("GOCACHE"), name+"-"+archname), false
|
return filepath.Join(goenv.Get("GOCACHE"), name+"-"+archname)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultBinaryExtension returns the default extension for binaries, such as
|
// DefaultBinaryExtension returns the default extension for binaries, such as
|
||||||
@@ -360,7 +351,7 @@ func (c *Config) LibcCFlags() []string {
|
|||||||
case "picolibc":
|
case "picolibc":
|
||||||
root := goenv.Get("TINYGOROOT")
|
root := goenv.Get("TINYGOROOT")
|
||||||
picolibcDir := filepath.Join(root, "lib", "picolibc", "newlib", "libc")
|
picolibcDir := filepath.Join(root, "lib", "picolibc", "newlib", "libc")
|
||||||
path, _ := c.LibcPath("picolibc")
|
path := c.LibcPath("picolibc")
|
||||||
return []string{
|
return []string{
|
||||||
"-nostdlibinc",
|
"-nostdlibinc",
|
||||||
"-isystem", filepath.Join(path, "include"),
|
"-isystem", filepath.Join(path, "include"),
|
||||||
@@ -370,7 +361,7 @@ func (c *Config) LibcCFlags() []string {
|
|||||||
}
|
}
|
||||||
case "musl":
|
case "musl":
|
||||||
root := goenv.Get("TINYGOROOT")
|
root := goenv.Get("TINYGOROOT")
|
||||||
path, _ := c.LibcPath("musl")
|
path := c.LibcPath("musl")
|
||||||
arch := MuslArchitecture(c.Triple())
|
arch := MuslArchitecture(c.Triple())
|
||||||
return []string{
|
return []string{
|
||||||
"-nostdlibinc",
|
"-nostdlibinc",
|
||||||
@@ -390,7 +381,7 @@ func (c *Config) LibcCFlags() []string {
|
|||||||
return nil
|
return nil
|
||||||
case "mingw-w64":
|
case "mingw-w64":
|
||||||
root := goenv.Get("TINYGOROOT")
|
root := goenv.Get("TINYGOROOT")
|
||||||
path, _ := c.LibcPath("mingw-w64")
|
path := c.LibcPath("mingw-w64")
|
||||||
return []string{
|
return []string{
|
||||||
"-nostdlibinc",
|
"-nostdlibinc",
|
||||||
"-isystem", filepath.Join(path, "include"),
|
"-isystem", filepath.Join(path, "include"),
|
||||||
|
|||||||
Reference in New Issue
Block a user