; Script generated by the My Inno Setup Extensions Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! ; My thanks to Robert Cowham for getting this installer ; started. Without him I doubt if I'd have bothered. TS 28/11/2002 [Setup] AppName=P4Perl: The Perforce API for Perl 5.6 AppVerName=P4Perl: Build 3.6001 for Perl 5.6 AppPublisher=Perforce Software AppPublisherURL=http://www.perforce.com AppCopyright=Copyright © 2001-2007 Perforce Software WindowVisible=yes AppSupportURL=http://public.perforce.com/guest/tony_smith/perforce/API/Perl/index.html AppUpdatesURL=http://public.perforce.com/guest/tony_smith/perforce/API/Perl/index.html DefaultDirName={code:P4LibDir} DisableProgramGroupPage=yes DirExistsWarning=no DisableDirPage=yes SourceDir=. OutputDir=..\current OutputBaseFilename=p4perl56-setup [Files] Source: "blib\arch\auto\P4\P4.dll"; DestDir: "{code:P4AutoDir}"; Flags: overwritereadonly; Source: "blib\arch\auto\P4\P4.lib"; DestDir: "{code:P4AutoDir}"; Flags: overwritereadonly; Source: "blib\arch\auto\P4\P4.exp"; DestDir: "{code:P4AutoDir}"; Flags: overwritereadonly; Source: "blib\arch\auto\P4\P4.bs"; DestDir: "{code:P4AutoDir}"; Flags: overwritereadonly; Source: "blib\lib\auto\P4\autosplit.ix"; DestDir: "{code:P4AutoDir}"; Flags: overwritereadonly; Source: "blib\lib\P4.pm"; DestDir: "{code:P4LibDir}"; Flags: overwritereadonly; [Code] // This section is the Pascal script - various procedures called from above. program Setup; var SiteLibPath: String; PerlVersion: String; //--------------------------------------------------- // Called automatically at the start of initialization function InitializeSetup(): Boolean; var TempFile: String; Cmd: String; PerlBuildVer: String; Lines: TArrayOfString; i: Longint; ResultCode: Integer; begin Result := false; // Make sure Perl is installed and work out where to copy library // Version of Perl we're looking for PerlBuildVer := '5.6'; // Temp file where we put our output. Must escape the backslashes. TempFile := GenerateUniqueName(GetTempDir(), '.txt'); StringChange( TempFile, '\', '\\' ); // // Some fiddling to find appropriate way to get output - straight piping didn't seem to work. // We use Perl's Config.pm module to figure out where to put the files. // // Note: use qq() to do single quotes inside the Pascal quotes. It also saves us // having to escape the \'s in the file path as well as saving us from horrible // multiple quotes (e.g. '''' ) // Cmd := '"use Config; '; Cmd := Cmd + 'open( FH, qq(>' + TempFile + ')) or die( qq(Failed to write temp file));'; Cmd := Cmd + 'print( FH qq(SiteLib=), $Config{ qq(sitelib) }, qq(\n) );'; Cmd := Cmd + 'print( FH qq(Version=), $Config{ qq(version) }, qq(\n) );'; Cmd := Cmd + 'close( FH );'; Cmd := Cmd + '"'; Cmd := '-e ' + Cmd; if not Exec('perl.exe', Cmd, GetTempDir(), 0, ewWaitUntilTerminated, ResultCode) then begin MsgBox('Can''t find perl.exe in your path - Perl doesn''t seem to be installed.' + #13#13 'Please fix this and try again!', mbError, MB_OK); end else begin if not LoadStringsFromFile(TempFile, Lines) then begin MsgBox('Error loading strings '' from file.', mbError, MB_OK); end else begin // Extract the SiteLib path from the file for i := 0 to GetArrayLength( Lines ) - 1 do begin if ( Pos( 'SiteLib=', Lines[ i ] ) = 1 ) then begin SiteLibPath := Lines[ i ]; StringChange( SiteLibPath, 'SiteLib=', '' ); end; if ( Pos( 'Version=', Lines[ i ] ) = 1 ) then begin PerlVersion := Lines[ i ]; StringChange( PerlVersion, 'Version=', '' ); end; end; if ( Length( SiteLibPath ) > 0 ) then begin Result := true end else begin MsgBox('Unable to determine Perl sitelib directory', mbError, MB_OK); end; if ( Length( PerlVersion ) > 0) then begin if ( Pos( PerlBuildVer, PerlVersion ) <> 1 ) then begin MsgBox( 'Incorrect Perl Version. This installer is for Perl ' + PerlBuildVer + '. You appear to be running Perl ' + PerlVersion + '. If you have more than one Perl installed, check your ' + 'PATH environment variable and make sure that Perl ' + PerlBuildVer + ' is first in the PATH.', mbError, MB_OK ); Result := false; end; end; end; DeleteFile(TempFile); end; end; function P4LibDir(Default: String): String; begin Result := SiteLibPath; end; function P4AutoDir(Default: String): String; begin Result := SiteLibPath + '\\auto\\P4'; end; begin end.