builder: simplify bdwgc libc dependency

Header files are built immediately, not in a separate job, so no
dependency is needed here. All we need is a flag whether to add flags
for that given libc.
This commit is contained in:
Ayke van Laethem
2025-03-19 08:58:10 +01:00
committed by Ron Evans
parent 8486e07377
commit 4c54aa20da
3 changed files with 13 additions and 24 deletions
+5 -12
View File
@@ -25,6 +25,9 @@ type Library struct {
// cflags returns the C flags specific to this library
cflags func(target, headerPath string) []string
// needsLibc is set to true if this library needs libc headers.
needsLibc bool
// The source directory.
sourceDir func() string
@@ -43,11 +46,7 @@ type Library struct {
// output archive file, it is expected to be removed after use.
// As a side effect, this call creates the library header files if they didn't
// exist yet.
// The provided libc job (if not null) will cause this libc to be added as a
// dependency for all C compiler jobs, and adds libc headers for the given
// target config. In other words, pass this libc if the library needs a libc to
// 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) (job *compileJob, abortLock func(), err error) {
outdir := config.LibcPath(l.name)
archiveFilePath := filepath.Join(outdir, "lib.a")
@@ -180,7 +179,7 @@ func (l *Library) load(config *compileopts.Config, tmpdir string, libc *compileJ
args = append(args, "-mfpu=vfpv2")
}
}
if libc != nil {
if l.needsLibc {
args = append(args, config.LibcCFlags()...)
}
@@ -251,9 +250,6 @@ func (l *Library) load(config *compileopts.Config, tmpdir string, libc *compileJ
return nil
},
}
if libc != nil {
objfile.dependencies = append(objfile.dependencies, libc)
}
job.dependencies = append(job.dependencies, objfile)
}
@@ -284,9 +280,6 @@ func (l *Library) load(config *compileopts.Config, tmpdir string, libc *compileJ
return os.Rename(tmpfile.Name(), filepath.Join(outdir, "crt1.o"))
},
}
if libc != nil {
crt1Job.dependencies = append(crt1Job.dependencies, libc)
}
job.dependencies = append(job.dependencies, crt1Job)
}