tinygo/Magefile.go
Softonik d49a11e583
Некоторые проверки провалились
macOS / build-macos (amd64, macos-12) (push) Has been cancelled
macOS / build-macos (arm64, macos-14) (push) Has been cancelled
macOS / homebrew-install (16) (push) Has been cancelled
macOS / homebrew-install (17) (push) Has been cancelled
Docker / build-push-dev (push) Has been cancelled
Linux / build-linux (push) Has been cancelled
Linux / assert-test-linux (push) Has been cancelled
Nix / nix-test (push) Has been cancelled
Windows / build-windows (push) Has been cancelled
Linux / test-linux-build (push) Has been cancelled
Linux / build-linux-cross (arm, armhf, arm-linux-gnueabihf) (push) Has been cancelled
Linux / build-linux-cross (arm64, arm64, aarch64-linux-gnu) (push) Has been cancelled
Windows / smoke-test-windows (push) Has been cancelled
Windows / stdlib-test-windows (push) Has been cancelled
Windows / stdlib-wasi-test-windows (push) Has been cancelled
Magefile поправлен
2024-06-29 01:14:35 +03:00

130 строки
2,3 КиБ
Go

//go:build mage
package main
import (
// mage:import
. "magefile/docker"
)
var (
GolangVolume = "golang.my"
tests_to_run = []string{}
)
func init() {
AppName = "tinygo"
ImageName = "my/qtbase.dev"
LoadContainerConfig()
BuildFn = build
}
func Test() {
}
func build() error {
BuildAllWithSync()
return nil
}
func BuildAllWithSync() {
GitSubmoduleUpdateInit()
BuildLLVM()
Make()
LLVMSource()
GenDevice()
}
func GitSubmoduleUpdateInit() error {
return Bash(`todirect git submodule update --init --recursive`)
}
func BuildLLVM() error {
return Bash(`todirect make llvm-source \
&& make llvm-build`)
}
func Make() {
LLVMBuildImageName := "my/qtbase.dev"
Bash(`sudo docker run --rm \
-h host \
--net=bridge \
-v /etc/localtime:/etc/localtime:ro \
-v ` + GolangVolume + `:/usr/local/go:ro \
-e PATH=$PATH:/usr/local/go/bin \
\
-v /gopath:/gopath:rw \
-e GOPATH=/gopath \
-e GOCACHE=/gopath/gocache \
` + DockerProxyOptions + ` \
\
-v ${PWD}:/app \
\
-w /app \
-u 1000 \
\
--entrypoint=/bin/bash \
\
` + LLVMBuildImageName + " -c '" + ` \
make \
'`)
}
func BuildLLVMInDocker() {
LLVMBuildImageName := "my/qtbase.dev"
Bash(`sudo docker run --rm \
-h host \
--net=none \
-v /etc/localtime:/etc/localtime:ro \
-v ` + GolangVolume + `:/usr/local/go:ro \
-e PATH=$PATH:/usr/local/go/bin \
\
-v /gopath:/gopath:rw \
-e GOPATH=/gopath \
-e GOCACHE=/gopath/gocache \
\
-v ${PWD}:/app \
\
-w /app \
-u 1000 \
\
--entrypoint=/bin/bash \
\
` + LLVMBuildImageName + " -c '" + ` \
make llvm-build
'`)
}
func Tinygo() {
LLVMBuildImageName := "my/qtbase.dev"
Bash(`sudo docker run --rm \
-h host \
--net=bridge \
-v /etc/localtime:/etc/localtime:ro \
-v ` + GolangVolume + `:/usr/local/go:ro \
-e PATH=$PATH:/usr/local/go/bin \
\
-v /gopath:/gopath:rw \
-e GOPATH=/gopath \
-e GOCACHE=/gopath/gocache \
` + DockerProxyOptions + ` \
\
-v ${PWD}:/app \
\
-w /app \
-u 1000 \
\
--entrypoint=/app/build/tinygo \
\
` + LLVMBuildImageName + " " + ` \
targets \
`)
}
func LLVMSource() error {
return Bash(`make llvm-source`)
}
func GenDevice() {
Bash(`:\
&& cd lib/cmsis-svd && git checkout && cd - \
&& cd lib/stm32-svd && git checkout && cd - \
&& make gen-device \
`)
}