Bon je viens de passer tout mon samedi soir à finir l'installeur pour PL/R sous Windows. J'ai pour celà suivi les instructions de Joseph E Conway à http://www.joeconway.com/plr/doc/plr-install.html.
L'installeur est disponible depuis mon site à http://www.davidgis.fr/download/plr-8.2.0.4_0_win32.exe
Pour celà , j'ai utilisé Inno Setup comme j'avais fait pour PgRouting. Le plus dur a été de pouvoir détecter si une version de R était déja installé sur l'ordi. Bon j'ai essayé d'aller vite. Il était déjà 9h00 du matin dimanche quand je me suis couché! Finalement j'ai réussi. Je me suis juste focalisé sur la détection de la librairie R.dll. La détection se fait en utilisant RegQueryStringValue(). Pour le reste, j'ai ensuite une première fois utiliser la fonctionnalité RegWriteSringValue() pour forcer l'utilisation de la variable R_HOME.
Posté vers 9h00 ce matin sur la mailing-list de PostGIS, Obe Regina nous a renvoyé un lien pour expliquer un peu mieux R, PL/R et par la suite fournir des exemples d'utilisation en conjonction avec PostGIS. Sa page est http://www.bostongis.com/PrinterFriendly.aspx?content_name=postgresql_plr_tut01. Quelle réactivité intéressante!!!
Pour mémo, voici donc le contenu de mon script sous ISS
Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[Setup]
AppName=PL/R for PostgreSQL
AppVerName=PgRouting 1.0.0.a
AppPublisher=Jean David TECHER - contributor for pgrouting
AppPublisherURL=http://pgrouting.postlbs.org/
AppSupportURL=http://pgrouting.postlbs.org/
AppUpdatesURL=http://pgrouting.postlbs.org/
DefaultDirName=C:\Program Files\PostgreSQL\8.2
DefaultGroupName=PgRouting
DisableProgramGroupPage=yes
LicenseFile=C:\msys\1.0\home\david\routing\COPYING
InfoBeforeFile=C:\PostgreSQL\8.2.4\plr\infobeforeinstall.txt
InfoAfterFile=C:\PostgreSQL\8.2.4\plr\infoafterinstall.txt
OutputDir=C:\PostgreSQL\8.2.4\plr
OutputBaseFilename=plr-8.2.0.4_0_win32
Compression=lzma
SolidCompression=yes
WizardImageFile=C:\PostgreSQL\8.2.4\plr\elephant.bmp
WizardSmallImageFile=C:\PostgreSQL\8.2.4\plr\elephant-logo.bmp
ChangesEnvironment=true
[Languages]
Name: english; MessagesFile: compiler:Default.isl
[Files]
Source: C:\PostgreSQL\8.2.4\plr\doc\contrib\README.plr; DestDir: {app}\doc\contrib; Flags: ignoreversion
Source: C:\PostgreSQL\8.2.4\plr\lib\*; DestDir: {app}\lib; Flags: ignoreversion
Source: C:\PostgreSQL\8.2.4\plr\share\contrib\*; DestDir: {app}\share\contrib\; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Code]
var RRealPath: String;
function InitializeSetUp():Boolean;
var myPATH : String;
var RGoodVersion: String;
begin
Result := false;
RGoodVersion :='2.5.0';
RegQueryStringValue(HKEY_LOCAL_MACHINE,'SOFTWARE\R-core\R','InstallPath',RRealPath);
if FileExists(AddBackslash(RRealPath)+'\bin\R.dll') then
RegQueryStringValue(HKEY_LOCAL_MACHINE,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment','Path',myPATH);
if FileExists(AddBackslash(RRealPath)+'\bin\R.dll') then
if MsgBox('NOTES: It seems that R is installed in this computer at '+ RRealPath +'. I will setup the R_HOME variable environment i.e. [ R_HOME = '+RRealPath + ' ] during installation and add it to your PATH after installation. These software must me install with PostgreSQL 8.2.X and where you have installed it. Would you like to continue anyway?',mbError,MB_YESNO)= idNO
then exit;
else RegWriteStringValue(HKEY_LOCAL_MACHINE,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment','R_HOME',RRealPath);
if FileExists(AddBackslash(RRealPath)+'\bin\R.dll') then
RegWriteStringValue(HKEY_LOCAL_MACHINE,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment','Path',AddBackslash(myPATH)+';'+RRealPath+'\bin');
if not FileExists(AddBackslash(RRealPath)+'\bin\R.dll') then
if MsgBox('It seems that R is not installed in this computer, please install it from ttp://cran.cict.fr/bin/windows/base/R-2.5.0-win32.exe',mbError,MB_DEFBUTTON2)=IDOK
then exit;
Result := true;
end;
[Icons]
Name: {group}\{cm:UninstallProgram,PL/R}; Filename: {uninstallexe}
[Registry]
Root: HKLM; Subkey: SYSTEM\CurrentControlSet\Control\Session Manager\Environment; ValueType: expandsz; ValueName: PATH; ValueData: "{olddata};{app}\bin;{app}\lib"