archrelease: copy trunk to community-x86_64
[ArchLinux/community.git] / tinygo / repos / community-x86_64 / PKGBUILD
blob66f6d081cd507c985e4cfcf89512dc5525728594
1 # Maintainer: Anatol Pomozov <anatol.pomozov@gmail.com>
3 pkgname=tinygo
4 pkgver=0.27.0
5 pkgrel=1
6 pkgdesc='Go compiler for small places. Microcontrollers, WebAssembly, and command-line tools. Based on LLVM.'
7 arch=(x86_64)
8 url='https://github.com/tinygo-org/tinygo'
9 license=(BSD)
10 options=(!strip !lto)
11 # TODO: re-add these deps when switching back to system LLVM
12 #depends=(llvm-libs clang lld)
13 # TODO: add llvm + remove cmake/ninja/python from build deps
14 makedepends=(go git cmake ninja python)
15 # use git as we need to fetch submodules
16 source=(git+https://github.com/tinygo-org/tinygo#tag=v$pkgver
17         git+https://github.com/NordicSemiconductor/nrfx.git
18         git+https://github.com/ARM-software/CMSIS.git
19         git+https://github.com/avr-rust/avr-mcu.git
20         git+https://github.com/tinygo-org/cmsis-svd
21         git+https://github.com/CraneStation/wasi-libc
22         git+https://github.com/keith-packard/picolibc.git
23         git+https://github.com/tinygo-org/stm32-svd
24         git://git.musl-libc.org/musl
25         git+https://github.com/WebAssembly/binaryen.git
26         git+https://github.com/mingw-w64/mingw-w64.git
27         git+https://github.com/aykevl/macos-minimal-sdk.git
28         git+https://github.com/espressif/llvm-project#branch=xtensa_release_15.x
29         llvm_build_j1.patch)
30 sha256sums=('SKIP'
31             'SKIP'
32             'SKIP'
33             'SKIP'
34             'SKIP'
35             'SKIP'
36             'SKIP'
37             'SKIP'
38             'SKIP'
39             'SKIP'
40             'SKIP'
41             'SKIP'
42             'SKIP'
43             'a5352a32ed89120af415825fa5b73a0e7bb907fa6efaa63529ad721a53cf4844')
45 prepare() {
46   cd tinygo
48   git submodule init
49   git config -f .gitmodules 'submodule.lib/nrfx.url' "$srcdir/nrfx"
50   git config -f .gitmodules 'submodule.lib/CMSIS.url' "$srcdir/CMSIS"
51   git config -f .gitmodules 'submodule.lib/avr.url' "$srcdir/avr-mcu"
52   git config -f .gitmodules 'submodule.lib/cmsis-svd.url' "$srcdir/cmsis-svd"
53   git config -f .gitmodules 'submodule.lib/wasi-libc.url' "$srcdir/wasi-libc"
54   git config -f .gitmodules 'submodule.lib/picolibc.url' "$srcdir/picolibc"
55   git config -f .gitmodules 'submodule.lib/stm32-svd.url' "$srcdir/stm32-svd"
56   git config -f .gitmodules 'submodule.lib/musl.url' "$srcdir/musl"
57   git config -f .gitmodules 'submodule.lib/binaryen.url' "$srcdir/binaryen"
58   git config -f .gitmodules 'submodule.lib/mingw-w64.url' "$srcdir/mingw-w64"
59   git config -f .gitmodules 'submodule.lib/macos-minimal-sdk.url' "$srcdir/macos-minimal-sdk"
61   git submodule sync
62   # 'protocol.file.allow=always' is a workaround for https://vielmetti.typepad.com/logbook/2022/10/git-security-fixes-lead-to-fatal-transport-file-not-allowed-error-in-ci-systems-cve-2022-39253.html
63   git -c protocol.file.allow=always submodule update
65   ln -sf ../llvm-project
67   patch -p1 < ../llvm_build_j1.patch
70 build() {
71   cd tinygo
72   make llvm-build
73   make build/release
76 check() {
77   cd tinygo
78   # it reqreires a lot of dependencies. todo enable the tests
79   # make test tinygo-test smoketest
82 package() {
83   cd tinygo
85   install -d "$pkgdir"/usr/bin "$pkgdir"/usr/lib/tinygo
86   mv build/release/tinygo/* "$pkgdir"/usr/lib/tinygo
87   ln -s /usr/lib/tinygo/bin/tinygo "$pkgdir"/usr/bin/tinygo