Browse Source

main: use wasm-ld instead of wasm-ld-8 on macOS

This commit does a few things:
  * remove the -8 suffix on macOS, where it is not necessary
  * add smoke tests for compiling wasm files on Linux and macOS
pull/184/head
Ayke van Laethem 6 years ago
committed by Ron Evans
parent
commit
31d57fd3d1
  1. 1
      .circleci/config.yml
  2. 1
      .travis.yml
  3. 2
      commands_macos.go
  4. 4
      main.go
  5. 2
      targets/wasm.json

1
.circleci/config.yml

@ -66,6 +66,7 @@ commands:
- run: tinygo build -size short -o test.elf -target=pca10056 examples/blinky2
- run: tinygo build -size short -o test.elf -target=itsybitsy-m0 examples/blinky1
- run: tinygo build -size short -o test.elf -target=circuitplay-express examples/blinky1
- run: tinygo build -o wasm.wasm -target=wasm examples/wasm
test-linux:
parameters:
llvm:

1
.travis.yml

@ -38,3 +38,4 @@ script:
- tinygo build -size short -o blinky1.pca10056.elf -target=pca10056 examples/blinky1
- tinygo build -size short -o blinky2.pca10056.elf -target=pca10056 examples/blinky2
- tinygo build -size short -o blinky1.samd21.elf -target=itsybitsy-m0 examples/blinky1
- tinygo build -o wasm.wasm -target=wasm examples/wasm

2
commands_macos.go

@ -7,5 +7,5 @@ var commands = map[string]string{
"ar": "llvm-ar",
"clang": "clang-8",
"ld.lld": "ld.lld-8",
"wasm-ld": "wasm-ld-8",
"wasm-ld": "wasm-ld",
}

4
main.go

@ -228,7 +228,11 @@ func Compile(pkgName, outpath string, spec *TargetSpec, config *BuildConfig, act
}
// Link the object files together.
if linker, ok := commands[spec.Linker]; ok {
err = Link(sourceDir(), linker, ldflags...)
} else {
err = Link(sourceDir(), spec.Linker, ldflags...)
}
if err != nil {
return &commandError{"failed to link", executable, err}
}

2
targets/wasm.json

@ -4,7 +4,7 @@
"goos": "js",
"goarch": "wasm",
"compiler": "clang-8",
"linker": "wasm-ld-8",
"linker": "wasm-ld",
"cflags": [
"--target=wasm32",
"-Oz"

Loading…
Cancel
Save