; Version No is currently @PACKAGE_VERSION@ ; Check before use [Setup] AppName=libSBML AppVerName=libSBML @PACKAGE_VERSION@ AppPublisher=SBML Team AppPublisherURL=http://sbml.org AppSupportURL=http://sbml.org AppUpdatesURL=http://sbml.org DefaultDirName={pf}\SBML\libSBML-@PACKAGE_VERSION@-libxml2-x86 DefaultGroupName=libSBML DisableProgramGroupPage=yes OutputDir=.\Output OutputBaseFilename=libSBML-@PACKAGE_VERSION@-win-x86 WizardSmallImageFile=.\graphics\libsbml-installer-mini-logo.bmp WizardImageFile=.\graphics\libsbml-installer-graphic.bmp UsePreviousAppDir=no Compression=lzma SolidCompression=yes [Languages] Name: english; MessagesFile: compiler:Default.isl [Files] Source: @CURRENT_DIR@\libsbml\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs Source: @CURRENT_DIR@\libsbml\bindings\java\*; DestDir: {code:GetJavaDir}; Flags: ignoreversion recursesubdirs createallsubdirs; Check: GetJava Source: @CURRENT_DIR@\libsbml\bindings\csharp\*; DestDir: {code:GetCSharpDir}; Flags: ignoreversion recursesubdirs createallsubdirs; Check: GetCSharp Source: @CURRENT_DIR@\libsbml\bindings\perl\Libsbml.pm; DestDir: {code:GetPerlLibDir}; Flags: ignoreversion recursesubdirs createallsubdirs; Check: GetPerl Source: @CURRENT_DIR@\libsbml\bindings\perl\Libsbml.pod; DestDir: {code:GetPerlLibDir}; Flags: ignoreversion recursesubdirs createallsubdirs; Check: GetPerl Source: @CURRENT_DIR@\libsbml\bindings\perl\Libsbml.dll; DestDir: {code:GetPerlAutoDir}; Flags: ignoreversion recursesubdirs createallsubdirs; Check: GetPerl [Registry] Root: HKCU; Subkey: Software\SBML; Flags: uninsdeletekeyifempty Root: HKCU; Subkey: Software\SBML\libSBML; Flags: uninsdeletekey Root: HKLM; Subkey: Software\SBML; Flags: uninsdeletekeyifempty Root: HKLM; Subkey: Software\SBML\libSBML; Flags: uninsdeletekey Root: HKLM; Subkey: Software\SBML\libSBML; ValueType: string; ValueName: Version; ValueData: @PACKAGE_VERSION@ Root: HKLM; Subkey: Software\SBML\libSBML; ValueType: string; ValueName: InstallPath; ValueData: {app} [Code] var InstallOptionsPage: TInputOptionWizardPage; CSharpPage: TInputDirWizardPage; JavaPage: TInputDirWizardPage; URLLabel: TNewStaticText; AboutButton, CancelButton: TButton; PerlPresent: Boolean; PerlVersion: String; PerlRoot: String; PreviousInstalledVersion, ThisVersion: String; libSBMLPresent: Boolean; {function to return version number stored in registry} function GetVersion(): String; var Vers:String; Key: String; begin Key := ''; Key := Key + 'Software\SBML\libSBML\'; RegQueryStringValue(HKLM, Key, 'Version', Vers); Result := Vers; end; {function to return perl dir directory} function GetInstalledPerlDir(S : String): String; var Root:String; Key: String; begin Key := ''; Root := ''; PerlVersion := ''; Key := Key + 'Software\ActiveState\ActivePerl\'; if RegQueryStringValue(HKLM, Key, 'CurrentVersion', PerlVersion) then begin PerlPresent := True; Key := 'Software\ActiveState\ActivePerl\' + PerlVersion +'\'; if not RegQueryStringValue(HKLM, Key, '', Root) then begin PerlPresent := False; end; end else begin PerlPresent := False; end; Result := Root; end; function GetJavaDir(Param: String): String; begin { Return the selected DataDir } Result := JavaPage.Values[0]; end; function GetPerlLibDir(Param: String): String; begin Result := PerlRoot + 'lib'; end; function GetPerlAutoDir(Param: String): String; begin Result := PerlRoot + 'lib\auto\LibSBML'; end; {function to check whether a preinstalled version number is later than the current installation returns 1 is the version installed is later than this version 0 if the version installed equals this version -1 if the version installed is earlier than this version} function LaterVersion(VersionNo, CurrentVers : String) : Integer; var First, Second, Third: Longint; CurrentFirst, CurrentSecond, CurrentThird: Longint; Later, nTemp, nCurrent : Integer; begin if (VersionNo = '') then begin First := 0; Second := 0; Third := 0; end else begin nTemp := 1; nCurrent := nTemp; while (StrGet(VersionNo, nCurrent + nTemp - 1) <> '.') and (nTemp < Length(VersionNo)) do begin nTemp := nTemp + 1 end; First := StrToInt(Copy(VersionNo, nCurrent, nTemp -1 )); nCurrent := nTemp + 1; nTemp := 1; while (StrGet(VersionNo, nCurrent + nTemp - 1) <> '.') and (nTemp < Length(VersionNo)) do begin nTemp := nTemp + 1 end; Second := StrToInt(Copy(VersionNo, nCurrent, nTemp -1)); if (Length(VersionNo) > 3) then begin nCurrent := nTemp + 1; nTemp := 1; while (StrGet(VersionNo, nCurrent + nTemp - 1) <> '.') and (nTemp < Length(VersionNo)) do begin nTemp := nTemp + 1 end; Third := StrToInt(Copy(VersionNo, nCurrent, nTemp -1)); end else begin Third := 0 ; end; end; nTemp := 1; nCurrent := nTemp ; while (StrGet(CurrentVers, nCurrent + nTemp - 1) <> '.') and (nTemp < Length(CurrentVers)) do begin nTemp := nTemp + 1 end; CurrentFirst := StrToInt(Copy(CurrentVers, nCurrent, nTemp -1)); nCurrent := nTemp + 1; nTemp := 1; while (StrGet(CurrentVers, nCurrent + nTemp - 1) <> '.') and (nTemp < Length(CurrentVers)) do begin nTemp := nTemp + 1 end; CurrentSecond := StrToInt(Copy(CurrentVers, nCurrent, nTemp -1)); nCurrent := nTemp + 1; nTemp := 1; while (StrGet(CurrentVers, nCurrent + nTemp - 1) <> '.') and (nTemp < Length(CurrentVers)) do begin nTemp := nTemp + 1 end; CurrentThird := StrToInt(Copy(CurrentVers, nCurrent, nTemp -1 )); if (First > CurrentFirst) then begin Later := 1; end else if ((First = CurrentFirst) and (Second > CurrentSecond)) then begin Later := 1; end else if ((First = CurrentFirst) and (Second = CurrentSecond) and (Third > CurrentThird)) then begin Later := 1; end else if ((First = CurrentFirst) and (Second = CurrentSecond) and (Third = CurrentThird)) then begin Later := 0; end else begin Later := -1; end; Result:= Later; end; {functions to activate buttons and url on screen} procedure AboutButtonOnClick(Sender: TObject); begin {********************************************************************************************************* The text for this message box is what the user will see if they click the About button during installation Feel free to alter it to taste but beware it must all be on one line. Note: it includes a version number **********************************************************************************************************} MsgBox('This setup installs the Windows version of libSBML @PACKAGE_VERSION@ built using the libxml2 2.7.3 XML Parser library. All the necessary libraries are included. The source code is available as a separate download.', mbInformation, mb_Ok); end; {send to url} procedure URLLabelOnClick(Sender: TObject); var Dummy: Integer; begin ShellExec('open', 'http://www.sbml.org', '', '', SW_SHOW, ewNoWait, Dummy); end; procedure InitializeWizard; begin {get data from system} PreviousInstalledVersion := GetVersion(); ThisVersion := '@PACKAGE_VERSION@'; PerlRoot := GetInstalledPerlDir(''); if (PreviousInstalledVersion = '') then begin libSBMLPresent := False; end else begin libSBMLPresent := True; end; {add an about button and a url to all pages} {need a cancel button to locate other} CancelButton := WizardForm.CancelButton; AboutButton := TButton.Create(WizardForm); AboutButton.Left := WizardForm.ClientWidth - CancelButton.Left - CancelButton.Width; AboutButton.Top := CancelButton.Top; AboutButton.Width := CancelButton.Width; AboutButton.Height := CancelButton.Height; AboutButton.Caption := '&About...'; AboutButton.OnClick := @AboutButtonOnClick; AboutButton.Parent := WizardForm; URLLabel := TNewStaticText.Create(WizardForm); URLLabel.Top := AboutButton.Top + AboutButton.Height - URLLabel.Height - 2; URLLabel.Left := AboutButton.Left + AboutButton.Width + 20; URLLabel.Caption := 'www.sbml.org'; URLLabel.Font.Style := URLLabel.Font.Style + [fsUnderLine]; URLLabel.Font.Color := clBlue; URLLabel.Cursor := crHand; URLLabel.OnClick := @URLLabelOnClick; URLLabel.Parent := WizardForm; { Create the pages } { install options : custom install possible settings } InstallOptionsPage := CreateInputOptionPage(wpSelectDir, 'Choose bindings to install or copy to other locations', '', 'Select the bindings', False, False); InstallOptionsPage.Add('Copy C# language interface'); InstallOptionsPage.Add('Copy Java language interface'); InstallOptionsPage.Add('Install MATLAB language interface'); InstallOptionsPage.Add('Install Perl language interface'); { java page : location to install java binding } JavaPage := CreateInputDirPage(InstallOptionsPage.ID, 'Java binding', '', 'Select the folder in which Setup should install Java binding files, then click Next.', False, ''); JavaPage.Add(''); { csharp page : location to install csharp binding } CSharpPage := CreateInputDirPage(InstallOptionsPage.ID, 'C Sharp binding', '', 'Select the folder in which Setup should install C# binding files, then click Next.', False, ''); CSharpPage.Add(''); end; function ShouldSkipPage(PageID: Integer): Boolean; begin { Skip pages that shouldn't be shown } if (PageID = JavaPage.ID) and (InstallOptionsPage.Values[1] = False) then Result := True else if (PageID = CSharpPage.ID) and (InstallOptionsPage.Values[0] = False) then Result := True else Result := False; end; function NextButtonClick(CurPageID: Integer): Boolean; var Later: Integer; begin { Validate certain pages before allowing the user to proceed } if CurPageID = wpWelcome then begin if (libSBMLPresent) then begin Later := LaterVersion(PreviousInstalledVersion, ThisVersion); if (Later = 0) then begin MsgBox('This version of libSBML has already been installed on the system', mbInformation, mb_Ok); end else if (Later = 1) then begin MsgBox('A later version of libSBML has already been installed on the system', mbInformation, mb_Ok); end else begin MsgBox('An earlier version of libSBML has already been installed on the system. Files may be overwritten.', mbInformation, mb_Ok); end; end; Result := True; end else if CurPageId = InstallOptionsPage.ID then begin JavaPage.Values[0] := ExpandConstant('{app}/bindings/java'); CSharpPage.Values[0] := ExpandConstant('{app}/bindings/csharp'); if ((InstallOptionsPage.Values[3]) and ((not PerlPresent) or (PerlVersion < '1200'))) then begin MsgBox('Libsbml Perl bindings require Perl 5.12 which cannot be detected on the system. Cannot install to the lib directory.', mbError, MB_OK); InstallOptionsPage.Values[3] := False; end; Result := True; end else begin Result := True; end; end; function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String; var S: String; begin { Fill the 'Ready Memo' with the normal settings and the custom settings } S := ''; S := S + MemoDirInfo + NewLine; S := S + NewLine; S := S + 'NOTE: all language binding files will be available in this location' + NewLine; S := S + NewLine; S := S + NewLine; S := S + 'The following additional language interface installation options have been selected' + NewLine; if (InstallOptionsPage.Values[0] = True) then begin S := S + NewLine; S := S + 'Writing libSBML C# library files (libsbmlcs.*) to ' + NewLine; S := S + ' ' + CSharpPage.Values[0]; S := S + NewLine; end; if (InstallOptionsPage.Values[1] = True) then begin S := S + NewLine; S := S + 'Writing libSBML Java library files (libsbmlj.*) to ' + NewLine; S := S + ' ' + JavaPage.Values[0]; S := S + NewLine; end; if(InstallOptionsPage.Values[2] = True) then begin S := S + NewLine; S := S + 'Installing libSBML MATLAB' + NewLine; S := S + NewLine; end; if (InstallOptionsPage.Values[3] = True) then begin S := S + NewLine; S := S + 'Writing libSBML perl library files to ' + NewLine; S := S + ' ' + GetPerlLibDir(''); S := S + NewLine; end; Result:= S; end; function GetJava() : Boolean; begin if (InstallOptionsPage.Values[1] = True) then Result := True else Result := False; end; function GetPerl() : Boolean; begin if (InstallOptionsPage.Values[3] = True) then Result := True else Result := False; end; function GetMatlab() : Boolean; begin if (InstallOptionsPage.Values[2] = True) then Result := True else Result := False; end; function GetCSharp() : Boolean; begin if (InstallOptionsPage.Values[0] = True) then Result := True else Result := False; end; function GetCSharpDir(Param: String): String; begin { Return the selected DataDir } Result := CSharpPage.Values[0]; end; [Run] Filename: "{app}\bindings\matlab\libSBML-@PACKAGE_VERSION@-win-matlab-x86.exe"; Check: GetMatlab;