diff -Ncwr processing.orig/app/src/processing/app/openbsd/Platform.java processing/app/src/processing/app/openbsd/Platform.java *** processing.orig/app/src/processing/app/openbsd/Platform.java Thu Jan 1 09:00:00 1970 --- processing/app/src/processing/app/openbsd/Platform.java Sun Jan 10 15:48:36 2010 *************** *** 0 **** --- 1,109 ---- + /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + + /* + Part of the Processing project - http://processing.org + + Copyright (c) 2008 Ben Fry and Casey Reas + + This program 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 + (at your option) any later version. + + This program 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 + */ + + package processing.app.openbsd; + + import java.io.File; + + import javax.swing.UIManager; + + import processing.app.Preferences; + + + /** + * Used by Base for platform-specific tweaking, for instance finding the + * sketchbook location using the Windows registry, or OS X event handling. + */ + public class Platform extends processing.app.Platform { + + // TODO Need to be smarter here since KDE people ain't gonna like that GTK. + // It may even throw a weird exception at 'em for their trouble. + public void setLookAndFeel() throws Exception { + // For 0120, trying out the gtk+ look and feel as the default. + // This is available in Java 1.4.2 and later, and it can't possibly + // be any worse than Metal. (Ocean might also work, but that's for + // Java 1.5, and we aren't going there yet) + UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); + } + + + public void openURL(String url) throws Exception { + if (openFolderAvailable()) { + String launcher = Preferences.get("launcher"); + if (launcher != null) { + Runtime.getRuntime().exec(new String[] { launcher, url }); + } + } + } + + + public boolean openFolderAvailable() { + if (Preferences.get("launcher") != null) { + return true; + } + + // Attempt to use xdg-open + try { + Process p = Runtime.getRuntime().exec(new String[] { "xdg-open" }); + p.waitFor(); + Preferences.set("launcher", "xdg-open"); + return true; + } catch (Exception e) { } + + // Attempt to use gnome-open + try { + Process p = Runtime.getRuntime().exec(new String[] { "gnome-open" }); + p.waitFor(); + // Not installed will throw an IOException (JDK 1.4.2, Ubuntu 7.04) + Preferences.set("launcher", "gnome-open"); + return true; + } catch (Exception e) { } + + // Attempt with kde-open + try { + Process p = Runtime.getRuntime().exec(new String[] { "kde-open" }); + p.waitFor(); + Preferences.set("launcher", "kde-open"); + return true; + } catch (Exception e) { } + + return false; + } + + + public void openFolder(File file) throws Exception { + if (openFolderAvailable()) { + String lunch = Preferences.get("launcher"); + try { + String[] params = new String[] { lunch, file.getAbsolutePath() }; + //processing.core.PApplet.println(params); + /*Process p =*/ Runtime.getRuntime().exec(params); + /*int result =*/ //p.waitFor(); + } catch (Exception e) { + e.printStackTrace(); + } + } else { + System.out.println("No launcher set, cannot open " + + file.getAbsolutePath()); + } + } + } diff -Ncwr processing.orig/build/openbsd/dist/processing processing/build/openbsd/dist/processing *** processing.orig/build/openbsd/dist/processing Thu Jan 1 09:00:00 1970 --- processing/build/openbsd/dist/processing Sun Jan 10 11:29:49 2010 *************** *** 0 **** --- 1,100 ---- + #!/bin/sh + + # This script runs Processing, using the JDK in the Processing + # installation directory if possible. + + # If no JDK was installed with Processing then the script tries to use + # the preferred Java version of the machine, i.e. what is executed + # by the "java" console command. This must be a Sun JDK (for details, see + # http://processing.org/reference/environment/platforms.html#java). + + # In order to run Processing with an already installed JDK that is *not* + # the preferred Java version of the machine, create a symlink named "java" + # in the Processing installation directory that points to the JDK home + # directory. + + # Thanks to Ferdinand Kasper for this build script. [fry] + + + # JARs required from JDK (anywhere in/below the JDK home directory) + JDKLIBS="rt.jar tools.jar" + + # Set this to non-zero for logging + LOGGING=0 + + # Logs name and value of a variable to stdout if LOGGING is non-zero. + # Expects the variable name as parameter $1. + log() { + if [ $LOGGING -ne 0 ]; then + eval echo $1=\$$1 + fi + } + + + # Locates JDKLIBS in a directory and its subdirectories and saves their + # absolute paths as list to JDKCP. Expects the directory as parameter $1. + # Sets SUCCESS to 1 if all libraries were found, to 0 otherwise. + make_jdkcp() { + # Back out of JRE directory if apparently located inside a JDK + if [ -f "$1/../bin/java" ]; then + DIR="$1/.." + else + DIR="$1" + fi + log DIR + + JDKCP= + SUCCESS=1 + + # Locate JDKLIBS + for L in $JDKLIBS; do + # Locate only the first library with a matching name + LIB=`find "$DIR" -name $L 2>/dev/null | head -n 1` + log L + log LIB + + # Library found? + if [ -n "$LIB" ]; then + JDKCP="$JDKCP"${JDKCP:+:}"$LIB" + else + SUCCESS=0 + fi + done + + log JDKCP + } + + + # Get absolute path of directory where this script is located + APPDIR=`readlink -f "$0"` + APPDIR=`dirname "$APPDIR"` + log APPDIR + + # Try using a local JDK from the same directory as this script + JDKDIR=`readlink -f "$APPDIR/java"` + make_jdkcp "$JDKDIR" + log SUCCESS + + # Local JDK found? + if [ $SUCCESS -ne 1 ]; then + # No, try using the preferred system JRE/JDK (if any) + JDKDIR=`which java` && JDKDIR=`readlink -e "$JDKDIR"` && JDKDIR=`dirname "$JDKDIR"`/.. + make_jdkcp "$JDKDIR" + log SUCCESS + fi + + # Add all required JARs to CLASSPATH + CLASSPATH="$CLASSPATH"${CLASSPATH:+:}"$JDKCP" + for LIB in "$APPDIR"/lib/*.jar; do + CLASSPATH="$CLASSPATH"${CLASSPATH:+:}"$LIB" + done + export CLASSPATH + log CLASSPATH + + # Make all JDK binaries available in PATH + export PATH="$JDKDIR/bin":"$PATH" + log PATH + + # Start Processing in the same directory as this script + cd "$APPDIR" + java processing.app.Base & diff -Ncwr processing.orig/build/openbsd/dist.sh processing/build/openbsd/dist.sh *** processing.orig/build/openbsd/dist.sh Thu Jan 1 09:00:00 1970 --- processing/build/openbsd/dist.sh Sun Jan 10 15:38:12 2010 *************** *** 0 **** --- 1,93 ---- + #!/bin/sh + + #REVISION=`head -c 4 ../../todo.txt` + REVISION=`head -n 1 ../../todo.txt | awk '{print $1}'` + + if [ $1 ] + then + RELEASE=$1 + echo Creating Processing release $RELEASE... + else + RELEASE=$REVISION + echo Creating Processing distribution for revision $REVISION... + fi + + ARCH=`uname -m` + if [ $ARCH != "i686" ] + then + echo At present, the OpenBSD distribution can only be built on i686 \(32-bit\). + exit + fi + + ./make.sh + + # remove any old boogers + rm -rf processing + rm -rf processing-* + + mkdir processing + cp -r ../shared/lib processing/ + cp -r ../shared/libraries processing/ + cp -r ../shared/tools processing/ + cp ../../app/lib/antlr.jar processing/lib/ + cp ../../app/lib/ecj.jar processing/lib/ + cp ../../app/lib/jna.jar processing/lib/ + cp ../../app/lib/ant.jar processing/lib/ + cp ../../app/lib/ant-launcher.jar processing/lib/ + cp ../shared/revisions.txt processing/ + + if [ $1 ] + then + # write the release version number into the output directory + echo $1 > processing/lib/version.txt + fi + + echo Extracting examples... + unzip -q -d processing/ ../shared/examples.zip + + echo Extracting reference... + unzip -q -d processing/ ../shared/reference.zip + + # add the libraries folder with source + cp -r ../../net processing/libraries/ + cp -r ../../opengl processing/libraries/ + cp -r ../../serial processing/libraries/ + cp -r ../../pdf processing/libraries/ + cp -r ../../dxf processing/libraries/ + + # link java (jdk) files + ln -s /usr/local/jdk-1.5.0 processing/java + + # grab pde.jar and export from the working dir + cp work/lib/pde.jar processing/lib/ + cp work/lib/core.jar processing/lib/ + + # get platform-specific goodies from the dist dir + install -m 755 dist/processing processing/processing + + # make sure notes.txt is unix LFs + # the 2> is because the app is a little chatty + dos2unix processing/revisions.txt 2> /dev/null + dos2unix processing/lib/preferences.txt 2> /dev/null + + # remove boogers + find processing -name "*~" -exec rm -f {} ';' + find processing -name ".DS_Store" -exec rm -f {} ';' + find processing -name "._*" -exec rm -f {} ';' + find processing -name "Thumbs.db" -exec rm -f {} ';' + + # clean out the cvs entries + find processing -name "CVS" -exec rm -rf {} ';' 2> /dev/null + find processing -name ".cvsignore" -exec rm -rf {} ';' + find processing -name ".svn" -exec rm -rf {} 2> /dev/null ';' + + # zip it all up for release + echo Creating tarball and finishing... + P5=processing-$RELEASE + mv processing $P5 + + tar cfz $P5.tgz $P5 + # nah, keep the new directory around + #rm -rf $P5 + + echo Done. diff -Ncwr processing.orig/build/openbsd/make.sh processing/build/openbsd/make.sh *** processing.orig/build/openbsd/make.sh Thu Jan 1 09:00:00 1970 --- processing/build/openbsd/make.sh Sun Jan 10 11:39:21 2010 *************** *** 0 **** --- 1,221 ---- + #!/bin/sh + + + ### -- SETUP WORK DIR ------------------------------------------- + + if test -d work + then + BUILD_PREPROC=false + else + echo Setting up directories to build for OpenBSD... + BUILD_PREPROC=true + + mkdir work + cp -r ../shared/lib work/ + cp -r ../shared/libraries work/ + cp -r ../shared/tools work/ + + cp ../../app/lib/antlr.jar work/lib/ + cp ../../app/lib/ecj.jar work/lib/ + cp ../../app/lib/jna.jar work/lib/ + cp ../../app/lib/ant.jar work/lib/ + cp ../../app/lib/ant-launcher.jar work/lib/ + + echo Extracting examples... + unzip -q -d work/ ../shared/examples.zip + + echo Extracting reference... + unzip -q -d work/ ../shared/reference.zip + + cp -r ../../net work/libraries/ + cp -r ../../opengl work/libraries/ + cp -r ../../serial work/libraries/ + cp -r ../../video work/libraries/ + cp -r ../../pdf work/libraries/ + cp -r ../../dxf work/libraries/ + + install -m 755 dist/processing work/processing + + ln -s /usr/local/jdk-1.5.0 `pwd`/work/java + fi + + cd ../.. + + + ### -- BUILD CORE ---------------------------------------------- + + + echo Building processing.core + + cd core + + #CLASSPATH="../build/openbsd/work/java/lib/rt.jar" + #export CLASSPATH + + perl preproc.pl + mkdir -p bin + ../build/openbsd/work/java/bin/java \ + -cp ../build/openbsd/work/java/lib/tools.jar \ + com.sun.tools.javac.Main \ + -d bin -source 1.5 -target 1.5 \ + -encoding UTF-8 \ + src/processing/core/*.java src/processing/xml/*.java + #find bin -name "*~" -exec rm -f {} ';' + rm -f ../build/openbsd/work/lib/core.jar + cd bin && zip -rq ../../build/openbsd/work/lib/core.jar \ + processing/core/*.class processing/xml/*.class && cd .. + + # back to base processing dir + cd .. + + + ### -- BUILD PREPROC ------------------------------------------------ + + echo Building PDE for JDK 1.5... + + cd app + + # long path is to avoid requiring java to be in your PATH + echo Building antlr grammar code... + + # first build the default java goop + ../build/openbsd/work/java/bin/java \ + -cp ../build/openbsd/work/lib/antlr.jar antlr.Tool \ + -o src/antlr/java \ + src/antlr/java/java.g + + # hack to get around path mess + cp src/antlr/java/JavaTokenTypes.txt src/processing/app/preproc/ + + # now build the pde stuff that extends the java classes + # this is totally ugly and needs to be fixed + # the problem is that -glib doesn't set the main path properly, + # so it's necessary to cd into the antlr/java folder, otherwise + # the JavaTokenTypes.txt file won't be found + cd src/antlr/java + ../../../../build/openbsd/work/java/bin/java \ + -cp ../../../../build/openbsd/work/lib/antlr.jar antlr.Tool \ + -o ../../processing/app/preproc \ + -glib java.g \ + ../../processing/app/preproc/pde.g + cd ../../.. + + # return to the root of the p5 folder + cd .. + + + ### -- BUILD PDE ------------------------------------------------ + + cd app + + rm -rf ../build/openbsd/work/classes + mkdir ../build/openbsd/work/classes + + ../build/openbsd/work/java/bin/java \ + -cp ../build/openbsd/work/java/lib/tools.jar \ + com.sun.tools.javac.Main \ + -source 1.5 -target 1.5 \ + -encoding UTF-8 \ + -classpath ../build/openbsd/work/lib/core.jar:../build/openbsd/work/lib/antlr.jar:../build/openbsd/work/lib/ant.jar:../build/openbsd/work/lib/ant-launcher.jar:../build/openbsd/work/lib/ecj.jar:../build/openbsd/work/lib/jna.jar:../build/openbsd/work/java/lib/tools.jar \ + -d ../build/openbsd/work/classes \ + src/processing/app/*.java \ + src/processing/app/debug/*.java \ + src/processing/app/openbsd/*.java \ + src/processing/app/preproc/*.java \ + src/processing/app/syntax/*.java \ + src/processing/app/tools/*.java \ + src/processing/app/tools/android/*.java \ + src/antlr/*.java \ + src/antlr/java/*.java + + cd ../build/openbsd/work/classes + rm -f ../lib/pde.jar + zip -0rq ../lib/pde.jar . + cd ../../../.. + + + ### -- BUILD LIBRARIES ------------------------------------------------ + + cd build/openbsd + + PLATFORM=openbsd + + JAVAC="../build/openbsd/work/java/bin/java -cp ../build/openbsd/work/java/lib/tools.jar com.sun.tools.javac.Main -source 1.5 -target 1.5 -encoding UTF-8" + CORE=../build/$PLATFORM/work/lib/core.jar + LIBRARIES=../build/$PLATFORM/work/libraries + + # move to processing/build + cd .. + + # SERIAL LIBRARY + echo Building serial library... + cd ../serial + mkdir -p bin + $JAVAC \ + -classpath "library/RXTXcomm.jar:$CORE" \ + -d bin src/processing/serial/*.java + rm -f library/serial.jar + find bin -name "*~" -exec rm -f {} ';' + cd bin && zip -rq ../library/serial.jar processing/serial/*.class && cd .. + mkdir -p $LIBRARIES/serial/library/ + cp library/serial.jar $LIBRARIES/serial/library/ + + + # NET LIBRARY + echo Building net library... + cd ../net + mkdir -p bin + $JAVAC \ + -classpath "$CORE" \ + -d bin src/processing/net/*.java + rm -f library/net.jar + find bin -name "*~" -exec rm -f {} ';' + cd bin && zip -rq ../library/net.jar processing/net/*.class && cd .. + mkdir -p $LIBRARIES/net/library/ + cp library/net.jar $LIBRARIES/net/library/ + + + # OPENGL LIBRARY + echo Building OpenGL library... + cd ../opengl + mkdir -p bin + $JAVAC \ + -classpath "library/jogl.jar:$CORE" \ + -d bin src/processing/opengl/*.java + rm -f library/opengl.jar + find bin -name "*~" -exec rm -f {} ';' + cd bin && zip -rq ../library/opengl.jar processing/opengl/*.class && cd .. + mkdir -p $LIBRARIES/opengl/library/ + cp library/opengl.jar $LIBRARIES/opengl/library/ + + + # PDF LIBRARY + echo Building PDF library... + cd ../pdf + mkdir -p bin + $JAVAC \ + -classpath "library/itext.jar:$CORE" \ + -d bin src/processing/pdf/*.java + rm -f library/pdf.jar + find bin -name "*~" -exec rm -f {} ';' + cd bin && zip -rq ../library/pdf.jar processing/pdf/*.class && cd .. + mkdir -p $LIBRARIES/pdf/library/ + cp library/pdf.jar $LIBRARIES/pdf/library/ + + + # DXF LIBRARY + echo Building DXF library... + cd ../dxf + mkdir -p bin + $JAVAC \ + -classpath "$CORE" \ + -d bin src/processing/dxf/*.java + rm -f library/dxf.jar + find bin -name "*~" -exec rm -f {} ';' + cd bin && zip -rq ../library/dxf.jar processing/dxf/*.class && cd .. + mkdir -p $LIBRARIES/dxf/library/ + cp library/dxf.jar $LIBRARIES/dxf/library/ + + + echo + echo Done. diff -Ncwr processing.orig/build/openbsd/run.sh processing/build/openbsd/run.sh *** processing.orig/build/openbsd/run.sh Thu Jan 1 09:00:00 1970 --- processing/build/openbsd/run.sh Sun Jan 10 11:29:22 2010 *************** *** 0 **** --- 1,3 ---- + #!/bin/sh + + cd work && ./processing && cd ..