chore: fix some wrong commets

This commit is contained in:
Haolan
2025-09-09 17:45:02 +08:00
parent 6aa63121ff
commit d4474be921
7 changed files with 24 additions and 9 deletions

View File

@@ -27,12 +27,16 @@ type CompileGroup struct {
LDFlags []string // Linker flags
}
// IsCompiled checks if the compile group has already been compiled by verifying
// if the output archive file exists in the specified directory
func (g CompileGroup) IsCompiled(outputDir string) bool {
archive := filepath.Join(outputDir, filepath.Base(g.OutputFileName))
_, err := os.Stat(archive)
return err == nil
}
// Compile compiles all source files in the group into a static library archive
// If the archive already exists, compilation is skipped
func (g CompileGroup) Compile(
outputDir string, options CompileOptions,
) (err error) {
@@ -101,11 +105,13 @@ type CompileConfig struct {
type LibConfig struct {
Url string
Name string // compile name (e.g., "picolibc", "musl", "glibc")
Name string // Library name (e.g., "picolibc", "musl", "glibc")
Version string
ArchiveSrcDir string
}
// String returns a string representation of the library configuration
// in the format "name-version"
func (cfg LibConfig) String() string {
return fmt.Sprintf("%s-%s", cfg.Name, cfg.Version)
}

View File

@@ -11,8 +11,8 @@ import (
"github.com/goplus/llgo/xtool/nm"
)
func TestIsCompile(t *testing.T) {
t.Run("IsCompile Not Exists", func(t *testing.T) {
func TestIsCompiled(t *testing.T) {
t.Run("IsCompiled Not Exists", func(t *testing.T) {
cfg := CompileConfig{
Groups: []CompileGroup{
{
@@ -25,7 +25,7 @@ func TestIsCompile(t *testing.T) {
t.Errorf("unexpected result: should false")
}
})
t.Run("IsCompile Exists", func(t *testing.T) {
t.Run("IsCompiled Exists", func(t *testing.T) {
tmpFile, err := os.CreateTemp("", "test*.a")
if err != nil {
t.Error(err)

View File

@@ -21,10 +21,12 @@ var _libcCCFlags = []string{
"-ffreestanding",
}
// withDefaultCCFlags appends default C compiler flags to the provided flags
func withDefaultCCFlags(ccflags []string) []string {
return append(ccflags, _libcCCFlags...)
}
// GetNewlibESP32Config returns the configuration for downloading and building newlib for ESP32
func GetNewlibESP32Config() compile.LibConfig {
return compile.LibConfig{
Url: "https://github.com/goplus/newlib/archive/refs/tags/esp-4.3.0_20250211-patch3.tar.gz",

View File

@@ -7,6 +7,7 @@ import (
"github.com/goplus/llgo/internal/crosscompile/compile"
)
// GetPicolibcConfig returns the configuration for downloading and building picolibc
func GetPicolibcConfig() compile.LibConfig {
return compile.LibConfig{
Name: "picolibc",