# We need to load system astyle/listserialportsc instead of bundled ones.
"${FILESDIR}/${PN}-1.8.5-lib-loading.patch"
)
src_unpack(){
# We don't want to unpack tools, just move zip files into the work dir
locala=(${A})
unpack "${a[0]}"
cp "${DISTDIR}/${PN}-avr-${AVR_VERSION}.tar.bz2""${S}/build/avr-${AVR_VERSION}.tar.bz2"|| die
cp "${DISTDIR}/${PN}-examples-${EXAMPLES_VERSION}.zip""${S}/build/"|| die
cp "${DISTDIR}/${PN}-WiFi101-Updater-ArduinoIDE-Plugin-${PLUGIN_VERSION}.zip""${S}/build/shared/WiFi101-Updater-ArduinoIDE-Plugin-${PLUGIN_VERSION}.zip"|| die
}
src_prepare(){
default
# Unbundle libastyle
sed -i 's/\(target name="linux-libastyle-[a-zA-Z0-9]*"\)/\1 if="never"/g'"$S/build/build.xml"|| die
# Unbundle avr toolchain
sed -i 's/target name="avr-toolchain-bundle" unless="light_bundle"/target name="avr-toolchain-bundle" if="never"/'"$S/build/build.xml"|| die
# Install avr hardware
sed -i 's/target name="assemble-hardware" unless="light_bundle"/target name="assemble-hardware"/'"$S/build/build.xml"|| die
}
src_install(){
cd"${S}"/build/linux/work || die
# We need to replace relative paths for toolchain executable by paths to system ones.
sed -i -e 's@^compiler.path=.*@compiler.path=/usr/bin/@' -e 's@^tools.avrdude.path=.*@tools.avrdude.path=/usr@'\
-e 's@^tools.avrdude.config.path=.*@tools.avrdude.config.path=/etc/avrdude.conf@' hardware/arduino/avr/platform.txt || die