Path: | doc/windows_install.rdoc |
Last Update: | Thu Mar 12 22:45:15 -0400 2009 |
(For the most up-to-date version of this document, see the Rubygame wiki: rubygame.wiki.sourceforge.net/win32_compile)
This document gives some helpful guidelines to for compiling and installing Rubygame on Microsoft Windows. However, these instructions are not perfect, so they might not work for you. If you use this guide, we‘d love to hear about what worked and what didn‘t; just send a message to the rubygame-users mailing list!
The usual caveats apply: follow these instructions at your own risk and so forth. Please direct comments or questions to the Rubygame user's mailing list.
The rest are optional dependencies, but highly recommended. If you don‘t have them, you won‘t be able to use certain features of Rubygame.
Once you have downloaded everything, extract each archive into a convenient location on your hard drive. You‘ll thank yourself later if you use a short path with no spaces in it. For this example, we‘ll unzip everything under C:\src\.
Next, copy the *.dll file from each library‘s folder into C:\windows\system32\. This will allow the libraries to be detected properly later on.
If you haven‘t already, download the latest Rubygame source from the download page. If you‘re feeling adventurous, you could try the in-development code from the Git repository. You can decompress the .tar.bz2 file with either MSYS’ tar (tar xvjf rubygame-2.0.0.tar.bz2) or a program like 7zip.
Extract the source into another folder of your choice, such as C:\src\rubygame.
Environment variables are used to configure the build process for your system; it helps the compiler to locate the headers and libraries it needs to compile Rubygame.
Create a text file in your Rubygame directory called "envsetup.bat". In it, use code based on the following to set your variables. Be sure to replace ’\src\’ (lines 3-7) with the path to where you unpacked the libraries.
set CC=gcc set CFLAGS=-DHAVE_ISINF -D_MSC_VER=1200 set CFLAGS=%CFLAGS% -I \src\SDL-1.2.11\include set CFLAGS=%CFLAGS% -I \src\SDL_gfx-2.0.15 set CFLAGS=%CFLAGS% -I \src\SDL_image-1.2.5\include set CFLAGS=%CFLAGS% -I \src\SDL_mixer-1.2.7\include set CFLAGS=%CFLAGS% -I \src\SDL_ttf-2.0.8\include set LDSHARED=gcc -shared set LINK_FLAGS=-L \windows\system32 -lSDL set LIBRUBYARG_SHARED=-L \ruby\bin -lmsvcrt-ruby18
The -L parameter for LIBRUBYARG_SHARED may be different if you installed Ruby to a path other than C:/ruby.
Open a command prompt and navigate to the root of your Rubygame source directory. Type:
envsetup.bat rake install
IMPORTANT: If you are missing an optional library (such as SDL_gfx), you must disable optional features by passing a "no-???" command to rake before the word "install". For example, to disable features that depend on SDL_gfx, you would type this instead of the above:
envsetup.bat rake no-sdl-gfx install
If all goes well, you have built and installed Rubygame. Try to execute require ‘rubygame‘ in an irb session and run the provided samples to ensure that everything is acceptable.
(Thanks to Ash Wilson (smashwilson) for contributing the original version of these instructions.)