198 lines
6.7 KiB
RPMSpec
198 lines
6.7 KiB
RPMSpec
# Generated by go2rpm 1
|
|
%bcond_without check
|
|
|
|
%global __brp_strip_static_archive %{nil}
|
|
|
|
# https://github.com/tinygo-org/tinygo
|
|
%global goipath github.com/tinygo-org/tinygo
|
|
Version: 0.9.0
|
|
|
|
%global CMSIS_commit 9fe411cef1cef5de58e5957b89760759de44e393
|
|
%global avr_commit 6624554c02b237b23dc17d53e992bf54033fc228
|
|
%global clang_version 8.0.0
|
|
%global cmsis_svd_commit 7d9b4167010feed9e59ac45e56519180295b3813
|
|
%global compiler_rt_version 8.0.0
|
|
%global nrfx_commit 3ab39a9d457bfe627473ed0e03a7f1161d9e4f27
|
|
|
|
# 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.}
|
|
|
|
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 (subsetted)
|
|
# compiler-rt: NCSA or MIT
|
|
# nrfx: BSD and ASL 2.0
|
|
License: BSD and MIT and (NCSA or MIT) and ASL 2.0
|
|
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
|
|
# 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
|
|
# Fix import path.
|
|
Patch0004: 0004-Use-go-mod-expected-path-for-go.bug.st-serial.patch
|
|
|
|
# Not supported upstream yet.
|
|
ExcludeArch: armv7hl ppc64le s390x
|
|
|
|
BuildRequires: clang-devel = %{clang_version}
|
|
BuildRequires: golang(github.com/blakesmith/ar)
|
|
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)
|
|
|
|
# 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: clang-libs%{?isa} = %{clang_version}
|
|
Requires: golang
|
|
Requires: lld
|
|
Recommends: clang
|
|
Recommends: qemu-system-arm-core
|
|
|
|
%description
|
|
%{common_description}
|
|
|
|
|
|
%prep
|
|
%forgesetup
|
|
%patch0001 -p1
|
|
%patch0002 -p1
|
|
%patch0003 -p1
|
|
%patch0004 -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
|
|
|
|
mkdir lib/clang
|
|
ln -s %{_libdir}/clang/%{clang_version}/include lib/clang/include
|
|
|
|
|
|
%build
|
|
export LDFLAGS="-X github.com/tinygo-org/tinygo/goenv.TINYGOROOT=%{tinygoroot} "
|
|
%gobuildroot
|
|
%gobuild -o _bin/tinygo %{goipath}
|
|
GO111MODULE=off %make_build gen-device PYTHON=%{__python3}
|
|
for target in armv6m-none-eabi armv7m-none-eabi armv7em-none-eabi; do
|
|
TINYGOROOT=$PWD \
|
|
_bin/tinygo \
|
|
build-builtins -target=$target -o ${target}-compiler-rt.a
|
|
done
|
|
|
|
|
|
%install
|
|
install -vdm 0755 %{buildroot}%{_bindir}
|
|
install -vpm 0755 _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/clang
|
|
cp -pP lib/clang/include %{buildroot}%{tinygoroot}/lib/clang/
|
|
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}/pkg
|
|
for target in armv6m-none-eabi armv7m-none-eabi armv7em-none-eabi; do
|
|
install -vdm 0755 %{buildroot}%{tinygoroot}/pkg/${target}
|
|
install -vpm 0644 ${target}-compiler-rt.a %{buildroot}%{tinygoroot}/pkg/${target}/compiler-rt.a
|
|
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}
|
|
# Fedora LLVM doesn't support AVR yet, so don't run full suite.
|
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1718492
|
|
PATH=%{buildroot}%{_bindir}:$PATH make smoketest AVR=0 RISCV=0
|
|
%gochecks -d tests/tinygotest
|
|
%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
|
|
|
|
|
|
|
|
%changelog
|
|
* Mon Feb 10 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.9.0-1
|
|
- Update to latest version
|
|
|
|
* 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
|