You are not logged in.

#1 2019-06-02 16:24:32

mass_t
Member
Registered: 2015-04-21
Posts: 12

[Request] tinygo

Go compiler for small places. Microcontrollers, WebAssembly, and command-line tools. Based on LLVM.

Source https://github.com/tinygo-org/tinygo

Offline

#2 2019-06-04 19:42:13

loqs
Member
Registered: 2014-03-06
Posts: 7,865

Re: [Request] tinygo

Have you tried creating a PKGBUILD based upon Go_package_guidelines#PKGBUILD_with_GOPATH_and_dep?
Edit:
This only package the tinygo bin I was not sure what else should be included.

#github.com/blakesmith/ar (download)
#github.com/marcinbor85/gohex (download)
#Fetching https://golang.org/x/tools/go/ast/astutil?go-get=1
#Parsing meta tags from https://golang.org/x/tools/go/ast/astutil?go-get=1 (status code 200)
#get "golang.org/x/tools/go/ast/astutil": found meta tag get.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/go/ast/astutil?go-get=1
#get "golang.org/x/tools/go/ast/astutil": verifying non-authoritative meta tag
#Fetching https://golang.org/x/tools?go-get=1
#Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200)
#golang.org/x/tools (download)
#Fetching https://golang.org/x/tools/go/ssa?go-get=1
#Parsing meta tags from https://golang.org/x/tools/go/ssa?go-get=1 (status code 200)
#get "golang.org/x/tools/go/ssa": found meta tag get.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools/go/ssa?go-get=1
#get "golang.org/x/tools/go/ssa": verifying non-authoritative meta tag
#Fetching https://tinygo.org/x/go-llvm?go-get=1
#Parsing meta tags from https://tinygo.org/x/go-llvm?go-get=1 (status code 200)
#get "tinygo.org/x/go-llvm": found meta tag get.metaImport{Prefix:"tinygo.org/x/go-llvm", VCS:"git", RepoRoot:"https://github.com/tinygo-org/go-llvm"} at https://tinygo.org/x/go-llvm?go-get=1
#tinygo.org/x/go-llvm (download)

pkgname=tinygo
pkgver=0.6.0
pkgrel=1
pkgdesc='A project to bring the Go programming language to microcontrollers and modern web browsers by creating a new compiler based on LLVM.'
arch=('x86_64')
url='https://tinygo.org/'
license=('custom')
makedepends=('go-pie' 'git' 'lld' 'llvm')
depends=('clang')
_modules=("git+https://github.com/tinygo-org/tinygo.git#commit=da857108947aa35ff6e6b5ce16c96359e72fe47c"
          "git+https://github.com/blakesmith/ar.git#commit=8bd4349a67f2533b078dbc524689d15dba0f4659"
          "git+https://github.com/marcinbor85/gohex.git#commit=7a43cd876e46e0f6ddc553f10f91731a78e6e949"
          "git+https://go.googlesource.com/tools.git#commit=8dcc6e70cdefe9a82236b6e195e4f4e2108fcb9f"
          "git+https://github.com/tinygo-org/go-llvm.git#commit=7707ae5d1261a8929edea7336c8087ca8b520d8d")
_prefixes=("" "" "" "golang.org/x" "tinygo.org/x")

_submodules=("git+https://github.com/ARM-software/CMSIS.git"
             "git+https://github.com/avr-rust/avr-mcu.git"
             "git+https://github.com/posborne/cmsis-svd"
             "git+https://github.com/llvm-mirror/compiler-rt.git"
             "git+https://github.com/NordicSemiconductor/nrfx.git")

source=("${_modules[@]}" "${_submodules[@]}")
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP')

_prepmodules() {
  for ((i=0;i<${#_modules[@]};i++))
  do
    m=${_modules[i]}
    p=${_prefixes[i]}
    n=${m##*/}
    if [ -z $p ]
    then
      p=${m##git+https://}
      p="gopath/src/${p%$n}"
    else
      p="gopath/src/${p}"
    fi
    n=${n%.git*}
    mkdir -p "$p"
    ln -rTsf "$n" "$p/$n" 
  done
}

prepare(){
  _prepmodules
  export GOPATH="$srcdir"/gopath
  cd gopath/src/github.com/tinygo-org/tinygo
  git submodule init
  git config submodule.lib/CMSIS.url "$srcdir"/CMSIS
  git config submodule.lib/avr.url "$srcdir"/avr-mcu
  git config submodule.lib/cmsis-svd.url "$srcdir"/cmsis-svd
  git config submodule.lib/compiler-rt.url "$srcdir"/compiler-rt
  git config submodule.lib/nrfx.url "$srcdir"/nrfx
  git submodule update
}

build() {
  export GOPATH="$srcdir"/gopath
  cd gopath/src/github.com/tinygo-org/tinygo
  go install -gcflags "all=-trimpath=$GOPATH" \
             -asmflags "all=-trimpath=$GOPATH" \
             -ldflags "-extldflags ${LDFLAGS}"
}

package() {
  install -Dm755 gopath/bin/$pkgname "$pkgdir/usr/bin/$pkgname"
  install -dm755 "$pkgdir/usr/share/licenses/$pkgname"
  install -Dm644 $pkgname/LICENSE "$pkgdir/usr/share/licenses/$pkgname"
}

Last edited by loqs (2019-06-13 22:41:16)

Offline

Board footer

Powered by FluxBB