2005-08-25 23:06:28 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Part of the Arduino project
|
|
|
|
# http://arduino.berlios.de
|
|
|
|
#
|
|
|
|
# this is derived from the processing project
|
|
|
|
# http://www.processing.org
|
|
|
|
#
|
|
|
|
# This file is subjected to the GPL License
|
|
|
|
#
|
|
|
|
|
|
|
|
### -- SETUP WORK DIR -------------------------------------------
|
|
|
|
|
|
|
|
if test -d work
|
|
|
|
then
|
|
|
|
BUILD_PREPROC=false
|
|
|
|
else
|
|
|
|
BUILD_PREPROC=true
|
|
|
|
|
|
|
|
# needs to make the dir because of packaging goofiness
|
2005-08-26 03:19:18 +02:00
|
|
|
echo Setting up directories to build under Mac OS X
|
2005-08-25 23:06:28 +02:00
|
|
|
mkdir -p work/classes/processing/app/preproc
|
|
|
|
mkdir -p work/classes/processing/app/syntax
|
|
|
|
mkdir -p work/classes/processing/app/tools
|
|
|
|
mkdir -p work/lib/build
|
2005-09-20 19:55:27 +02:00
|
|
|
mkdir -p work/examples
|
2005-08-25 23:06:28 +02:00
|
|
|
|
2005-09-10 01:42:35 +02:00
|
|
|
cp ../../lib/librxtxSerial.jnilib work/
|
2005-11-23 01:11:13 +01:00
|
|
|
cp -pR dist/drivers work/
|
2005-09-10 01:42:35 +02:00
|
|
|
|
2005-08-25 23:06:28 +02:00
|
|
|
# to have a copy of this guy around for messing with
|
|
|
|
echo Copying Arduino.app...
|
|
|
|
cp -pR dist/Arduino.app work/
|
|
|
|
# cvs doesn't seem to want to honor the +x bit
|
|
|
|
chmod +x work/Arduino.app/Contents/MacOS/JavaApplicationStub
|
2005-09-25 16:11:32 +02:00
|
|
|
|
|
|
|
echo Extracting examples...
|
|
|
|
unzip -d work/examples ../shared/dist/examples.zip
|
2005-08-25 23:06:28 +02:00
|
|
|
|
|
|
|
# copy the avr-gcc distribution
|
2005-08-26 03:19:18 +02:00
|
|
|
echo Copying tools \(this may take a minute\)...
|
2005-08-25 23:06:28 +02:00
|
|
|
cp -pR dist/tools.zip work/
|
|
|
|
cd work
|
2005-08-26 03:19:18 +02:00
|
|
|
unzip -oq tools.zip
|
2005-08-25 23:06:28 +02:00
|
|
|
rm tools.zip
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
# get jikes and depedencies
|
|
|
|
echo Copying jikes...
|
|
|
|
cp dist/jikes work/
|
|
|
|
chmod +x work/jikes
|
|
|
|
fi
|
|
|
|
|
2005-09-25 16:11:32 +02:00
|
|
|
echo Copying shared files...
|
2005-08-26 03:19:18 +02:00
|
|
|
cp -r ../shared/* work
|
|
|
|
|
2005-09-25 16:11:32 +02:00
|
|
|
echo Copying targets...
|
|
|
|
# make sure there's no cruft in the targets folder
|
|
|
|
rm -rf work/lib/targets
|
|
|
|
cp -r ../../targets work/lib/
|
2005-09-20 19:55:27 +02:00
|
|
|
|
2005-08-26 03:19:18 +02:00
|
|
|
echo Copying dist files...
|
2005-09-20 18:58:07 +02:00
|
|
|
cp -r dist/bootloader work/
|
2005-08-25 23:06:28 +02:00
|
|
|
|
|
|
|
### -- START BUILDING -------------------------------------------
|
|
|
|
|
2005-08-26 03:19:18 +02:00
|
|
|
# move to root 'arduino' directory
|
2005-08-25 23:06:28 +02:00
|
|
|
cd ../..
|
|
|
|
|
|
|
|
|
2005-08-26 03:19:18 +02:00
|
|
|
### -- BUILD GCC ------------------------------------------------
|
2005-08-25 23:06:28 +02:00
|
|
|
# in the future we will build avr-gcc and tools (if they don't exist)
|
|
|
|
|
2005-09-20 18:58:07 +02:00
|
|
|
### -- BUILD BOOTLOADER ----------------------------------------
|
|
|
|
cd bootloader
|
|
|
|
export DIRAVR=../build/macosx/work/tools/avr
|
|
|
|
make
|
|
|
|
cp ATmegaBOOT.hex ../build/macosx/work/bootloader
|
|
|
|
cd ..
|
|
|
|
|
2005-08-26 03:19:18 +02:00
|
|
|
### -- BUILD JAVA -----------------------------------------------
|
|
|
|
|
2005-08-25 23:06:28 +02:00
|
|
|
# set classpath
|
|
|
|
CLASSPATH=/System/Library/Frameworks/JavaVM.framework/Classes/classes.jar:/System/Library/Frameworks/JavaVM.framework/Classes/ui.jar:/System/Library/Java/Extensions/MRJToolkit.jar
|
|
|
|
export CLASSPATH
|
|
|
|
|
|
|
|
cd app
|
|
|
|
|
|
|
|
### -- BUILD PARSER ---------------------------------------------
|
|
|
|
|
2005-09-25 16:11:32 +02:00
|
|
|
if test -f preproc/expandedpde.g
|
2005-08-25 23:06:28 +02:00
|
|
|
then
|
2005-09-25 16:11:32 +02:00
|
|
|
echo
|
|
|
|
else
|
2005-08-25 23:06:28 +02:00
|
|
|
cd preproc
|
|
|
|
# build classes/grammar for preprocessor
|
|
|
|
echo Building antlr grammar code...
|
|
|
|
# first build the default java goop
|
2005-09-25 16:11:32 +02:00
|
|
|
java -cp ../../build/macosx/work/lib/antlr.jar antlr.Tool StdCParser.g
|
2005-08-25 23:06:28 +02:00
|
|
|
# now build the pde stuff that extends the java classes
|
2005-09-25 16:11:32 +02:00
|
|
|
java -cp ../../build/macosx/work/lib/antlr.jar antlr.Tool -glib StdCParser.g WParser.g
|
|
|
|
java -cp ../../build/macosx/work/lib/antlr.jar antlr.Tool WTreeParser.g
|
|
|
|
java -cp ../../build/macosx/work/lib/antlr.jar antlr.Tool -glib WTreeParser.g WEmitter.g
|
2005-08-25 23:06:28 +02:00
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
|
|
|
### -- BUILD PDE ------------------------------------------------
|
|
|
|
|
|
|
|
echo Building the PDE...
|
|
|
|
|
|
|
|
# compile the code as java 1.3, so that the application will run and
|
|
|
|
# show the user an error, rather than crapping out with some strange
|
|
|
|
# "class not found" crap
|
2005-08-26 03:19:18 +02:00
|
|
|
../build/macosx/work/jikes -target 1.3 +D -classpath ../build/macosx/work/classes:../build/macosx/work/lib/antlr.jar:../build/macosx/work/lib/oro.jar:../build/macosx/work/lib/registry.jar:../build/macosx/work/lib/RXTXcomm.jar:$CLASSPATH -d ../build/macosx/work/classes tools/*.java preproc/*.java syntax/*.java *.java
|
2005-08-25 23:06:28 +02:00
|
|
|
|
|
|
|
cd ../build/macosx/work/classes
|
|
|
|
rm -f ../lib/pde.jar
|
|
|
|
zip -0rq ../lib/pde.jar .
|
|
|
|
cd ../..
|
|
|
|
|
|
|
|
# get the libs
|
|
|
|
mkdir -p work/Arduino.app/Contents/Resources/Java/
|
|
|
|
cp work/lib/*.jar work/Arduino.app/Contents/Resources/Java/
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo Done.
|