void-packages/srcpkgs/arduino/template

67 lines
2.2 KiB
Bash

# Template file for 'arduino'
pkgname=arduino
version=1.8.19
revision=2
archs="x86_64* i686* aarch64* arm*"
create_wrksrc=yes
build_wrksrc=Arduino-$version
hostmakedepends="apache-ant unzip ImageMagick openjdk8 tar"
depends="virtual?java-runtime avr-binutils avr-gcc avr-libc avrdude"
short_desc="IDE for the arduino open-source electronics prototyping platform"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="GPL-2.0-or-later, LGPL-2.0-or-later"
homepage="http://arduino.cc/"
distfiles="
https://github.com/arduino/Arduino/archive/${version}.tar.gz
${SOURCEFORGE_SITE}/astyle/astyle_3.0.1_linux.tar.gz"
checksum="17839eb2a9bc7aeed3bb2a315898efdb3075ed605f98210b4a2d3b54199cc571
6c3ab029e0e4a75e2e603d449014374aa8269218fdd03a4aaa46ab743b1912fd"
nostrip=yes
nocross="cross build lacks essential libraries"
patch_args=-Np0
if [ "$XBPS_TARGET_LIBC" = musl ]; then
broken="downloads multiple binaries linked to glibc; segfaults with gcompat"
fi
do_build() {
. /etc/profile.d/apache-ant.sh
. /etc/profile.d/openjdk.sh
export CFLAGS+=" -I${XBPS_CROSS_BASE}/usr/lib/jvm/java-1.8-openjdk/include/linux"
export CFLAGS+=" -I${XBPS_CROSS_BASE}/usr/lib/jvm/java-1.8-openjdk/include"
mkdir -p build/linux/work/lib
cd ../astyle/build/gcc
make ${makejobs} java
cp bin/libastylej.so.3.0.1 \
../../../Arduino-$version/build/linux/work/lib/libastylej.so
cd ../../../Arduino-$version/build
case "$XBPS_TARGET_MACHINE" in
i686*) LINUX_BUILD=linux32-build ;;
x86_64*) LINUX_BUILD=linux64-build ;;
*) LINUX_BUILD=linux-build ;;
esac
ant -Dversion=${version} $LINUX_BUILD
sed -i -e "s#{runtime\.tools\.[^.]*\.path}#/usr#g" \
-e "s#\(tools\.avrdude\.config\.path=\).*#\1/etc/avrdude.conf#" \
linux/work/hardware/arduino/avr/platform.txt
convert linux/work/lib/arduino_icon.ico icon.png
}
do_install() {
vmkdir usr/lib
vmkdir usr/bin
vcopy build/linux/work usr/lib/arduino
ln -sf /usr/lib/arduino/arduino ${DESTDIR}/usr/bin/arduino
for i in build/icon*.png; do
size=$(identify $i | cut -d' ' -f 3)
case $size in
16x16|32x32|48x48|256x256)
vinstall $i 644 usr/share/icons/hicolor/${size}/apps arduino.png
;;
esac
done
vinstall ${FILESDIR}/arduino.desktop 644 usr/share/applications
}