Readme for ruby_qt2_devel 
September 5, 2002
1. What's this?
This package includes all files necessary to develop  Ruby/Qt (v.2.x ) A version for Qt ver 1.4x is also available. (http://sfns.u-shizuoka-ken.ac.jp/geneng/horie_hp/ruby/index.html).  Using this package, you can import new functions of Qt library to Ruby/Qt.  
From ver.0.14, Windows support is added.  This package can generate source codes for Windows version of Ruby/Qt2.  You will need Linux to generate source codes for Windows version of Ruby/Qt2, and you can compile it on Windows system.

2. What do you need to use this package.
You will need ...
a. swig1.3.13.tar.gz, SWIG (http://www.swig.org/). It includes the ruby module for SWIG. (SWIG1.3.14  is already released, but this package is not support SWIG v.1.3.14.  Please, use v.1.3.12-v1.3.13
b. ruby (I used ruby-1.6.7.tar.gz in http://www.ruby-lang.org/ja/ )
c. Qt library (qt-x11-2.x.x.tar.gz)
If you want to use Windows version of Ruby/Qt2, it is available from Troll Tech Home Page.

e. MS Visual C++ v.6 if you use Ruby/Qt2 in under Windows.

3. How to install files necessary to use this package.
3-a. Install of ruby and Qt-lib 
Please install ruby and Qt library in ordinary way as described README or INSTALL etc.  
I used Qt patches for Japanese in http://www.kde.gr.jp.  If you use original Qt and get some troubles in compiling etc., please inform me. 
3-b. Install of SWIG
Follow INSTALL or README file provided with a SWIG package.
4. How to make Ruby/Qt
After define QTDIR to the directory where Qt-lib(ver 2.xx) is installed, in the directory where you extract ruby-qt2 package, execute following commands:
ruby setup.rb config
ruby setup.rb setup
(Change to root if necessary)
ruby setup.rb install
To compile each module, in the directory containing extconf.rb, execute...
make -f Makefile.ruby_qt2 swigall
and
make
makes module file such as qt2.so.

To make a source file for Windows version of Ruby/Qt2, in ruby-qt2-devel-0.xx/packages/qt2/ext/qt2,  execute...
make qt2_wrap_win.cpp -f Makefille.rubyqt2
Replace source file for qt2.so (qt2_wrap.cpp) in the source package for Windows (ruby-qt2-0.xxmswin32.lzh) with qt2_wrap_win.cpp and compile to make qt2.so.  
After install, please comfirm *.so or *.rb files were copied to appropriate directories, such as /usr/local/lib/ruby/site-ruby/1.6/i386-linux. (It's depend on your environment and ruby version)
5. How to add functions to Ruby/Qt
This package includes *.i files that define interface between Qt-lib and ruby.  So adding some lines to this file, you can easily import new function from Qt-lib to ruby.  Please refer to SWIG.pdf in SWIG package to write *.i files.
To import overloaded functions of Qt-lib to ruby, I modified names by %name() directive in *.i files (Because SWIG does not have a feature to import overloaded functions).  However, you can write wrapper functions for overloaded functions.  Please see a constructor of QPixmap in qpixmap.i for example.  
The procedure to modify *.i is as follows:
1.  Modify some *.i file.
2.  Modify qt2.i and Makefile.ruby_qt2 files if necessary.
3.  make qt2_wrap.cc file by entering "make qt2_wrap.cpp" and compile it.
If you get some errors in making qt2_wrap.cc or compiling, modify qt2_wrap.cpp directly and make qt2.diff file by entering
make qt2.diff
command.  Then make qt2_wrap.cpp file again.
Next time, the modification will automatically apply to the qt2_wrap.cpp file.

6. Acknowledgments
I thank the authors of Ruby and SWIG and ruby module of SWIG. 

Have a fun!

**************************************
Nobuyuki Horie, Ph.D.
Lab. Genetic Engineering/Univ. of Shizuoka
mail: horie@smail.u-shizuoka-ken.ac.jp
home page: http://www.u-shizuoka-ken.ac.jp

