#!/bin/bash # # arduino.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.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 # # Written by Diogo Leal(estranho) untill 0019. # Rewritten from scratch by Vliegendehuiskat since 0022. # 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" PACKAGE_EXT="xz" VERSION=${VERSION:=1.8.2} BUILD=${BUILD:=1} if [ -f ~/.slackbuildrc ]; then . ~/.slackbuildrc elif [ -f ../../runtime/slackbuildrc ]; then . ../../runtime/slackbuildrc fi check_required if [ "x$LIBDIRSUFFIX" == "x64" ]; then SRC="$PACKAGE-${VERSION}-linux64.tar.$PACKAGE_EXT" else SRC="$PACKAGE-${VERSION}-linux32.tar.$PACKAGE_EXT" fi # Versions upto 1.6.n URL="http://downloads.arduino.cc/$SRC" # Versions from 1.7.0 and up #URL="http://download.arduino.org/IDE/$VERSION/$SRC" get_source $SRC $URL if [ "x$LIBDIRSUFFIX" == "x64" ]; then unpack_source $SRC $PACKAGE-$VERSION else unpack_source $SRC $PACKAGE-$VERSION fi 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 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 EOF chmod 0755 $PKG/usr/bin/$PACKAGE mkdir -p $PKG/$SYSTEMFOLDER cp -a * $PKG/$SYSTEMFOLDER/ # Now a dirty hack to supply missing libraries for avrdude cd $PKG/$SYSTEMFOLDER/hardware/tools/avr/lib ln -s /usr/lib$LIBDIRSUFFIX/libreadline.so.5 libreadline.so.6 ln -s /usr/lib$LIBDIRSUFFIX/libncurses.so.5 libtinfo.so.5 cd - # 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.desktop $PKG/usr/share/applications/arduino.desktop install -D -m 644 $CWD/arduino.png $PKG/usr/share/pixmaps/arduino.png mkdir -p $DOCS cp -a revisions.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 cat $CWD/slack-required > $PKG/install/slack-required 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