Skip to content

Commit

Permalink
niReg openni dylibs in nite.rb formula, because brew can't execute a …
Browse files Browse the repository at this point in the history
…formula commands after the Key.install step runs
  • Loading branch information
marshally committed Jun 21, 2012
1 parent 6448eaf commit 0d4851c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
19 changes: 18 additions & 1 deletion nite.rb
Expand Up @@ -30,7 +30,7 @@ def install
puts "installing lib '#{so}'... " if ENV['V'] == '1'
lib.install so
puts "Registering module '#{base}'... " if ENV['V'] == '1'
cmd = "export OPEN_NI_INSTALL_PATH=#{HOMEBREW_PREFIX}; niReg -v #{lib}/#{base} #{etc}/primesense/#{feature}"
cmd = "export OPEN_NI_INSTALL_PATH=#{HOMEBREW_PREFIX}; niReg -v -r #{lib}/#{base} #{etc}/primesense/#{feature}"
if `#{cmd}`.include? "Error"
puts "Error installing #{base}"
exit 1
Expand All @@ -41,6 +41,19 @@ def install
end
end

# these libs actually come from the openni.rb formula, but can't be
# installed due to the order that homebrew installs things
["libnimMockNodes.dylib", "libnimCodecs.dylib", "libnimRecorder.dylib"].each do |mod|
fullpath = "#{HOMEBREW_PREFIX}\/lib\/#{mod}"
if File.exists? fullpath
cmd = "export OPEN_NI_INSTALL_PATH=#{HOMEBREW_PREFIX}; niReg -r -v #{fullpath}"
unless `#{cmd}`.include? "Done"
puts "Error installing #{mod}"
puts "#{cmd}"
exit 1
end
end
end
`export OPEN_NI_INSTALL_PATH=#{HOMEBREW_PREFIX}; niLicense PrimeSense 0KOIk2JeIBYClPWVnMoRKn5cdY4=`
end

Expand All @@ -52,6 +65,10 @@ def caveats; <<-EOS.undent
* On Zsh, add them to `~/.zprofile` instead.
export OPEN_NI_INSTALL_PATH=#{HOMEBREW_PREFIX}
Also, expect some errors that look like:
Warning: Could not fix install names for ...
EOS
end
end
24 changes: 10 additions & 14 deletions openni.rb
Expand Up @@ -8,26 +8,22 @@ class Openni < Formula
depends_on 'libusb'

def install
`rm Bin/OpenNI.net.dll`
puts "Installing OpenNI" if ENV['V'] == '1'
puts "copying shared libraries..." if ENV['V'] == '1'
puts "Installing OpenNI"
puts "copying executables..."
bin.install Dir['Bin/ni*']
puts "copying shared libraries..."
lib.install Dir['Lib/*']
puts "copying executables..." if ENV['V'] == '1'
bin.install Dir['Bin/*']
puts "copying include files..." if ENV['V'] == '1'
puts "copying include files..."
include.install Dir['Include/*']

puts "creating database directory..." if ENV['V'] == '1'
puts "creating database directory..."
(var+'lib/ni').mkpath
puts "Installing modules" if ENV['V'] == '1'
["libnimMockNodes.dylib", "libnimCodecs.dylib", "libnimRecorder.dylib"].each do |mod|
`export OPEN_NI_INSTALL_PATH=#{HOMEBREW_PREFIX}; niReg -r #{lib}\/#{mod}`
end
# if mono, then should install wrappers ... not doing this yet
# if mono, then should install wrappers ... but not doing this yet
end

def caveats; <<-EOS.undent
OpenNI requires libusb to be compiled as a Universal binary. If your Kinect does not work as expected, please try reinstalling libusb, like so:
OpenNI requires libusb to be compiled as a Universal binary.
If your Kinect does not work as expected, please try reinstalling libusb, like so:
% brew uninstall libusb && brew install libusb --universal
Expand Down

0 comments on commit 0d4851c

Please sign in to comment.