Commit 55019577f42660355631689e830da1d2c75a5780

Added my README file for win32, which describes how to build this thing on Windows

Commit diff

README.win32

 
1= Building Ruby-USB on Windows
2
3The binaries will work with the Ruby one-click installer, but we have to build everything
4with MinGW. This also means we need to build our own Ruby with MinGW.
5
6== Author of README.win32
7
8Aslak Hellesøy <aslak.hellesoy@gmail.com>
9
10== Installing prerequisites
11* MinGW and MSYS: http://www.mingw.org/ (MinGW installer and msysCORE-1.0.11-2007.01.19-1.tar.bz2)
12* LibUsb-Win32: http://libusb-win32.sourceforge.net/
13* Ruby sources
14
15== Building Ruby with MinGW
16put MSYS and MinGW bin on the path, for example:
17SET PATH=C:\MinGW\bin;C:\msys\bin;%PATH%
18
19cd to ruby sources
20
21configure
22make
23make install
24
25You now have a Ruby under c:\usr\local\bin\ruby.exe Try it:
26
27C:\usr\local\bin\ruby --version
28ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mingw32]
29(note the [i386-mingw32])
30
31== Build the extension
32First, cd to the toplevel dir (the directory of this file)
33
34cp "C:\Program Files\LibUSB-Win32\lib\msvc\libusb.lib" usb.lib
35cp "C:\Program Files\LibUSB-Win32\include\usb.h" .
36set RUBYOPT=
37C:\usr\local\bin\ruby extconf.rb
38make
39make install
40
41== Copy the libs back to your official ruby (the one from Ruby one-click installer)
42cp C:\usr\local\lib\ruby\site_ruby\1.8\usb.rb C:\ruby\lib\ruby\site_ruby\1.8\usb.rb
43cp C:\usr\local\lib\ruby\site_ruby\1.8\i386-msvcrt\usb.so C:\ruby\lib\ruby\site_ruby\1.8\i386-msvcrt
44
45== Test that it works in your official ruby
46> irb
47irb(main):001:0> require 'usb'
48=> true
49irb(main):002:0> puts USB.devices.inspect
50[#<USB::Device bus-0/\\.\libusb0-0001--0x0a5c-0x2110 0a5c:2110 Broadcom Corp BCM2045B ? (Bluetooth)>, #<USB::Device bus-0/\\.\libusb0-0002--0x0483-0x2016 0483:2016 STMicroelectronics Biometric Coprocessor ? (Vendor specific (00,00))>]
toggle raw diff