Path: | doc/windows_install.rdoc |
Last Update: | Sat Apr 21 15:53:17 -0400 2007 |
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, you‘ll want to create a directory for the DLLs and copy the .dll file from the lib subdirectory of each extracted component there (except SDL_gfx, as noted above). We‘ll use a new directory, C:\dlls\. Add this location to your system PATH — Windows searches the PATH for libraries as well as executables.
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 Subversion 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, and ’\dlls’ (line 10) with the path where you put the DLLs.
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=ld -shared set LINK_FLAGS=-L \dlls -lSDL set LIBRUBYARG_SHARED=-L #{TOPDIR}/bin -l$(RUBY_SO_NAME) set RUBYGAME_CONFIG=--no-sdl-config
IMPORTANT: If you are missing an optional library (such as SDL_gfx), you need to add some extra flags on to the ‘RUBYGAME_CONFIG=…’ line. The flags you must add are of the style ’—no-????’ (without quotes), where ???? is the name of the missing library, dropping the ‘SDL_’ from in front. So, if you don‘t have SDL_gfx, the last line of your envsetup.bat should be this:
set RUBYGAME_CONFIG=--no-sdl-config --no-gfx
Open a command prompt and navigate to the root of your Rubygame source directory. Type:
envsetup.bat rake install
Congratulations! 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 these instructions.)