From: Adam Shelly Date: 2006-03-16T11:43:56+09:00 Subject: Re: How to compile Ruby on Windows ------=_Part_72_16311505.1142477020658 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 3/15/06, Glenn Smith wrote: > I think what would be nice to achieve from all this is that when Matz and > his gang release a new version of Ruby, somebody could either take this c= ode > and compile it using a HOW-TO, or for people who don't want to have the > hassle, quickly download a pre-compiled version. This doesn't have to be > anything fancy, such as Curt's installer, just a zip-file which you extra= ct > and there you are - a basic c:\ruby structure (or wherever). Perhaps a > short PDF or HTML file in the root with a "getting started". It might be > sensible to try to get rubygems integrated into this somehow but maybe no= t > immediately. Ok here's my contribution - I hope it is helpful: I don't know what to do except follow Wilson's instructions if you don't already have a working compiler. But if you already have a commercial VisualStudio .NET, there should already be a vsvars32.bat under ...\Common7\Tools. There will probably also be a shortcut to it called "Visual Studio Command Prompt" in the program menu under VisualStudio .Net Tools. So to compile ruby for yourself: 1) Download and unzip the ruby source 2) run vsvars.bat 3) then in that command prompt run the attached batch file >buildruby.bat SOURCE_DIR [ INSTALL_DIR [ BUILD_DIR ] ] where SOURCE_DIR is the path to the source (\Ruby-1.8.4 if you got the latest stable version) and INSTALL_DIR is the location you want ruby to go. They must be different directories. The intermediate files go into BUILD_DIR, which defaults to INSTALL_DIR/Build if you don't specify it. All these paths can be absolute or relative. SOURCE_DIR must exist and contain ruby source, but the other two will be created if they don't exist. 4) change to INSTALL_DIR and type ruby -v. Tada! This is tested with Visual Studio .NET and Visual Studio .NET 2003, on Windows XP and Windows 2000. Please let me know if you find any issues with it. I'd especially like to know if it works after following Wilson's instructions to the point of creating vsvars.bat. -Adam ------=_Part_72_16311505.1142477020658 Content-Type: application/octet-stream; name=buildruby.batch Content-Transfer-Encoding: 7bit X-Attachment-Id: f_ekuhawwf Content-Disposition: attachment; filename="buildruby.batch" @echo off REM -- buildruby.bat REM -- by Adam Shelly REM -- Builds Ruby from source, with Microsoft VisualStudio .NET REM -- Tested on Windows XP and Windows 2000, with VS .NET and VS .NET 2003 IF "%1" == "" goto exitusage set SDIR=%1 IF "%2" == "" ( SET IDIR=%CD% ) ELSE ( SET IDIR=%2 ) IF "%3" == "" ( SET BDIR=%IDIR%\Build ) ELSE ( SET BDIR=%3 ) IF NOT EXIST "%SDIR%" goto exitmissing IF NOT EXIST "%SDIR%\win32\configure.bat" goto exitmissing IF NOT EXIST "%IDIR%" MKDIR %IDIR% IF NOT EXIST "%BDIR%" MKDIR %BDIR% for %%D in (%SDIR%) DO set SDIR=%%~fsD for %%E in (%IDIR%) DO set IDIR=%%~fsE IF %IDIR% == %SDIR% goto exitsamedir SET IDIR=%IDIR:\=/% pushd %BDIR% call %SDIR%\win32\configure.bat nmake if NOT %ERRORLEVEL == 0 goto exiterror nmake test if NOT %ERRORLEVEL == 0 goto exiterror nmake DESTDIR=%IDIR% install if NOT %ERRORLEVEL == 0 goto exiterror goto exitbat :exitusage echo USAGE: %0 SOURCE_DIR [ INSTALL_DIR [ BUILD_DIR ] ] echo - echo builds the ruby code located in SOURCE_DIR echo puts results to INSTALL_DIR (default=.) echo performs build in BUILD_DIR (default=INSTALL_DIR\build) exit /b 1 :exitmissing echo ERROR: %SDIR% not found, or win32\configure.bat is not present there exit /b 2 :exitsamedir echo ERROR: SOURCE_DIR cannot be the same as INSTALL_DIR (%SDIR%) exit /b 3 :exiterror echo error in nmake: %ERRORLEVEL% :exitbat popd exit /b ------=_Part_72_16311505.1142477020658--