#!/bin/sh # Heavily based on the Slackware 13.37 SlackBuild # Written by Vito Magnanimo ( vitomag89@gmail.com ) # Last build from Vito Magnanimo ( vitomag89@gmail.com ) # Slackware build script for arduino-ide # Official Site: http://www.arduino.cc # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # # Required: avr-libc # # Exit on most errors set -e PKGNAME="arduino" VERSION=${VERSION:-1.0} BUILD=${BUILD:-2} TAG=${TAG:-sl} ARCH=${ARCH:-i486} TYPE="" LSOURCE="ftp://ftp.slackware.no/pub/linux/slackware/slackware-13.37/slackware/l/libusb-1.0.8-i486-2.txz" if [ "$ARCH" = "x86_64" ]; then TYPE="-64-2" fi SOURCE="http://arduino.googlecode.com/files/$PKGNAME-$VERSION-linux$TYPE.tgz" CWD=$(pwd) TMP=${TMP:-/tmp/buildpkgs/$PKGNAME} PKG=$TMP/package-$PKGNAME OUTPUT=${OUTPUT:-$CWD} SYSTEMFOLDER=${SYSTEMFOLDER:-/opt/$PKGNAME} if [ ! -e $CWD/$PKGNAME-$VERSION-linux$TYPE.tgz ];then wget $SOURCE fi rm -rf $TMP mkdir -p $TMP $PKG $OUTPUT if [ "$ARCH" = "x86_64" ]; then if [ ! -e $CWD/libusb-1.0.8-i486-2.txz ];then wget $LSOURCE fi mkdir -p $TMP/libusb32 cd $TMP/libusb32 tar xvf $CWD/libusb-1.0.8-i486-2.txz fi cd $TMP tar xvf $CWD/$PKGNAME-$VERSION-linux$TYPE.tgz cd $PKGNAME-$VERSION chown -R root:root . chmod -R u+w,go+r-w,a-s . mkdir -p $PKG/opt cp -a ../$PKGNAME-$VERSION $PKG/opt/arduino # 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/$PKGNAME #!/bin/sh 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/$PKGNAME mkdir -p $PKG/$SYSTEMFOLDER cp -a * $PKG/$SYSTEMFOLDER/ install -D -m 644 $CWD/arduino.desktop $PKG/usr/share/applications/arduino.desktop install -D -m 644 reference/img/logo.png $PKG/usr/share/pixmaps/arduino.png if [ "$ARCH" = "x86_64" ]; then cp -a $TMP/libusb32/usr/lib/libusb-1.0.so.0.0.0 \ $PKG/opt/arduino/lib/libusb-1.0.so.0 cp -a $TMP/libusb32/usr/lib/libusb-0.1.so.4.4.4 \ $PKG/opt/arduino/lib/libusb-0.1.so.4 fi mkdir -p $PKG/usr/doc/$PKGNAME-$VERSION cp -a \ ../$PKGNAME-$VERSION/revisions.txt \ $PKG/usr/doc/$PKGNAME-$VERSION cat $CWD/$PKGNAME.Slackbuild > $PKG/usr/doc/$PKGNAME-$VERSION/$PKGNAME.SlackBuild cat $CWD/slack-desc > $PKG/usr/doc/$PKGNAME-$VERSION/slack-desc if [ -d $PKG/usr/man ]; then ( cd $PKG/usr/man find . -type f -exec gzip -9 {} \; for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done ) fi ( cd $PKG find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs -r strip --strip-unneeded 2> /dev/null || true find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs -r strip --strip-unneeded 2> /dev/null || true find . | xargs file | grep "current ar archive" | cut -f 1 -d : | xargs -r strip --strip-unneeded 2> /dev/null || true ) mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG chown -R root:root $PKG if [ -x "$(which requiredbuilder 2>/dev/null)" ];then ADD=$(ls /var/log/packages/ | sed -ne 's/\(avr-libc\)-\([^-]\+-[^-]\+-[^-]\+\)/\1 >= \2/p') \ requiredbuilder -y -v -s $CWD $PKG # aggiungi -c -b se hai binari in /usr/share fi /sbin/makepkg -l y -c n $OUTPUT/$PKGNAME-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz} if [ "$1" = "--cleanup" ]; then rm -rf $TMP fi