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