<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Le Vosgien du Net &#187; sqlite</title>
	<atom:link href="http://levosgien.net/tag/sqlite/feed/" rel="self" type="application/rss+xml" />
	<link>http://levosgien.net</link>
	<description>Parce que la vérité n'est pas toujours bonne à dire</description>
	<lastBuildDate>Thu, 11 Feb 2010 18:39:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Ruby Installer 3.0 &#171;&#160;MinGW&#160;&#187; et SQLite 3</title>
		<link>http://levosgien.net/2008/08/13/ruby-installer-30-mingw-et-sqlite-3/</link>
		<comments>http://levosgien.net/2008/08/13/ruby-installer-30-mingw-et-sqlite-3/#comments</comments>
		<pubDate>Wed, 13 Aug 2008 15:56:34 +0000</pubDate>
		<dc:creator>Pierre</dc:creator>
				<category><![CDATA[Geekitude]]></category>
		<category><![CDATA[mingw]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[sqlite]]></category>

		<guid isPermaLink="false">http://levosgien.net/?p=105</guid>
		<description><![CDATA[	Il n&#8217;est pas possible d&#8217;installer le gem sqlite3-ruby requis par Rails 2.x pour faire fonctionner une application &#8220;par défaut&#8221; si on utilise la version MinGW32 de Ruby packagée dans le projet Ruby Installer 3.0 pour Windows.
	Alors il faut bidouiller un peu&#8230; en fait la modif est tellement simple qu&#8217;elle devrait pouvoir être intégrée directement à [...]]]></description>
			<content:encoded><![CDATA[	<p>Il n&#8217;est pas possible d&#8217;installer le gem sqlite3-ruby requis par Rails 2.x pour faire fonctionner une application &#8220;par défaut&#8221; si on utilise la version MinGW32 de Ruby packagée dans le projet <a href="http://rubyinstaller.rubyforge.org/wiki/wiki.pl?Mingw">Ruby Installer 3.0 pour Windows</a>.</p>
	<p>Alors il faut bidouiller un peu&#8230; en fait la modif est tellement simple qu&#8217;elle devrait pouvoir être intégrée directement à sqlite3-ruby ou à Ruby Installer puisqu&#8217;il sait d&#8217;ores et déjà récupérer des sources, les décompresser et les compiler lui-même&#8230;</p>
	<p>Moi, compiler, ça m&#8217;amuse, alors on y va, même pas peur !</p>
	<p><span id="more-105"></span></p>
	<ul>
		<li>Installez Ruby 1.8 avec le <a href="http://rubyforge.org/projects/rubyinstaller">Ruby One Click Installer</a></li>
		<li>Mettez Rake à jour</li>
	</ul>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gem update rake</pre></div></div>

	<ul>
		<li>Installez <a href="http://code.google.com/p/msysgit">MSysGit</a></li>
		<li>Ouvrez la console Bash GIT (clic droit sur un dossier quelconque depuis l&#8217;explorateur Windows : <em>Git Bash Here</em>)</li>
		<li>Clonez le dépôt de <a href="http://github.com/luislavena/rubyinstaller">RubyInstaller</a></li>
	</ul>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #7a0874; font-weight: bold;">source</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #7a0874; font-weight: bold;">source</span>
git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>luislavena<span style="color: #000000; font-weight: bold;">/</span>rubyinstaller</pre></div></div>

	<ul>
		<li>Construisez Ruby Installer 3.0</li>
	</ul>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> rubyinstaller
rake <span style="color: #007800;">CHEKCOUT</span>=<span style="color: #000000;">1</span>
rake package</pre></div></div>

	<ul>
		<li>Installez le package &#8216;devkit&#8217; qui est dans sous répertoire &#8220;pkg&#8221;</li>
	</ul>
	<ul>
		<li>Enlevez la variable d&#8217;environnement RUBYOPT (qui normalement vaut &#8217;&#8212;rubygems&#8217;)</li>
		<li>Modifiez la variable d&#8217;environnement PATH et changez &#8216;C:\Ruby&#8230;&#8217; en &#8216;C:\Ruby18&#8230;&#8217;</li>
		<li>Vérifiez en lancant Ruby depuis une console DOS</li>
	</ul>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">C:\<span style="color: #000000; font-weight: bold;">&gt;</span>ruby <span style="color: #660033;">--version</span>
ruby 1.8.6 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2008</span>-08-08 patchlevel <span style="color: #000000;">286</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>i386-mingw32<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

	<ul>
		<li>Tentez d&#8217;installer quelques gems</li>
	</ul>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gem <span style="color: #c20cb9; font-weight: bold;">install</span> rails 
gem <span style="color: #c20cb9; font-weight: bold;">install</span> capistrano
gem <span style="color: #c20cb9; font-weight: bold;">install</span> merb datamapper sequel 
gem <span style="color: #c20cb9; font-weight: bold;">install</span> fastercvs 
gem <span style="color: #c20cb9; font-weight: bold;">install</span> haml 
gem <span style="color: #c20cb9; font-weight: bold;">install</span> hpricot 
gem <span style="color: #c20cb9; font-weight: bold;">install</span> oniguruma 
gem <span style="color: #c20cb9; font-weight: bold;">install</span> ruport prawn 
gem <span style="color: #c20cb9; font-weight: bold;">install</span> ultraviolet 
gem <span style="color: #c20cb9; font-weight: bold;">install</span> thin</pre></div></div>

	<p>Mais le gem sqlite3-ruby, requis pour faire fonctionner une application Rails &#8220;par défaut&#8221; ne s&#8217;installera pas en version &#8220;native&#8221;, le gem étant préconfiguré pour les plateformes POSIX et même si l&#8217;installation de la version mswin32 est possible (avec l&#8217;option&#8212;platform mswin32), l&#8217;utiliser vous vaudra un message d&#8217;erreur disant que la version pour la plateforme &#8216;mswin32&#8217; n&#8217;est pas compatible avec la version &#8216;mingw32&#8217; qui est installée, d&#8217;autres gems comme mongrel, mongrel_cluster et d&#8217;autres dont la version native n&#8217;est pas installable mais qui sont livrés avec une version mswin32 précompilée fonctionnent.</p>
	<p>Donc il faut installer la version native. Mais elle ne compile pas. Alors il faut qu&#8217;elle compile&#8230; fastoche.</p>
	<ul>
		<li>Récupérez le code de sqlite3-ruby depuis GitHub</li>
	</ul>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #7a0874; font-weight: bold;">source</span>
git clone git:<span style="color: #000000; font-weight: bold;">//</span>github<span style="color: #000000; font-weight: bold;">/</span>jamis<span style="color: #000000; font-weight: bold;">/</span>sqlite3-ruby</pre></div></div>

	<ul>
		<li>Récupérez aussi les <a href="http://www.sqlite.org/sqlite-amalgamation-3_6_1.zip">Sources de SQLite3</a></li>
		<li>Décompressez les fichiers dans sqlite3-ruby\ext\sqlite3-api</li>
		<li>Récupérez la <a href="http://www.sqlite.org/sqlite-3_6_1.zip">DLL de SQLite3</a> précompilée pour Windows</li>
		<li>Décompressez les fichiers dans sqlite3-ruby\ext\sqlite3-api</li>
		<li>Compilez l&#8217;extension</li>
	</ul>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> sqlite3-ruby\ext\sqlite3-api
ruby extconf.rb
<span style="color: #c20cb9; font-weight: bold;">make</span></pre></div></div>

	<p>Là vous devriez voir apparaître un fichier (LE fichier !) sqlite3_api.so</p>
	<p>Ensuite, l&#8217;alternative : gem ou pas gem ?</p>
	<ul>
		<li><em>Gem</em> : commencez par changer Gem::Platform::WIN32 en Gem::Platform::CURRENT dans le fichier sqlite3-ruby-win32.gemspec (RubyGems a changé...)</li>
	</ul>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ..\..
<span style="color: #666666; font-style: italic;"># Vous devriez être dans 'source/sqlite3-ruby'</span>
gem build sqlite3-ruby-win32.gemspec
gem <span style="color: #c20cb9; font-weight: bold;">install</span> sqlite3-ruby-1.2.2-x86-mingw32.gem</pre></div></div>

	<p><strong>Attention !</strong> Le Gem généré est énorme (plus de 2Mo !), c&#8217;est parce qu&#8217;il embarque tous les fichiers qui sont dans le sous-répertoire ext. Pour bien faire il faudrait encore modifier le gemspec pour qu&#8217;il ne prenne que les fichiers utile (les sources sqlite3-api-wrap.c et sqlite3-api.so, peut-être sqlite3.dll mais certainement pas les .o ni les sources de sqlite, sqlite3.c, sqlite3.h et sqlite3ext.h)</p>
	<ul>
		<li><em>Pas Gem</em> : les fichiers seront installés directement dans l&#8217;arborescence des extensions natives de Ruby (C:\Ruby18\lib\site_ruby)</li>
	</ul>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Vous devriez être dans 'source/sqlite3-ruby'</span>
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

	<p>Voilà. Normalement vous avez de quoi utiliser SQLite3 !</p>

 ]]></content:encoded>
			<wfw:commentRss>http://levosgien.net/2008/08/13/ruby-installer-30-mingw-et-sqlite-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

