diff --git a/Manifest.txt b/Manifest.txt new file mode 100644 index 0000000..1ae7ab2 --- /dev/null +++ b/Manifest.txt @@ -0,0 +1,10 @@ +COPYING +ChangeLog +Manifest.txt +README +Rakefile +ext/usb/constants.h +ext/usb/extconf.rb +ext/usb/usb.c +lib/usb.rb +sample/usb-power diff --git a/README b/README index 1fbafbe..41a817c 100644 --- a/README +++ b/README @@ -32,9 +32,17 @@ LGPL == Install - % ruby extconf.rb - % make - % make install + % gem install usb + +== Packaging + + % rake package + +== Releasing to rubygems.org + +Make sure to `gem install hoe-git` first. + + % rake release VERSION=0.3.0 == Reference Manual diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..d9b27eb --- /dev/null +++ b/Rakefile @@ -0,0 +1,29 @@ +# -*- ruby -*- + +require 'rubygems' +require 'hoe' +gem 'rake-compiler', '>= 0.4.1' +require "rake/extensiontask" + +Hoe.plugin :git # gem install hoe-git + +Hoe.spec 'usb' do + developer 'Tanaka Akira', 'akr@fsij.org' + + self.history_file = 'ChangeLog' + self.readme_file = 'README' + self.testlib = :minitest + + extra_dev_deps << ['rake-compiler', '>= 0.4.1'] + + self.spec_extras = { + :extensions => ["ext/usb/extconf.rb"], + :homepage => 'http://www.a-k-r.org/ruby-usb/' + } + + Rake::ExtensionTask.new "usb", spec do |ext| + ext.lib_dir = File.join(*['lib', ENV['FAT_DIR']].compact) + end +end + +task :test => :compile diff --git a/constants.h b/ext/usb/constants.h similarity index 100% rename from constants.h rename to ext/usb/constants.h diff --git a/extconf.rb b/ext/usb/extconf.rb similarity index 100% rename from extconf.rb rename to ext/usb/extconf.rb diff --git a/ext/usb/mkmf.log b/ext/usb/mkmf.log new file mode 100644 index 0000000..4337446 --- /dev/null +++ b/ext/usb/mkmf.log @@ -0,0 +1,46 @@ +have_library: checking for usb_init() in -lusb... -------------------- no + +"gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch i386 -arch x86_64 -lruby -lusb -lpthread -ldl " +conftest.c: In function ‘t’: +conftest.c:3: error: ‘usb_init’ undeclared (first use in this function) +conftest.c:3: error: (Each undeclared identifier is reported only once +conftest.c:3: error: for each function it appears in.) +conftest.c: In function ‘t’: +conftest.c:3: error: ‘usb_init’ undeclared (first use in this function) +conftest.c:3: error: (Each undeclared identifier is reported only once +conftest.c:3: error: for each function it appears in.) +lipo: can't figure out the architecture type of: /var/folders/yv/c2r06v597n5bdpw_bf8qcmb80000gp/T//ccoOdXex.out +checked program was: +/* begin */ +1: /*top*/ +2: int main() { return 0; } +3: int t() { void ((*volatile p)()); p = (void ((*)()))usb_init; return 0; } +/* end */ + +"gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch i386 -arch x86_64 -lruby -lusb -lpthread -ldl " +ld: warning: ignoring file /usr/local/lib/libusb.dylib, file was built for unsupported file format which is not the architecture being linked (i386) +Undefined symbols for architecture i386: + "_usb_init", referenced from: + _t in cc1jogpT.o +ld: symbol(s) not found for architecture i386 +collect2: ld returned 1 exit status +lipo: can't open input file: /var/folders/yv/c2r06v597n5bdpw_bf8qcmb80000gp/T//cck9xeTb.out (No such file or directory) +checked program was: +/* begin */ +1: /*top*/ +2: int main() { return 0; } +3: int t() { usb_init(); return 0; } +/* end */ + +-------------------- + +have_header: checking for ruby/st.h... -------------------- yes + +"gcc -E -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common conftest.c -o conftest.i" +checked program was: +/* begin */ +1: #include +/* end */ + +-------------------- + diff --git a/usb.c b/ext/usb/usb.c similarity index 100% rename from usb.c rename to ext/usb/usb.c diff --git a/lib/usb.rb b/lib/usb.rb index 1d8ae5f..9120f72 100644 --- a/lib/usb.rb +++ b/lib/usb.rb @@ -61,6 +61,8 @@ # module USB + VERSION = '0.3.0' + def USB.busses result = [] bus = USB.first_bus