Skip to content

Commit

Permalink
dev-embedded/arduino-builder: add package
Browse files Browse the repository at this point in the history
This package is needed for the bump to dev-embedded/arduino to 1.8.5.

Mostly based on maurerpe's fine work at
https://github.com/maurerpe/arduino-overlay/tree/master/dev-embedded/arduino-builder
but with a "vendor" approach to golang dependencies.

Bug: https://bugs.gentoo.org/525882
Package-Manager: Portage-2.3.19, Repoman-2.3.6
  • Loading branch information
Virgil Dupras authored and Amynka committed Mar 6, 2018
1 parent bfad65b commit 6f7c885
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dev-embedded/arduino-builder/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DIST arduino-builder-1.3.25.tar.gz 206905 BLAKE2B 6770b89607c1563b68a79d34e6e214586106c63a4b3c854b4f85a4b9eb2fc24ce5d4a97c29b0c05c19b6834e103f3c3c574bd8cefed0eb684d8aab7e4c71ee7f SHA512 3740530800f8a3cfe1fe20a91579e6b632b76c2c4ace68c7b178a2d234032d5887abee3d0360c3039f2fec912a0d5cabe948bf930a7d9ea23221625456ad5357
DIST github.com-go-errors-errors-a41850380601eeb43f4350f7d17c6bbd8944aaf8.tar.gz 7835 BLAKE2B f4092b4ef5ebf996cb3c20183868dbdd154ea7cf02a4fd5a3375a3193e9ccacad08f0b6681b456786524b729ffb8c0b5c8af6ceec630eec22326d0fe1e00eb22 SHA512 b1d5e7c6f30f94f8a41b10d32b7f4ce7de8394f74ede6c14fb1f267a0514b24bc3bc7659c3baf6eacf424cea8451e7e57f5f72acc568342e90a447bd02f3e262
DIST github.com-jstemmer-go-junit-report-833f8ea2b99d36d5f018698333834f3df200a0c2.tar.gz 6901 BLAKE2B 6138ac40810ad000a4336ffbca3bc5c1d0e96854c7918fb2aad9f7b2596ac66f285ac8c519e30b6e97cdb0009b31ab73b83ff2e1db2f464c2d88f2c1045a6bd9 SHA512 00f38f51c5f761b5a3e60a6e6b602f1246a746f081f2d8946d01387234270544692c6af54d0e69919c1af8aa753f848eeecc4421f2ddf881f21522ccf5545d75
DIST github.com-stretchr-testify-1661650f989674e3e5bcdcb805536e5d31481526.tar.gz 81099 BLAKE2B 592a7c114b01bc5b1982135f310aa8619c2888ac36ccb5d876a38655a13f7dc4d468a7a42a44cf9cf69fc7bd6769a9ba010b48089d5ce866dcd564e20487e04a SHA512 f10255b0f47237c7583626a3bb213ca67d0db92c2a1531cc31dac089cdb13139b01647809503313a26f3e53a64a98cebc3bf9c4e1bd1ed975d9b81aa516ab5af
79 changes: 79 additions & 0 deletions dev-embedded/arduino-builder/arduino-builder-1.3.25.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

EGO_PN="arduino.cc/arduino-builder/..."

EGO_VENDOR=(
"github.com/go-errors/errors a41850380601eeb43f4350f7d17c6bbd8944aaf8"
"github.com/jstemmer/go-junit-report 833f8ea2b99d36d5f018698333834f3df200a0c2"
"github.com/stretchr/testify 1661650f989674e3e5bcdcb805536e5d31481526"
)

inherit golang-build golang-vcs-snapshot

DESCRIPTION="A command line tool for compiling Arduino sketches"
HOMEPAGE="https://github.com/arduino/arduino-builder"
SRC_URI="https://github.com/arduino/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz
${EGO_VENDOR_URI}"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"

RDEPEND="sys-devel/crossdev
dev-embedded/avrdude
dev-embedded/arduino-ctags"

DEPEND=">=dev-lang/go-1.9.2"

src_unpack() {
golang-vcs-snapshot_src_unpack
}

src_prepare() {
# As we know, golang packages have to be compiled from namespace-aware paths which is the whole
# point of the EGO_PN dance. arduino-builder goes a step further by re-creating its own
# namespace inside its source package, messing up with our build process which can't find
# packages. Also, our source package contains multiple namespaces which further messes with
# messes with our vendoring process (each namespace needs its own vendor directory).
# We do the following to try to work around this mess. It looks like upstream reworked this
# in its master branch so we should be able to remove this in the upcoming major release.

local deeppath="${S}/src/${EGO_PN%/...}"
for pkgname in builder properties timeutils; do
ln -s "${deeppath}/src/arduino.cc/${pkgname}" "${S}/src/arduino.cc/${pkgname}"
done
ln -s "${deeppath}/vendor/github.com" "${S}/src/github.com"

# path paths so that they point to system ctags and avrdude
eapply "${FILESDIR}/arduino-builder-1.3.25-platform-paths.patch"

default
}

src_install() {
# we unfortunately have to copy/paste the contents of golang-build_src_install() here because
# we *don't* want to call golang_install_pkgs() which installs all static libraries we've
# built. All we want is to install the final executable.

set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \
go install -v -work -x ${EGO_BUILD_FLAGS} "${EGO_PN}"
echo "$@"
"$@" || die

# END OF COPY/PASTE

dobin bin/arduino-builder

# In addition to the binary, we also want to install these two files below. They are needed by
# the dev-embedded/arduino which copies those files in its "hardware" folder.
insinto "/usr/share/${PN}"
cd "src/arduino.cc/builder/hardware" || die
doins "platform.txt"
doins "platform.keys.rewrite.txt"
}

pkg_postinst() {
[ ! -x /usr/bin/avr-gcc ] && ewarn "Missing avr-gcc; you need to crossdev -s4 avr"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/src/arduino.cc/builder/hardware/platform.txt b/src/arduino.cc/builder/hardware/platform.txt
index ca8df1f..17ce03f 100644
--- a/src/arduino.cc/arduino-builder/src/arduino.cc/builder/hardware/platform.txt
+++ b/src/arduino.cc/arduino-builder/src/arduino.cc/builder/hardware/platform.txt
@@ -1,11 +1,11 @@
# ctags
# ------------------------------
-tools.ctags.path={runtime.tools.ctags.path}
-tools.ctags.cmd.path={path}/ctags
+tools.ctags.path=/usr/bin
+tools.ctags.cmd.path={path}/arduino-ctags
tools.ctags.pattern="{cmd.path}" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "{source_file}"

# additional entries
-tools.avrdude.path={runtime.tools.avrdude.path}
+tools.avrdude.path=/usr/bin

preproc.macros.flags=-w -x c++ -E -CC
#preproc.macros.compatibility_flags={build.mbed_api_include} {build.nRF51822_api_include} {build.ble_api_include} {compiler.libsam.c.flags} {compiler.arm.cmsis.path} {build.variant_system_include}
11 changes: 11 additions & 0 deletions dev-embedded/arduino-builder/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>[email protected]</email>
<name>Embedded Gentoo</name>
</maintainer>
<upstream>
<remote-id type="github">arduino/arduino-builder</remote-id>
</upstream>
</pkgmetadata>

0 comments on commit 6f7c885

Please sign in to comment.