How to install RUDL

# How to get and install RUDL

## Windows

This chapter may be outdated at any time.

### Binary

This explains how to get RUDL installed on Windows. Developers are advised to create a package with their program, SDL, and RUDL in it so end users won't have to install RUDL separately.

1. Grab One Click Ruby 1.8.x Installer if you don't have it. Install it. It might be necessary to reboot.
2. Alternatively, grab U. Nakamura's Visual C Ruby. It is reported to work.
3. Grab the latest binary RUDL setup version from the RUDL SourceForge files page
4. Unzip RUDL to a place you like.
5. Run install-on-windows.rb. We suggest copying the dll's to the Ruby bin dir when it asks for that.
6. Try one of the samples in the RUDL/samples directory.
7. That's it. If it doesn't run, contact us.

If you want to use another version of Ruby, you'll get trouble using RUDL. This is because the RUDL.so library is statically linked with msvcrt-ruby18.lib (or something of that kind) and that lib changes a lot between Ruby versions. This can be solved by downloading a lib-only RUDL, if it exists for your version. (If it doesn't, it can be created on request) You can put the RUDL.so in the directory where you unpacked the RUDL setup and rerun install-on-windows.

### Creating an installable version of your project

... to do.

### Source

Compiling from source could be useful for creating a smaller RUDL library that depends on less libraries.

RUDL is compiled with the Microsoft Visual C++ command line tools. If you don't have Visual Studio, it is possible to compile RUDL with tools that can be downloaded for free from Microsoft.

Set up your compiler with the instructions below, then proceed with the build instructions at the bottom of this page. If you don't want to download the latest SDL libraries, you can use the provided includes and libs, and the DLLs from the RUDL setup archive, and start from "ruby extconf.rb".

If you download the SDL libraries yourself, you should probably copy their binaries and includes into the corresponding RUDL directories.

#### Visual Studio

With Visual Studio, you only need to make sure its bin, include and lib paths are in the environment variables, and add RUDL's include and lib dirs. Example paths:

- PATH = C:\Program Files\VStudio\VC98\BIN
- INCLUDE = C:\Program Files\VStudio\VC98\Include; C:\rudl\include
- LIB = C:\Program Files\VStudio\VC98\Lib; C:\rudl\lib

Those are in addition to what's already in the variables, of course. In Windows 2000 or XP, you can edit them from Control Panel → System → Advanced → Environment Variables. You might have to reboot, or at least restart any command line prompts for the changes to take effect. Check them with the command `echo %PATH%`, etc.

#### Free tools

If you don't have Visual Studio, you will probably need all of the following:

- Microsoft Visual C++ Toolkit 2003 (the compiler itself)
- Microsoft Platform SDK (Core SDK)
- .NET Framework 1.1 SDK from msdn.microsoft.com
  - NOTE: RUDL doesn't use .NET, and the only reason to get this huge SDK seems to be to get MSVCRT.lib.
- MinGW32-make from the MinGW site (search for mingw32-make-*.exe)
  Install, rename mingw32-make.exe to nmake.exe and copy it somewhere on your command path.

You need to make sure that some environment variables are set up correctly. Here's a list of the variables, with default installation paths:

- PATH = C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin
- INCLUDE = C:\Program Files\Microsoft Visual C++ Toolkit 2003\include; C:\Program Files\Microsoft SDK\include; C:\rudl\include
- LIB = C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib; C:\Program Files\Microsoft SDK\lib; C:\rudl\lib

See the Visual Studio section above for tips on setting environment variables.

## Linux

You'll have to build it from source, as described below.

## Building from source

1. Download the latest RUDL source package from the RUDL SourceForge files page
2. Grab the developer versions of the following libraries for your platform:
   - SDL
   - SDL_gfx
   - SDL_image
   - SDL_mixer
   - SDL_ttf
   - SDL_net
   - smpeg
   - freetype (If Freetype 2 doesn't work, try 1)
   (You may need to download or compile the user binaries as well, if they're not included in the devel package.)

   Note that RUDL doesn't need everything, only the core SDL library.

   The libraries must be installed where the compiler can find them. Sometimes the rpm's have created symlinks from e.g. /usr/lib/libSDL.so to a nonexisting version, so you may need to fix them manually.

3. `ruby extconf.rb` in the RUDL root dir will look for the above-mentioned libraries and create a makefile with the libraries it finds.

   If it can't find some library that you have installed, you can try editing extconf.rb and uncommenting the $DEBUG flag. Make sure that the library binaries and includes are in the right locations. See also the generated `mkmf.log`

4. `make`
5. And now, as root: `make install`
   (on Windows, you need to run `ruby install-on-windows.rb` - it does the same as `make install` and then copies the SDL DLLs in place)

That's it. You can now try the samples.