Package arduino-builder: Specfile

Group: Other
# BEGIN SourceDeps(oneline):
BuildRequires(pre): rpm-macros-golang
BuildRequires: gcc-c++ rpm-build-golang
# END SourceDeps(oneline)
# see
%define _localstatedir %{_var}
Name:           arduino-builder
Version:        1.3.25
Release:        alt3_4
Summary:        A command line tool for compiling Arduino sketches
License:        GPLv2+
Patch1:         fix-paths-to-ctags-avrdude.patch
#Patch2:         make-tools-flag-optional.patch

Requires:       arduino-ctags

BuildRequires:  gcc-common
BuildRequires:  golang >= 1.4.3
BuildRequires:  git

#ExcludeArch: aarch64

# BuildRequires:  golang(

# Needed for unit tests
# BuildRequires:  golang(
# These are not available, check will not be enabled
#BuildRequires:  golang(
#BuildRequires:  golang(
#BuildRequires:  golang(

This tool is able to parse Arduino Hardware specifications, properly run
gcc and produce compiled sketches.
An Arduino sketch differs from a standard C program in that it misses a
main (provided by the Arduino core), function prototypes are not mandatory,
and libraries inclusion is automagic (you just have to #include them).
This tool generates function prototypes and gathers library paths,
providing gcc with all the needed -I params.

%setup -q
%patch1 -p1
# %%patch2 -p1

# set up temporary build gopath, and put our directory there
mkdir -p ./_build
ln -s $(pwd)/src ./_build/

export GOPATH="$(pwd)/_build:%{go_path}:$(pwd)/vendor"
export GO111MODULE=off
# export GOFLAGS="-mod=vendor"

# Fix missing build-id
function gobuild { go build -a -ldflags "-B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" -v -x "$@"; }
pushd src/

install -d %{buildroot}%{_bindir}
install -p -m 0755 ./src/ %{buildroot}%{_bindir}/arduino-builder

install -d %{buildroot}%{_datadir}/arduino/hardware
install -p src/*.txt %{buildroot}%{_datadir}/arduino/hardware

# Check needs libraries that are not available
#export GOPATH=$(pwd)/_build:%%{go_path}
#go test -v ./src/

%doc LICENSE.txt

* Thu May 21 2020 Alexey Shabalin <> 1.3.25-alt3_4
- fixed build

* Fri Jul 19 2019 Igor Vlasenko <> 1.3.25-alt2_4
- aarch64 build

* Thu Mar 14 2019 Mikhail Gordeev <> 1.3.25-alt2_1
- Use vendorized BuildRequires
- Add ExcludeArch aarch64

* Fri Nov 24 2017 Igor Vlasenko <> 1.3.25-alt1_1
- new version