Skip to content

Commit 55724db

Browse files
committed
raspbian ready
1 parent de3abb2 commit 55724db

File tree

5 files changed

+26
-12
lines changed

5 files changed

+26
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
**v1.5.0** Update to jruby-complete-9.2.0.0.
1+
**v1.5.0** Update to jruby-complete-9.2.0.0, make native loader work with raspberrypi.
22

33
**v1.4.9** Update to jruby-complete-9.1.17.0.
44

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
# JRubyArt
33
[![Gem Version](https://badge.fury.io/rb/jruby_art.svg)](http://badge.fury.io/rb/jruby_art)
44
![Travis CI](https://travis-ci.org/ruby-processing/JRubyArt.svg)
5-
Versions before JRubyArt-1.2.0, are unsupported, please update, preferably to latest version, especially if you are on windows (_library_loader_ fix 1.4.2+)...
5+
Versions before JRubyArt-1.5.0, are unsupported, please update, preferably to latest version, especially if you are on windows or raspberrypi
66

77
_Note the main reason for the current build to fail on travis is when the current version of [processing is not available from maven central][testing], it has only ever been available by third parties (I am eternally hopeful that one day processing.org will see the light), actually rvm with jruby as used by travis-ci is also pretty crap as judged by the build traces._
88

99
## Requirements
1010
A clean start for `jruby_art` that works best with the latest version of [processing-3.3.7](https://github.com/processing/processing/releases) and [jruby-9.1.17.0](http://jruby.org/download) see [wiki](https://github.com/ruby-processing/JRubyArt/wiki/Building-latest-gem) for building gem from this repo. Changes from processing-2.0 to [processing-3.0 here](https://github.com/processing/processing/wiki/Changes-in-3.0). Should work on same platforms as vanilla processing (windows, mac, linux) for Android see Yuki Morohoshi [rubuto-processing3][].
1111
## Requirements
1212

13-
A suitable version of ruby (MRI `ruby 2.4+` or `jruby-9.1.17.0`) to download gem.
13+
A suitable version of ruby (MRI `ruby 2.3+` or `jruby-9.2.0.0`) to download gem.
1414

1515
`processing-3.3.7`
1616

lib/jruby_art/config.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ def self.os
2929
detect_os = RbConfig::CONFIG['host_os']
3030
case detect_os
3131
when /mac|darwin/ then :mac
32+
when /gnueabihf/ then :arm
3233
when /linux/ then :linux
3334
when /solaris|bsd/ then :unix
3435
else
35-
WIN_PATTERNS.find { |reg| detect_os =~ reg }
36+
WIN_PATTERNS.find { |reg| reg.match?(detect_os) }
3637
raise "unsupported os: #{detect_os.inspect}" if Regexp.last_match.nil?
3738
:windows
3839
end

lib/jruby_art/installer.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ def set_processing_root
2121
Dir.mkdir(folder) unless File.exist? folder
2222
path = File.join(folder, 'config.yml')
2323
proot = "#{HOME}/processing-#{VERSION}"
24+
proot = "/usr/local/lib/processing-#{VERSION}" if os == :arm
2425
proot = "/Java/Processing-#{VERSION}" if os == :windows
2526
proot = '/Applications/Processing.app/Contents/Java' if os == :mac
27+
jruby = true
28+
jruby = false if os == :arm
2629
settings = %w[
2730
PROCESSING_ROOT JRUBY sketchbook_path template MAX_WATCH sketch_title width height
2831
]

lib/jruby_art/native_folder.rb

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
require 'rbconfig'
22

33
# Utility to load native binaries on Java CLASSPATH
4+
# HACK until jruby returns a more specific 'host_os' than 'linux'
45
class NativeFolder
56
attr_reader :os, :bit
67

8+
LINUX_FORMAT = 'linux%s'.freeze
9+
ARM32 = '-armv6hf'.freeze
10+
# ARM64 = '-aarch64'.freeze
711
WIN_FORMAT = 'windows%d'.freeze
8-
LINUX_FORMAT = 'linux%d'.freeze
912
WIN_PATTERNS = [
1013
/bccwin/i,
1114
/cygwin/i,
@@ -17,18 +20,25 @@ class NativeFolder
1720

1821
def initialize
1922
@os = RbConfig::CONFIG['host_os'].downcase
20-
@bit = java.lang.System.get_property('os.arch') =~ /64/ ? 64 : 32
23+
@bit = java.lang.System.get_property('os.arch')
2124
end
2225

2326
def name
24-
return 'macosx' if os =~ /darwin/ || os =~ /mac/
25-
return format(WIN_FORMAT, bit) if WIN_PATTERNS.any? { |pat| pat =~ os }
26-
return format(LINUX_FORMAT, bit) if os =~ /linux/
27+
return 'macosx' if /darwin|mac/.match?(os)
28+
if /linux/.match?(os)
29+
return format(LINUX_FORMAT, '64') if /amd64/.match?(bit)
30+
return format(LINUX_FORMAT, ARM32) if /arm/.match?(bit)
31+
end
32+
if WIN_PATTERNS.any? { |pat| pat.match?(os) }
33+
return format(WINDOWS_FORMAT, '64') if /64/.match?(bit)
34+
return format(WINDOWS_FORMAT, '32') if /32/.match?(bit)
35+
end
36+
raise 'Unsupported Architecture'
2737
end
2838

2939
def extension
30-
return '*.so' if os =~ /linux/
31-
return '*.dll' if WIN_PATTERNS.any? { |pat| pat =~ os }
40+
return '*.so' if /linux/.match?(os)
41+
return '*.dll' if WIN_PATTERNS.any? { |pat| pat.match?(os) }
3242
'*.dylib' # MacOS
3343
end
34-
end
44+
end

0 commit comments

Comments
 (0)