Tuesday, August 9, 2011

Clean installation Ruby 1.9.3 preview1 with MinGW and MSYS

My previous post is only applicable for overwriting onto existing ruby 1.9.x. But, if you want to install ruby 1.9.3 with MinGW and MSYS from zero, we need more instructions.

Set up MinGW and MSYS

At first, installing msysGit with msysGit-fullinstall-1.x.x-previewyyyymmdd.exe, not Git-1.x.x-previewyyyymmdd.exe, because full installer contains zlib.h, iconv.h and plenty of header files and libraries to need for building Ruby.

In this article, we install msysGit into C:\GNU\msysgit. Then rename C:\GNU\msysgit\etc\profile file to C:\GNU\msysgit\etc\profile.original.

Next, installing Ruby DevKit onto C:\GNU\msysgit. When installing, choose the "No to All" if the dialog about existing file pops-up.

At last, merge current C:\GNU\msysgit\etc\profile file and backed-up C:\GNU\msysgit\etc\profile.original file. then rename C:\GNU\msysgit\etc\fstab.sample file to C:\GNU\msysgit\etc\fstab

build libffi

At first, untar the source and patch it to both include/Makefile.am and include/Makefile.in. Next, build into /mingw
$ CFLAGS="-I/usr/include" LDFLAGS="-L/usr/lib" ./configure --prefix=/mingw --enable-shared

build libyaml

At first, untar the source and patch it to include/yaml.h. Next, build into /mingw
$ CFLAGS="-I/usr/include" LDFLAGS="-L/usr/lib" ./configure --prefix=/mingw --enable-shared

build ruby 1.9.3 preview1

At first, untar the source and build it. In this article, we install ruby 1.9.3 into C:\ruby-1.9.3.
$ CFLAGS="-I/usr/include" DLDFLAGS="-L/usr/lib" ./configure --prefix=C:/ruby-1.9.3 --enable-shared
At last, set C:\GNU\msysgit\mingw\bin, C:\GNU\msysgit\bin and C:\ruby-1.9.3\bin to %PATH% and execute dk.rb. Let's check that ruby, yaml and zlib totally work.
> ruby -v
ruby 1.9.3dev (2011-07-31 revision 32789) [i386-mingw32]
> gem list omniauth$ -r --all

*** REMOTE GEMS ***

omniauth (0.2.6, 0.2.5, 0.2.4, 0.2.3, 0.2.2, 0.2.1, 0.2.0, 0.1.6, 0.1.5, 0.1.4, 0.1.3, 0.1.2, 0.1.1, 0.1.0, 0.0.5, 0.0.4, 0.0.3, 0.0.1)

2 comments:

Post a Comment