Permalink
Browse files

jruby 1.6.4 & processing 1.5.1. Automated build process

--HG--
rename : lib/patches/PATCHES.txt => vendors/patches/PATCHES.txt
rename : lib/patches/JRubyApplet.diff => vendors/patches/jruby-1.6.4.patch
rename : lib/patches/PApplet.diff => vendors/patches/processing-1.5.1.patch
  • Loading branch information...
Guillaume Pierronnet
Guillaume Pierronnet committed Sep 20, 2011
1 parent 1884cd4 commit 0dd6c75c23cde5ad67f70f09ed32cde097dd6b25
View
@@ -1,5 +1,22 @@
+syntax: glob
.DS_Store
*.sw*
*.gem
extras
-test.rb
+test.rb
+vendors/orig/
+vendors/*.tar.gz
+vendors/processing-*/
+vendors/jruby-*/
+vendors/sources_has_been_patched
+library/dxf/
+library/javascript/
+library/minim/
+library/net/
+library/opengl/
+library/opengl2/
+library/pdf/
+library/serial/
+library/video/
+lib/core/core.jar
+lib/core/jruby-complete.jar
View
@@ -1,12 +1,18 @@
require 'rake'
desc 'Build and install gem'
-task :install do
- sh "sudo gem build ruby-processing.gemspec"
- sh "sudo gem install #{Dir.glob('*.gem').join(' ')} --no-ri --no-rdoc"
+task :install => :build do
+ sh "gem install #{Dir.glob('*.gem').join(' ')} --no-ri --no-rdoc"
end
desc 'Uninstall gem'
task :uninstall do
- sh "sudo gem uninstall -x ruby-processing"
+ sh "gem uninstall -x ruby-processing"
end
+
+task :build do
+ sh "cd vendors && rake"
+ sh "gem build ruby-processing.gemspec"
+end
+
+task :default => :build
@@ -1,24 +0,0 @@
-Index: src/org/jruby/JRubyApplet.java
-===================================================================
---- src/org/jruby/JRubyApplet.java (revision 9392)
-+++ src/org/jruby/JRubyApplet.java (working copy)
-@@ -257,6 +257,10 @@
- }
- }
-
-+ public synchronized void eval(String code) {
-+ this.runtime.evalScriptlet(code);
-+ }
-+
- public synchronized void setBackgroundColor(Color color) {
- backgroundColor = color;
- repaint();
-@@ -381,7 +385,7 @@
-
- public ConsoleFacade(String bannerText) {
- textPane = new JTextPane();
-- textPane.setMargin(new Insets(4, 4, 0, 4));
-+ textPane.setMargin(new Insets(4, 4, 0, 4));
- textPane.setCaretColor(new Color(0xa4, 0x00, 0x00));
- textPane.setBackground(new Color(0xf2, 0xf2, 0xf2));
- textPane.setForeground(new Color(0xa4, 0x00, 0x00));
View
@@ -0,0 +1,90 @@
+desc "download, patch, build and copy to ruby-processing"
+task :default => [:download, :patch, :build, :copy]
+
+desc "download Processing & JRuby upstream sources"
+task :download => ["processing-1.5.1.tar.gz", "jruby-src-1.6.4.tar.gz"]
+
+file "processing-1.5.1.tar.gz" do
+ sh "svn export http://processing.googlecode.com/svn/tags/processing-1.5.1"
+ sh "tar cvzf processing-1.5.1.tar.gz processing-1.5.1/"
+ #check_md5("processing-1.5.1.tar.gz", "d911f73c693b2f548c7fa3b402876dff")
+end
+
+task "processing-1.5.1" => "processing-1.5.1.tar.gz" do
+ sh "tar xzf processing-1.5.1.tar.gz" unless test(?d, "processing-1.5.1" )
+end
+
+file "jruby-src-1.6.4.tar.gz" do
+ sh "wget -O jruby-src-1.6.4.tar.gz http://jruby.org.s3.amazonaws.com/downloads/1.6.4/jruby-src-1.6.4.tar.gz"
+ check_md5("jruby-src-1.6.4.tar.gz", "fe5f38867b1c15b6c9db13ff97ffa98a")
+end
+
+task "jruby-1.6.4" => "jruby-src-1.6.4.tar.gz" do
+ sh "tar xzf jruby-src-1.6.4.tar.gz" unless test(?d, "jruby-1.6.4" )
+end
+
+directory 'orig'
+
+desc "create diffs for processing & jruby"
+task :diff => 'orig' do
+ Dir.chdir("orig") do
+ sh "tar xzf ../processing-1.5.1.tar.gz" unless test(?d, "processing-1.5.1")
+ sh "tar xzf ../jruby-src-1.6.4.tar.gz" unless test(?d, "jruby-1.6.4")
+
+ # ignore exit status, since diff always exit with code 1 if files are different
+ sh "diff -u processing-1.5.1/core/src/processing/core/PApplet.java ../processing-1.5.1/core/src/processing/core/PApplet.java > ../patches/processing-1.5.1.patch" do; end
+ sh "diff -u jruby-1.6.4/src/org/jruby/JRubyApplet.java ../jruby-1.6.4/src/org/jruby/JRubyApplet.java > ../patches/jruby-1.6.4.patch" do; end
+ end
+end
+
+desc "patch sources"
+task :patch => "sources_has_been_patched"
+
+file "sources_has_been_patched" => ["processing-1.5.1", "jruby-1.6.4"] do
+ sh "cd processing-1.5.1/ && patch -p1 < ../patches/processing-1.5.1.patch"
+ sh "cd jruby-1.6.4/ && patch -p1 < ../patches/jruby-1.6.4.patch"
+ touch "sources_has_been_patched"
+end
+
+desc "build"
+task :build => ["processing-1.5.1/core/core.jar", "jruby-1.6.4/lib/jruby-complete.jar"]
+
+file "jruby-1.6.4/lib/jruby-complete.jar" do
+ sh "cd jruby-1.6.4 && ant jar-jruby-complete"
+end
+
+file "processing-1.5.1/core/core.jar" do
+ sh "cd processing-1.5.1/build && ant build"
+end
+
+directory "../lib/core"
+
+desc "copy libs & jars"
+task :copy => ["../lib/core", "processing-1.5.1/core/core.jar", "jruby-1.6.4/lib/jruby-complete.jar"] do
+ Dir.chdir("processing-1.5.1") do
+ sh "cp core/core.jar ../../lib/core/"
+ end
+ Dir.chdir("jruby-1.6.4") do
+ sh "cp -v lib/jruby-complete.jar ../../lib/core/"
+ end
+ Dir.chdir("processing-1.5.1/java/libraries") do
+ dirs = Dir.glob("*")
+ dirs.each do |d|
+ dst = "../../../../library/#{d}"
+ sh "rm -fr #{dst} && rsync --relative -r --exclude .svn --exclude .cvsignore #{d}/library/ ../../../../library"
+ end
+ end
+end
+
+def check_md5(filename, expected_hash)
+ require "digest/md5"
+ md5 = Digest::MD5.new
+ File.open(filename, "r") do |f|
+ while buf = f.read(4096)
+ md5.update(buf)
+ end
+ end
+ if md5.hexdigest != expected_hash
+ raise "bad md5 checksum for #{filename} (expected #{expected_hash} got #{md5.hexdigest})"
+ end
+end
File renamed without changes.
@@ -0,0 +1,13 @@
+--- jruby-1.6.4/src/org/jruby/JRubyApplet.java 2011-08-23 18:57:19.000000000 +0200
++++ ../jruby-1.6.4/src/org/jruby/JRubyApplet.java 2011-09-20 15:32:13.162486838 +0200
+@@ -257,6 +257,10 @@
+ }
+ }
+
++ public synchronized void eval(String code) {
++ this.runtime.evalScriptlet(code);
++ }
++
+ public synchronized void setBackgroundColor(Color color) {
+ backgroundColor = color;
+ repaint();
@@ -1,8 +1,6 @@
-Index: core/src/processing/core/PApplet.java
-===================================================================
---- core/src/processing/core/PApplet.java (revision 5371)
-+++ core/src/processing/core/PApplet.java (working copy)
-@@ -1386,7 +1386,22 @@
+--- processing-1.5.1/core/src/processing/core/PApplet.java 2011-05-15 19:02:53.000000000 +0200
++++ ../processing-1.5.1/core/src/processing/core/PApplet.java 2011-09-20 15:19:23.009455091 +0200
+@@ -1611,7 +1611,22 @@
} catch (RendererChangeException e) {
// Give up, instead set the new renderer and re-attempt setup()
return;
@@ -25,3 +23,13 @@ Index: core/src/processing/core/PApplet.java
this.defaultSize = false;
} else { // frameCount > 0, meaning an actual draw()
+@@ -1665,6 +1680,9 @@
+ }
+ }
+
++ public boolean isAnimationThreadTerminated() {
++ return thread.getState() == Thread.State.TERMINATED;
++ }
+
+ //////////////////////////////////////////////////////////////
+

0 comments on commit 0dd6c75

Please sign in to comment.