#!/bin/bash # # arduino-ide.SlackBuild is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or any later version. # # arduino-ide.SlackBuild is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place - Suite 330, Boston, MA 02111-1307, USA # # Rewritten for mbse Slackbuilds bij mbroek. # The Java part of the Arduino IDE licensed under GPL. # The C/C++ microcontroller library files are licensed under LGPL. # default settings PACKAGE="arduino-ide" PACKAGE_EXT="zip" VERSION=${VERSION:=2.0.4} BUILD=${BUILD:=1} if [ -f ~/.slackbuildrc ]; then . ~/.slackbuildrc elif [ -f ../../runtime/slackbuildrc ]; then . ../../runtime/slackbuildrc fi check_required SRC="arduino-ide_${VERSION}_Linux_64bit.$PACKAGE_EXT" URL="https://github.com/arduino/arduino-ide/releases/download/$VERSION/$SRC" get_source $SRC $URL unpack_source $SRC arduino-ide_${VERSION}_Linux_64bit SYSTEMFOLDER=${SYSTEMFOLDER:-/opt/$PACKAGE} # Add a wrapper to run the arduino ide from /usr/bin # Its going to change the working directory to $HOME, so when you import/export # into/from the ide $HOME is going to be the default directory, rather than # /usr/lib*/arduino/ mkdir -p $PKG/usr/bin cd $PKG/usr/bin ln -s $SYSTEMFOLDER/arduino-ide arduino-ide cd - #cat << EOF > $PKG/usr/bin/$PACKAGE ##!/bin/sh #if [ -n \${CPLUS_INCLUDE_PATH} ]; then # unset CPLUS_INCLUDE_PATH #fi #cd \$HOME #if [ \$(echo \$PATH | grep java | wc -l) -lt 1 ]; then # export PATH=\$PATH:/usr/lib$LIBDIRSUFFIX/java/bin:/usr/lib$LIBDIRSUFFIX/java/jre/bin:/usr/lib$LIBDIRSUFFIX/java/bin; #fi; #$SYSTEMFOLDER/arduino-ide #EOF #chmod 0755 $PKG/usr/bin/$PACKAGE mkdir -p $PKG/$SYSTEMFOLDER cp -a * $PKG/$SYSTEMFOLDER/ # UDEV rules install -D -m 644 $CWD/99-arduino.rules $PKG/lib/udev/rules.d/99-arduino.rules # Desktop entries install -D -m 644 $CWD/arduino-ide.desktop $PKG/usr/share/applications/arduino-ide.desktop install -D -m 644 $CWD/arduino-ide.png $PKG/usr/share/pixmaps/arduino-ide.png mkdir -p $DOCS cp -a *.txt $DOCS # Create package without using the fixup_package function because that will # strip (and corrupt) the avr libraries. cd $PKG find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true mkdir -p $PKG/install cat $CWD/doinst.sh > $PKG/install/doinst.sh cat $CWD/slack-desc > $PKG/install/slack-desc makepkg -p -l y -c n $TMP/$PACKAGE-$PVERSION-$ARCH-$BUILD$TAG.txz tail -n 11 $PKG/install/slack-desc > $TMP/$PACKAGE-$PVERSION-$ARCH-$BUILD$TAG.txt md5sum $TMP/$PACKAGE-$PVERSION-$ARCH-$BUILD$TAG.txz > $TMP/$PACKAGE-$PVERSION-$ARCH-$BUILD$TAG.txz.md5 # Clean up the extra stuff: set +u if [ "$1" = "--cleanup" ]; then rm -rf $TMP/$PACKAGE-$VERSION rm -rf $PKG fi