[Wxruby-users] README.mingw32

Gour gour at mail.inet.hr
Fri Aug 22 16:03:45 EDT 2003


Hello to all!

Since nobody replied and expressed desire to take over README.mingw32, I
wrote short instructions how to build wxruby with MinGW compiler in MSYS
environment.

Considering that wxruby can be of interest to some Ruby users not so
familiar with C++ and/or wxWindows (I'm one of them :-), I included some
notes on installing MinGW & MSYS, building wxWindows library, Ruby ..

If you feel that something has to be added or removed, please feel free
to do so.

Tomorrow I'm leaving the town and proceesing to the coast (finally) and
won't be back until 1st of Sept, so I'll probably miss the official
release, but certainly I'll be with all of you celebrating 1st birthday
of wxruby.

All the best!

Sincerely,
Gour


--------------------- cut-here --------------------------------------

Wxruby with MinGW/MSYS


This file describes how to build wxruby extension library with MinGW
compiler in MSYS environment.


Introduction
=============

Since wxruby bindings can be interesting for those Ruby users not so
familiar with building & using wxWindows and/or C++, we'll provide
instructions to build wxruby bindings using free MinGW compiler and
using MSYS environment.  (for more info about MinGW & MSYS, see MinGW
FAQ on: http://www.mingw.org/mingwfaq.shtml)


Prerequisites
==============

In order to build wxruby library you need:

* MinGW package available on: http://www.mingw.org/download.shtml (I use 
  MinGW-3.0.0-rc4.exe)

* MSYS package available on http://www.mingw.org/download.shtml (I use
  MSYS-1.0.9.exe package)

* wxWindows from Windows package available on http://www.wxwindows.org (I
  use wxMSW-2.4.1-setup.zip archive

* Ruby (I built my own version from the ruby-1.8.0.tar.gz archive)

* wxruby package available on _________ (pls. add URL!!!)

Procedure
==========

1) Installing MinGW & MSYS

If you already have MinGW & MSYS installed, then skip to the step 2).

Download and install MinGW & MSYS package. (I recommend to install them
under separate directories, ie. on my computer MinGW is installed at
C:\MinGW and MSYS at C:\MSYS.)

2) Building wxWindows library

If you already have wxWindows library built, skip to the step 3).

* download and run wxWindows setup program to install wxWindows in e.g.
  C:\wx.

* set environment variable WXWIN to point to the installation directory
  of wxWindows, e.g. after running MSYS from the desktop, enter: 

export WXWIN=c:/wxwindows_directory 

(in my case: export WXWIN=C:/wx) 

Please, note to use forward slashes (/) instead of usual backslash (\)
in the path.

(I find convenient to put the line: 
  
export WXWIN=/wx 

in my C:\MSYS\1.0\etc\profile file, so that this environment variable is
always available when needed. Besides that, I also put the line

C:/wx  /wx

in my C:\MSYS\1.0\etc\fstab file, so that C:\wx directory is mapped to
/wx directory.)

* we'll build wxWindows library by using configure script, so you can
  follow wxWindows instructions for compiling wxWindows (section: Using
  configure) and invoke (within MSYS shell) configure (if you created build directory)
  as:

../configure --prefix=C:/MinGW --with-msw --enable-shared --enable-debug

which means to build wxWindows:

  a) under MinGW (--prefix=C:/MinGW) compiler tree (recommended), 
  
  b) using MSW toolkit (--with-msw), 

  c) to build shared (--enable-shared) library (although in wxWindows
  install file there is "--disable-shared" parameter!!)

  d) to build library with debug (--enable-debug) info (this is
  optional, you can omit this one if you don't need debug info)

After configure script finishes inspecting your system, you can check
the options written at the end and if everything is OK, run:

make

to compile the library and then:

make install 

to install library and header files under MinGW tree.

Depending on the usage of "--enable-debug" switch, after installing
wxWindows library, there should be wxmsw241(d).dll and wxmsw241(d).dll.a libraries
in C:\MinGW\lib.  (Libraries with "d" are the ones with debug info.)

3) Building Ruby

If you already have Mingw32 version of Ruby, skip to the step 4).

If you don't want to build your own version of Ruby, download MinGW32
version from

http://ftp.ruby-lang.org/pub/ruby/binaries/mingw/ 

and skip to the step 4).

(I built my own Ruby 1.8.0 from the source, so this is not tested!)

* download Ruby source archive and unpack it somewhere in your home
  directory (under MSYS shell) 

* invoke configure script:

  configure --prefix=C:/MinGW

  which will configure Ruby for installation under MinGW compiler tree.

* make & make install (with optional: make test) to build and install
  Ruby

* check with: "ruby -v" that you have working Ruby interpreter

(You can also check whether you have Ruby runtime libraries in
C:\MinGW\lib directory.)
 

4) Building wxruby

If you already have installed wxruby...well, what are you doing reading
this file :-)

* unpack wxruby sources in some directory

* cd src (to change to the source directory)

* ruby extconf.rb (to create Makefile)

The present extconf.rb contains line with assignment to $LIBS variable
(under /mingw32/ section) to include wxmsw241.dll library during the linking
phase.

However, if you built wxWindows with "-enable-debug" and therefore have
wxmsw241d.dll, then you need to replace the $LIBS line under /mingw32/
section with the following:

$LIBS += " -lwxmsw241d"

to link the proper library.

* copy wxruby.so (which is just built) to 

C:\MinGW\lib\ruby\site-ruby\1.8\i386-msvcrt\wxruby.so 

(the actual path will vary according to your setup.)

* now you can try some of the samples included in wxruby package. Enjoy :-)

Credits
========

I am thankful to Matz for giving us Ruby so that we can build wxruby at
all.

Thanks to Park Heesob who created 1st prototype of wxruby and thanks to
Kevin Smith to push further development of wxruby which brings us this
release.

There are many others who helped me in traversing the path for MinGW
build and big thank you for all of them.


Feedback
=========

If you have some suggestions how to improve this README file and/or
there are some mistakes which needs to be corrected, please drop me an
email (gour at mail.inet.hr).

Sincerely,
Gour

-- 
Gour
gour at mail.inet.hr
Registered Linux User #278493



More information about the wxruby-users mailing list