fix: newlib url and rt url
This commit is contained in:
@@ -10,11 +10,8 @@ import (
|
||||
func GetNewlibESP32Config(baseDir, arch string) *compile.CompileConfig {
|
||||
libcDir := filepath.Join(baseDir, "newlib", "libc")
|
||||
|
||||
// headerFile, _ := os.Create(filepath.Join(baseDir, "picolibc.h"))
|
||||
// headerFile.Close()
|
||||
|
||||
return &compile.CompileConfig{
|
||||
Url: "https://github.com/MeteorsLiu/newlib-esp32/archive/refs/heads/esp-4.3.0.zip",
|
||||
Url: "https://github.com/goplus/newlib/archive/refs/tags/v0.1.0.tar.gz",
|
||||
Name: "newlib-esp32",
|
||||
Groups: []compile.CompileGroup{
|
||||
{
|
||||
@@ -987,6 +984,6 @@ func GetNewlibESP32Config(baseDir, arch string) *compile.CompileConfig {
|
||||
},
|
||||
},
|
||||
},
|
||||
ArchiveSrcDir: "newlib-esp32-esp-4.3.0",
|
||||
ArchiveSrcDir: "newlib-0.1.0",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func GetCompilerRTConfig(baseDir, arch string) *compile.CompileConfig {
|
||||
return &compile.CompileConfig{
|
||||
Url: "https://github.com/MeteorsLiu/llvm-project/archive/refs/heads/compiler-rt.zip",
|
||||
ArchiveSrcDir: "llvm-project-compiler-rt",
|
||||
Url: "https://github.com/goplus/compiler-rt/archive/refs/tags/v0.1.0.tar.gz",
|
||||
ArchiveSrcDir: "compiler-rt-0.1.0",
|
||||
Groups: []compile.CompileGroup{
|
||||
{
|
||||
OutputFileName: "libclang_builtins.a",
|
||||
|
||||
@@ -26,6 +26,7 @@ type Export struct {
|
||||
BuildTags []string
|
||||
GOOS string
|
||||
GOARCH string
|
||||
Libc string
|
||||
Linker string // Linker to use (e.g., "ld.lld", "avr-ld")
|
||||
ExtraFiles []string // Extra files to compile and link (e.g., .s, .c files)
|
||||
ClangRoot string // Root directory of custom clang installation
|
||||
@@ -220,8 +221,16 @@ func ldFlagsFromFileName(fileName string) string {
|
||||
return strings.TrimPrefix(strings.TrimSuffix(fileName, ".a"), "lib")
|
||||
}
|
||||
|
||||
func getOrCompileWithConfig(compileConfig *compile.CompileConfig, outputDir, cc, linkerName, libName string, exportCCFlags, exportLDFlags []string) (ldflags []string, err error) {
|
||||
if err = checkDownloadAndExtractLib(compileConfig, compileConfig.Url, outputDir, compileConfig.ArchiveSrcDir); err != nil {
|
||||
func getOrCompileWithConfig(
|
||||
compileConfig *compile.CompileConfig,
|
||||
outputDir, cc, linkerName string,
|
||||
exportCCFlags, exportLDFlags []string,
|
||||
) (ldflags []string, err error) {
|
||||
if err = checkDownloadAndExtractLib(
|
||||
compileConfig,
|
||||
compileConfig.Url, outputDir,
|
||||
compileConfig.ArchiveSrcDir,
|
||||
); err != nil {
|
||||
return
|
||||
}
|
||||
ldflags = append(ldflags, "-nostdlib", "-L"+outputDir)
|
||||
@@ -608,11 +617,13 @@ func useTarget(targetName string) (export Export, err error) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
libcLDFlags, err = getOrCompileWithConfig(compileConfig, outputDir, export.CC, export.Linker, config.Libc, ccflags, ldflags)
|
||||
libcLDFlags, err = getOrCompileWithConfig(compileConfig, outputDir, export.CC, export.Linker, ccflags, ldflags)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
ldflags = append(ldflags, libcLDFlags...)
|
||||
|
||||
export.Libc = config.Libc
|
||||
}
|
||||
|
||||
if config.RTLib != "" {
|
||||
@@ -625,7 +636,7 @@ func useTarget(targetName string) (export Export, err error) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
rtLibLDFlags, err = getOrCompileWithConfig(compileConfig, outputDir, export.CC, export.Linker, config.RTLib, ccflags, ldflags)
|
||||
rtLibLDFlags, err = getOrCompileWithConfig(compileConfig, outputDir, export.CC, export.Linker, ccflags, ldflags)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ func checkDownloadAndExtractLib(cfg *compile.CompileConfig, url, dstDir, interna
|
||||
}
|
||||
fmt.Fprintf(os.Stderr, "%s not found in LLGO_ROOT or cache, will download and compile.\n", dstDir)
|
||||
|
||||
description := fmt.Sprintf("Libc %s", path.Base(url))
|
||||
description := fmt.Sprintf("Lib %s", path.Base(url))
|
||||
|
||||
// Use temporary extraction directory
|
||||
tempExtractDir := dstDir + ".extract"
|
||||
|
||||
Reference in New Issue
Block a user