openbsd-ports/devel/arduino/files/arduinoproject
jasper aa0045971b - update arduino to 1.0, please see the changelog:
http://arduino.cc/blog/2011/10/04/arduino-1-0/
   - various changes related to this port:
      * adjust sketch extensions from .pde to .ino
	 * deal better with different arduino variants
	    * adjust template to get it compiling/linking again

	    tested by various
2012-04-24 06:37:32 +00:00

58 lines
1.7 KiB
Bash

#!/bin/sh
# $OpenBSD: arduinoproject,v 1.2 2012/04/24 06:37:32 jasper Exp $
# Copyright (c) 2011 Chris Kuethe <ckuethe@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
L=${TRUEPREFIX}
AS="${L}/share"
ASA="${AS}/arduino"
ASD="${AS}/doc/arduino"
ASE="${AS}/examples/arduino"
if [ $# -ne 1 -o "x$1" = "x-h" ] ; then
cat << EOH
usage: $0 <projectname>
This will populate a new directory with a makefile and a template
source file. If you have an existing source - one of the examples,
perhaps - you can copy it over the template and run "make".
EOH
exit 1
fi
P=$(echo -n "$1" | tr -c -s "A-Za-z0-9_-." "_")
if [ -d "$P" ] ; then
echo "using existing $P directory"
else
if [ -e "$P" ] ; then
echo "sorry, $P exists and is not a directory"
exit 1
fi
T=`mktemp -d arduino.XXXXXXXXXX` || exit 1
echo "creating new arduino project '$P'"
mv $T "$P"
fi
cd $P || exit 1
D=`date "+.%s"`
cmp -s ${ASE}/Makefile.in Makefile || \
install -b -B $D -S ${ASE}/BSDmakefile BSDmakefile
cmp -s ${ASE}/template.ino "${P}.ino" || \
install -b -B $D -S ${ASE}/template.ino "${P}.ino"
mkdir -p applet