Skip to content

Commit 2d6d9eb

Browse files
committed
ci: don't include prebuilt libraries in the release
These libraries will be automatically built when needed and cached. The main reason these were needed is for play.tinygo.org, but I've now prebuilt them there directly (so they don't need to be built for every tarball).
1 parent a8a532f commit 2d6d9eb

File tree

9 files changed

+14
-80
lines changed

9 files changed

+14
-80
lines changed

GNUmakefile

-9
Original file line numberDiff line numberDiff line change
@@ -867,9 +867,6 @@ build/release: tinygo gen-device wasi-libc $(if $(filter 1,$(USE_SYSTEM_BINARYEN
867867
@mkdir -p build/release/tinygo/lib/wasi-libc/libc-top-half/musl/arch
868868
@mkdir -p build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
869869
@mkdir -p build/release/tinygo/lib/wasi-cli/
870-
@mkdir -p build/release/tinygo/pkg/thumbv6m-unknown-unknown-eabi-cortex-m0
871-
@mkdir -p build/release/tinygo/pkg/thumbv6m-unknown-unknown-eabi-cortex-m0plus
872-
@mkdir -p build/release/tinygo/pkg/thumbv7em-unknown-unknown-eabi-cortex-m4
873870
@echo copying source files
874871
@cp -p build/tinygo$(EXE) build/release/tinygo/bin
875872
ifneq ($(USE_SYSTEM_BINARYEN),1)
@@ -932,12 +929,6 @@ endif
932929
@cp -rp llvm-project/compiler-rt/LICENSE.TXT build/release/tinygo/lib/compiler-rt-builtins
933930
@cp -rp src build/release/tinygo/src
934931
@cp -rp targets build/release/tinygo/targets
935-
./build/release/tinygo/bin/tinygo build-library -target=cortex-m0 -o build/release/tinygo/pkg/thumbv6m-unknown-unknown-eabi-cortex-m0/compiler-rt compiler-rt
936-
./build/release/tinygo/bin/tinygo build-library -target=cortex-m0plus -o build/release/tinygo/pkg/thumbv6m-unknown-unknown-eabi-cortex-m0plus/compiler-rt compiler-rt
937-
./build/release/tinygo/bin/tinygo build-library -target=cortex-m4 -o build/release/tinygo/pkg/thumbv7em-unknown-unknown-eabi-cortex-m4/compiler-rt compiler-rt
938-
./build/release/tinygo/bin/tinygo build-library -target=cortex-m0 -o build/release/tinygo/pkg/thumbv6m-unknown-unknown-eabi-cortex-m0/picolibc picolibc
939-
./build/release/tinygo/bin/tinygo build-library -target=cortex-m0plus -o build/release/tinygo/pkg/thumbv6m-unknown-unknown-eabi-cortex-m0plus/picolibc picolibc
940-
./build/release/tinygo/bin/tinygo build-library -target=cortex-m4 -o build/release/tinygo/pkg/thumbv7em-unknown-unknown-eabi-cortex-m4/picolibc picolibc
941932

942933
release:
943934
tar -czf build/release.tar.gz -C build/release tinygo

builder/build.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,15 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
148148
job := makeDarwinLibSystemJob(config, tmpdir)
149149
libcDependencies = append(libcDependencies, job)
150150
case "musl":
151-
job, unlock, err := Musl.load(config, tmpdir)
151+
job, unlock, err := libMusl.load(config, tmpdir)
152152
if err != nil {
153153
return BuildResult{}, err
154154
}
155155
defer unlock()
156156
libcDependencies = append(libcDependencies, dummyCompileJob(filepath.Join(filepath.Dir(job.result), "crt1.o")))
157157
libcDependencies = append(libcDependencies, job)
158158
case "picolibc":
159-
libcJob, unlock, err := Picolibc.load(config, tmpdir)
159+
libcJob, unlock, err := libPicolibc.load(config, tmpdir)
160160
if err != nil {
161161
return BuildResult{}, err
162162
}
@@ -169,14 +169,14 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
169169
}
170170
libcDependencies = append(libcDependencies, dummyCompileJob(path))
171171
case "wasmbuiltins":
172-
libcJob, unlock, err := WasmBuiltins.load(config, tmpdir)
172+
libcJob, unlock, err := libWasmBuiltins.load(config, tmpdir)
173173
if err != nil {
174174
return BuildResult{}, err
175175
}
176176
defer unlock()
177177
libcDependencies = append(libcDependencies, libcJob)
178178
case "mingw-w64":
179-
_, unlock, err := MinGW.load(config, tmpdir)
179+
_, unlock, err := libMinGW.load(config, tmpdir)
180180
if err != nil {
181181
return BuildResult{}, err
182182
}
@@ -651,7 +651,7 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
651651
// Add compiler-rt dependency if needed. Usually this is a simple load from
652652
// a cache.
653653
if config.Target.RTLib == "compiler-rt" {
654-
job, unlock, err := CompilerRT.load(config, tmpdir)
654+
job, unlock, err := libCompilerRT.load(config, tmpdir)
655655
if err != nil {
656656
return result, err
657657
}

builder/builtins.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,12 @@ var avrBuiltins = []string{
169169
"avr/udivmodqi4.S",
170170
}
171171

172-
// CompilerRT is a library with symbols required by programs compiled with LLVM.
173-
// These symbols are for operations that cannot be emitted with a single
172+
// libCompilerRT is a library with symbols required by programs compiled with
173+
// LLVM. These symbols are for operations that cannot be emitted with a single
174174
// instruction or a short sequence of instructions for that target.
175175
//
176176
// For more information, see: https://compiler-rt.llvm.org/
177-
var CompilerRT = Library{
177+
var libCompilerRT = Library{
178178
name: "compiler-rt",
179179
cflags: func(target, headerPath string) []string {
180180
return []string{"-Werror", "-Wall", "-std=c11", "-nostdlibinc"}

builder/library.go

-13
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,6 @@ type Library struct {
3535
crt1Source string
3636
}
3737

38-
// Load the library archive, possibly generating and caching it if needed.
39-
// The resulting directory may be stored in the provided tmpdir, which is
40-
// expected to be removed after the Load call.
41-
func (l *Library) Load(config *compileopts.Config, tmpdir string) (dir string, err error) {
42-
job, unlock, err := l.load(config, tmpdir)
43-
if err != nil {
44-
return "", err
45-
}
46-
defer unlock()
47-
err = runJobs(job, config.Options.Semaphore)
48-
return filepath.Dir(job.result), err
49-
}
50-
5138
// load returns a compile job to build this library file for the given target
5239
// and CPU. It may return a dummy compileJob if the library build is already
5340
// cached. The path is stored as job.result but is only valid after the job has

builder/mingw-w64.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/tinygo-org/tinygo/goenv"
1111
)
1212

13-
var MinGW = Library{
13+
var libMinGW = Library{
1414
name: "mingw-w64",
1515
makeHeaders: func(target, includeDir string) error {
1616
// copy _mingw.h

builder/musl.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/tinygo-org/tinygo/goenv"
1313
)
1414

15-
var Musl = Library{
15+
var libMusl = Library{
1616
name: "musl",
1717
makeHeaders: func(target, includeDir string) error {
1818
bits := filepath.Join(includeDir, "bits")

builder/picolibc.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88
"github.com/tinygo-org/tinygo/goenv"
99
)
1010

11-
// Picolibc is a C library for bare metal embedded devices. It was originally
11+
// libPicolibc is a C library for bare metal embedded devices. It was originally
1212
// based on newlib.
13-
var Picolibc = Library{
13+
var libPicolibc = Library{
1414
name: "picolibc",
1515
makeHeaders: func(target, includeDir string) error {
1616
f, err := os.Create(filepath.Join(includeDir, "picolibc.h"))

builder/wasmbuiltins.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/tinygo-org/tinygo/goenv"
88
)
99

10-
var WasmBuiltins = Library{
10+
var libWasmBuiltins = Library{
1111
name: "wasmbuiltins",
1212
makeHeaders: func(target, includeDir string) error {
1313
if err := os.Mkdir(includeDir+"/bits", 0o777); err != nil {

main.go

+1-45
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@ func main() {
14371437
flag.BoolVar(&flagTest, "test", false, "supply -test flag to go list")
14381438
}
14391439
var outpath string
1440-
if command == "help" || command == "build" || command == "build-library" || command == "test" {
1440+
if command == "help" || command == "build" || command == "test" {
14411441
flag.StringVar(&outpath, "o", "", "output filename")
14421442
}
14431443

@@ -1570,50 +1570,6 @@ func main() {
15701570

15711571
err := Build(pkgName, outpath, options)
15721572
handleCompilerError(err)
1573-
case "build-library":
1574-
// Note: this command is only meant to be used while making a release!
1575-
if outpath == "" {
1576-
fmt.Fprintln(os.Stderr, "No output filename supplied (-o).")
1577-
usage(command)
1578-
os.Exit(1)
1579-
}
1580-
if *target == "" {
1581-
fmt.Fprintln(os.Stderr, "No target (-target).")
1582-
}
1583-
if flag.NArg() != 1 {
1584-
fmt.Fprintf(os.Stderr, "Build-library only accepts exactly one library name as argument, %d given\n", flag.NArg())
1585-
usage(command)
1586-
os.Exit(1)
1587-
}
1588-
var lib *builder.Library
1589-
switch name := flag.Arg(0); name {
1590-
case "compiler-rt":
1591-
lib = &builder.CompilerRT
1592-
case "picolibc":
1593-
lib = &builder.Picolibc
1594-
default:
1595-
fmt.Fprintf(os.Stderr, "Unknown library: %s\n", name)
1596-
os.Exit(1)
1597-
}
1598-
tmpdir, err := os.MkdirTemp("", "tinygo*")
1599-
if err != nil {
1600-
handleCompilerError(err)
1601-
}
1602-
defer os.RemoveAll(tmpdir)
1603-
spec, err := compileopts.LoadTarget(options)
1604-
if err != nil {
1605-
handleCompilerError(err)
1606-
}
1607-
config := &compileopts.Config{
1608-
Options: options,
1609-
Target: spec,
1610-
}
1611-
path, err := lib.Load(config, tmpdir)
1612-
handleCompilerError(err)
1613-
err = copyFile(path, outpath)
1614-
if err != nil {
1615-
handleCompilerError(err)
1616-
}
16171573
case "flash", "gdb", "lldb":
16181574
pkgName := filepath.ToSlash(flag.Arg(0))
16191575
if command == "flash" {

0 commit comments

Comments
 (0)