293 lines
11 KiB
RPMSpec
293 lines
11 KiB
RPMSpec
# Generated by go2rpm 1
|
|
%bcond_without check
|
|
|
|
%global __brp_strip_lto %{nil}
|
|
%global __brp_strip_static_archive %{nil}
|
|
|
|
# https://github.com/tinygo-org/tinygo
|
|
%global goipath github.com/tinygo-org/tinygo
|
|
Version: 0.15.0
|
|
|
|
%global CMSIS_commit 9fe411cef1cef5de58e5957b89760759de44e393
|
|
%global avr_commit 6624554c02b237b23dc17d53e992bf54033fc228
|
|
%if %{fedora} > 32
|
|
%global clang_version 11
|
|
%else
|
|
%if %{fedora} > 31
|
|
%global clang_version 10
|
|
%else
|
|
%global clang_version 9
|
|
%endif
|
|
%endif
|
|
%global cmsis_svd_commit d9b58694cef35b39ddf61c07ef7e6347d6ec3cbd
|
|
%global compiler_rt_version 9.0.0
|
|
%global nrfx_commit 3ab39a9d457bfe627473ed0e03a7f1161d9e4f27
|
|
%global picolibc_commit 80528c684b10aaee977397e7eb40c4784e6dc433
|
|
%global wasi_libc_commit 215adc8ac9f91eb055311acc72683fd2eb1ae15a
|
|
|
|
# No longer matching regular Go's /usr/share/gocode because it also provides
|
|
# pre-compiled binaries, and symlinks to arch-specific clang headers.
|
|
%global tinygoroot %{_libdir}/tinygo
|
|
|
|
%gometa
|
|
|
|
%global common_description %{expand:
|
|
Go compiler for small places. Microcontrollers, WebAssembly, and command-line
|
|
tools. Based on LLVM.}
|
|
|
|
#global godocs CHANGELOG.md BUILDING.md CONTRIBUTING.md README.md
|
|
#global golicenses LICENSE LICENSE.TXT
|
|
#global gosupfiles lib/CMSIS/CMSIS/Include/*.h lib/compiler-rt/lib/builtins/*/*.S lib/nrfx/mdk/*.{ld,S} src/examples/wasm/*/*.js targets/*.{js,json,ld,S}
|
|
|
|
Name: tinygo
|
|
Release: 1%{?dist}
|
|
Summary: Go compiler for small places
|
|
|
|
# Main files: BSD
|
|
# CMSIS: BSD (subsetted)
|
|
# avr-mcu: ASL 2.0 (packs) and MIT (Rust code, unused by this package)
|
|
# cmsis-svd: ASL 2.0 and BSD and ISC and MIT (subsetted)
|
|
# compiler-rt: NCSA or MIT
|
|
# nrfx: BSD and ASL 2.0
|
|
# picolibc: BSD and ISC and MIT and GPLv2 (testing code only, unused by this package)
|
|
# wasi-libc: BSD and CC0 and ISC and MIT and Public Domain
|
|
License: BSD and ASL 2.0 and CC0 and ISC and MIT and (NCSA or MIT) and Public Domain
|
|
URL: %{gourl}
|
|
Source0: %{gosource}
|
|
Source1: clean_tarballs.sh
|
|
Source2: cmsis-%{CMSIS_commit}-clean.tar.xz
|
|
Source3: https://github.com/avr-rust/avr-mcu/archive/%{avr_commit}/avr-%{avr_commit}.tar.gz
|
|
Source4: cmsis_svd-%{cmsis_svd_commit}-clean.tar.xz
|
|
Source5: https://releases.llvm.org/%{compiler_rt_version}/compiler-rt-%{compiler_rt_version}.src.tar.xz
|
|
Source6: https://github.com/NordicSemiconductor/nrfx/archive/%{nrfx_commit}/nrfx-%{nrfx_commit}.tar.gz
|
|
Source7: https://github.com/keith-packard/picolibc/archive/%{picolibc_commit}/picolibc-%{picolibc_commit}.tar.gz
|
|
Source8: https://github.com/WebAssembly/wasi-libc/archive/%{wasi_libc_commit}/wasi-libc-%{wasi_libc_commit}.tar.gz
|
|
# Fedora-specific.
|
|
Patch0001: 0001-Use-Fedora-command-names.patch
|
|
# We don't have ARM glibc to build these.
|
|
Patch0002: 0002-Skip-ARM-Linux-tests.patch
|
|
# We can't include STM32 .svd files because of their weird license.
|
|
Patch0003: 0003-Skip-STM32-tests.patch
|
|
# https://github.com/tinygo-org/tinygo/pull/1399
|
|
Patch0004: 0004-Also-check-lib64-for-clang-include-path.patch
|
|
# https://github.com/tinygo-org/tinygo/pull/1056
|
|
Patch0005: 0005-main-add-initial-support-for-in-development-LLVM-11.patch
|
|
|
|
# Not supported upstream yet.
|
|
ExcludeArch: armv7hl ppc64le s390x
|
|
|
|
BuildRequires: chromium
|
|
BuildRequires: (clang-devel >= %{clang_version} with clang-devel < %{lua: print(tonumber(rpm.expand('%{clang_version}')) + 1)})
|
|
BuildRequires: golang(github.com/blakesmith/ar)
|
|
BuildRequires: golang(github.com/chromedp/chromedp)
|
|
BuildRequires: golang(github.com/chromedp/cdproto/cdp)
|
|
BuildRequires: golang(github.com/google/shlex)
|
|
BuildRequires: golang(github.com/marcinbor85/gohex)
|
|
BuildRequires: golang(go.bug.st/serial)
|
|
BuildRequires: golang(golang.org/x/tools/go/ast/astutil)
|
|
BuildRequires: golang(golang.org/x/tools/go/ssa)
|
|
BuildRequires: golang(tinygo.org/x/go-llvm)
|
|
|
|
BuildRequires: avr-gcc
|
|
BuildRequires: avr-libc
|
|
# We don't have glibc for arm, so skip these.
|
|
#BuildRequires: gcc-arm-linux-gnu
|
|
#BuildRequires: gcc-aarch64-linux-gnu
|
|
BuildRequires: lld
|
|
BuildRequires: nodejs
|
|
BuildRequires: qemu-system-arm-core
|
|
|
|
Requires: golang
|
|
Requires: lld
|
|
Recommends: avr-gcc
|
|
Recommends: avr-libc
|
|
Recommends: clang
|
|
# Add this when LLVM supports ESP natively.
|
|
# Recommends: esptool
|
|
Recommends: qemu-system-arm-core
|
|
|
|
%description
|
|
%{common_description}
|
|
|
|
#gopkg
|
|
|
|
|
|
%prep
|
|
%goprep
|
|
%patch0001 -p1
|
|
%patch0002 -p1
|
|
%patch0003 -p1
|
|
%patch0004 -p1
|
|
%patch0005 -p1
|
|
|
|
tar -C lib -xf %{SOURCE2}
|
|
rmdir lib/CMSIS
|
|
mv lib/CMSIS-%{CMSIS_commit} lib/CMSIS
|
|
|
|
tar -C lib -xf %{SOURCE3}
|
|
rmdir lib/avr
|
|
mv lib/avr-mcu-%{avr_commit} lib/avr
|
|
|
|
tar -C lib -xf %{SOURCE4}
|
|
rmdir lib/cmsis-svd
|
|
mv lib/cmsis-svd-%{cmsis_svd_commit} lib/cmsis-svd
|
|
|
|
tar -C lib -xf %{SOURCE5}
|
|
rmdir lib/compiler-rt
|
|
mv lib/compiler-rt-%{compiler_rt_version}.src lib/compiler-rt
|
|
|
|
tar -C lib -xf %{SOURCE6}
|
|
rmdir lib/nrfx
|
|
mv lib/nrfx-%{nrfx_commit} lib/nrfx
|
|
rm lib/nrfx/.gitignore
|
|
chmod -x lib/nrfx/doc/generate_html_doc.sh
|
|
|
|
tar -C lib -xf %{SOURCE7}
|
|
rmdir lib/picolibc
|
|
mv lib/picolibc-%{picolibc_commit} lib/picolibc
|
|
|
|
tar -C lib -xf %{SOURCE8}
|
|
rmdir lib/wasi-libc
|
|
mv lib/wasi-libc-%{wasi_libc_commit} lib/wasi-libc
|
|
|
|
|
|
%build
|
|
export LDFLAGS="-X github.com/tinygo-org/tinygo/goenv.TINYGOROOT=%{tinygoroot} "
|
|
%gobuild -o %{gobuilddir}/bin/tinygo %{goipath}
|
|
GO111MODULE=off %make_build gen-device
|
|
for target in armv6m-none-eabi armv7m-none-eabi armv7em-none-eabi; do
|
|
for libc in compiler-rt picolibc; do
|
|
TINYGOROOT=$PWD \
|
|
%{gobuilddir}/bin/tinygo \
|
|
build-library -target=$target -o ${target}-${libc}.a ${libc}
|
|
done
|
|
done
|
|
%make_build wasi-libc CLANG=clang-%{clang_version} LLVM_AR=llvm-ar LLVM_NM=llvm-nm
|
|
|
|
|
|
%install
|
|
#gopkginstall
|
|
install -vdm 0755 %{buildroot}%{_bindir}
|
|
install -vpm 0755 %{gobuilddir}/bin/* %{buildroot}%{_bindir}/
|
|
|
|
install -vdm 0755 %{buildroot}%{tinygoroot}
|
|
install -vdm 0755 %{buildroot}%{tinygoroot}/lib
|
|
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/CMSIS
|
|
install -vpm 0644 lib/CMSIS/README.md %{buildroot}%{tinygoroot}/lib/CMSIS/
|
|
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/CMSIS/CMSIS/Include
|
|
install -vpm 0644 lib/CMSIS/CMSIS/Include/* %{buildroot}%{tinygoroot}/lib/CMSIS/CMSIS/Include/
|
|
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/compiler-rt
|
|
install -vpm 0644 lib/compiler-rt/README.txt %{buildroot}%{tinygoroot}/lib/compiler-rt/
|
|
install -vpm 0644 lib/compiler-rt/LICENSE.TXT %{buildroot}%{tinygoroot}/lib/compiler-rt/
|
|
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/compiler-rt/lib
|
|
cp -rp lib/compiler-rt/lib/builtins %{buildroot}%{tinygoroot}/lib/compiler-rt/lib/
|
|
cp -rp lib/nrfx %{buildroot}%{tinygoroot}/lib/
|
|
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/wasi-libc
|
|
cp -rp lib/wasi-libc/sysroot %{buildroot}%{tinygoroot}/lib/wasi-libc/
|
|
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/picolibc/newlib/libc
|
|
cp -rp lib/picolibc/newlib/libc/ctype %{buildroot}%{tinygoroot}/lib/picolibc/newlib/libc
|
|
cp -rp lib/picolibc/newlib/libc/include %{buildroot}%{tinygoroot}/lib/picolibc/newlib/libc
|
|
cp -rp lib/picolibc/newlib/libc/locale %{buildroot}%{tinygoroot}/lib/picolibc/newlib/libc
|
|
cp -rp lib/picolibc/newlib/libc/string %{buildroot}%{tinygoroot}/lib/picolibc/newlib/libc
|
|
cp -rp lib/picolibc/newlib/libc/tinystdio %{buildroot}%{tinygoroot}/lib/picolibc/newlib/libc
|
|
cp -rp lib/picolibc-include %{buildroot}%{tinygoroot}/lib
|
|
install -vdm 0755 %{buildroot}%{tinygoroot}/pkg
|
|
for target in armv6m-none-eabi armv7m-none-eabi armv7em-none-eabi; do
|
|
for libc in compiler-rt picolibc; do
|
|
install -vdm 0755 %{buildroot}%{tinygoroot}/pkg/${target}
|
|
install -vpm 0644 ${target}-${libc}.a %{buildroot}%{tinygoroot}/pkg/${target}/${libc}.a
|
|
done
|
|
done
|
|
cp -rp src %{buildroot}%{tinygoroot}/
|
|
rm %{buildroot}%{tinygoroot}/src/examples/wasm/.gitignore
|
|
cp -rp targets %{buildroot}%{tinygoroot}/
|
|
|
|
|
|
%if %{with check}
|
|
%check
|
|
export TINYGOROOT=%{buildroot}%{tinygoroot}
|
|
export GOPATH=%{buildroot}%{tinygoroot}:%{gopath}
|
|
export PATH=%{buildroot}%{_bindir}:$PATH
|
|
export GO111MODULE=off
|
|
%gocheck -v -d tests/tinygotest
|
|
make smoketest XTENSA=0
|
|
make wasmtest
|
|
%endif
|
|
|
|
|
|
%files
|
|
%doc README.md CHANGELOG.md CONTRIBUTING.md
|
|
%license LICENSE
|
|
%{_bindir}/tinygo
|
|
%{tinygoroot}
|
|
%doc %{tinygoroot}/lib/CMSIS/README.md
|
|
%license %{tinygoroot}/lib/compiler-rt/LICENSE.TXT
|
|
%doc %{tinygoroot}/lib/compiler-rt/README.txt
|
|
%license %{tinygoroot}/lib/nrfx/LICENSE
|
|
%doc %{tinygoroot}/lib/nrfx/README.md
|
|
|
|
#gopkgfiles
|
|
|
|
|
|
%changelog
|
|
* Sun Sep 20 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.15.0-1
|
|
- Update to latest version (#1866183)
|
|
- Loosen up runtime clang requirement
|
|
|
|
* Sat Aug 22 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.14.1-1
|
|
- Update to latest version (#1866183)
|
|
|
|
* Sun Aug 02 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.13.1-3
|
|
- Patch to allow Go 1.15
|
|
|
|
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.13.1-3
|
|
- Second attempt - Rebuilt for
|
|
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
|
|
|
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.13.1-2
|
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
|
|
|
* Thu Apr 30 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.13.1-1
|
|
- Update to latest version
|
|
|
|
* Mon Apr 20 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.13.0-1
|
|
- Update to latest version
|
|
|
|
* Sun Apr 19 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.12.0-1
|
|
- Update to latest version
|
|
|
|
* Wed Mar 04 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.11.0-3
|
|
- Update required clang version
|
|
|
|
* Tue Feb 11 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.11.0-3
|
|
- Enable RISCV tests
|
|
- Enable AVR tests
|
|
- Add Recommends for AVR dependencies
|
|
|
|
* Mon Feb 10 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.11.0-2
|
|
- Fix setting of TINYGOROOT to point to packaged version
|
|
|
|
* Mon Feb 10 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.11.0-1
|
|
- Update to 0.11.0
|
|
|
|
* Mon Feb 10 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.10.0-1
|
|
- Update to 0.10.0
|
|
|
|
* Mon Feb 10 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.9.0-1
|
|
- Update to 0.9.0
|
|
|
|
* Tue Sep 24 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.8.0-1
|
|
- Update to latest version
|
|
- Enable x86 build
|
|
|
|
* Sun Aug 04 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.7.1-1
|
|
- Update to latest version
|
|
|
|
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0-2
|
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
|
|
|
* Tue Jul 23 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.7.0-1
|
|
- Update to latest version
|
|
|
|
* Tue Jun 11 01:26:10 EDT 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.6.0-1
|
|
- Initial package
|