Changeset 6 for trunk/UInstance.pas
- Timestamp:
- Feb 4, 2011, 9:45:01 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UInstance.pas
r5 r6 7 7 uses 8 8 Classes, SysUtils, USource, Contnrs, Process, Forms, Controls, 9 FileUtil ;9 FileUtil, Dialogs; 10 10 11 11 type … … 14 14 TInstance = class 15 15 private 16 function GetCompiled: Boolean; 16 17 function GetDownloaded: Boolean; 17 18 public 18 19 Id: Integer; 19 20 Name: string; 20 Compiled: Boolean;21 21 IDESource: TSource; 22 22 IDERevision: string; … … 27 27 procedure Build; 28 28 procedure Start; 29 procedure UpdateLazarusConfig; 30 procedure UpdateFPCConfig; 29 31 function GetPath: string; 30 32 property Downloaded: Boolean read GetDownloaded; 33 property Compiled: Boolean read GetCompiled; 31 34 end; 32 35 … … 56 59 { TInstance } 57 60 61 function TInstance.GetCompiled: Boolean; 62 begin 63 Result := FileExistsUTF8(GetPath + DirectorySeparator + FPCSource.ProjectShortName + 64 DirectorySeparator + 'bin' + DirectorySeparator + 65 MainForm.Platform + DirectorySeparator + FPCSource.GetExecutableFile); 66 if Assigned(IDESource) then Result := Result and 67 FileExistsUTF8(GetPath + DirectorySeparator + IDESource.ProjectShortName + 68 DirectorySeparator + IDESource.GetExecutableFile); 69 end; 70 58 71 function TInstance.GetDownloaded: Boolean; 59 72 begin … … 65 78 procedure TInstance.Build; 66 79 begin 67 OperationProgressForm.Environment := 'path=' + //GetEnvironmentVariable('PATH') + ';' + 68 MainForm.GetBinUtilsDir; 80 (*OperationProgressForm.Environment := 'path=' + MainForm.GetBinUtilsDir; 69 81 OperationProgressForm.Path := GetPath + DirectorySeparator + FPCSource.ProjectShortName; 70 OperationProgressForm.CommandLine := 71 '"' + MainForm.GetBinUtilsDir + DirectorySeparator + 'make.exe" clean all PP="' + 72 MainForm.GetBinUtilsDir + '"'; 82 OperationProgressForm.CommandLine := 'make all PP="' + 83 MainForm.GetBinUtilsDir + DirectorySeparator + 'fpc"'; 73 84 OperationProgressForm.ShowModal; 74 85 86 OperationProgressForm.Environment := 'path=' + MainForm.GetBinUtilsDir; 75 87 OperationProgressForm.Path := GetPath + DirectorySeparator + FPCSource.ProjectShortName; 76 OperationProgressForm.CommandLine := 77 '"' + MainForm.GetBinUtilsDir + DirectorySeparator + 'make.exe" install PREFIX="' + 88 OperationProgressForm.CommandLine := 'make install PREFIX="' + 78 89 GetPath + DirectorySeparator + FPCSource.ProjectShortName + '"' + 79 ' PP="' + MainForm.GetBinUtilsDir + '"';90 ' PP="' + MainForm.GetBinUtilsDir + DirectorySeparator + 'fpc"'; 80 91 OperationProgressForm.ShowModal; 92 *) 81 93 82 94 if Assigned(IDESource) then begin 95 OperationProgressForm.Environment := 'path=' + MainForm.GetBinUtilsDir; 83 96 OperationProgressForm.Path := GetPath + DirectorySeparator + IDESource.ProjectShortName; 84 97 OperationProgressForm.CommandLine := 85 ' "' + MainForm.GetBinUtilsDir + DirectorySeparator + 'make.exe"bigideclean bigide OPT="-Xg"';98 'make bigideclean bigide OPT="-Xg"'; 86 99 OperationProgressForm.ShowModal; 87 100 end; … … 94 107 if Assigned(IDESource) then 95 108 try 109 UpdateFPCConfig; 110 UpdateLazarusConfig; 96 111 Process := TProcess.Create(nil); 97 112 Process.CurrentDirectory := GetPath + DirectorySeparator + IDESource.ProjectShortName; 98 Process.CommandLine := IDESource.GetExecutableFile; 113 Process.CommandLine := GetPath + DirectorySeparator + IDESource.ProjectShortName + 114 DirectorySeparator + IDESource.GetExecutableFile + ' --primary-config-path=' + 115 GetPath + DirectorySeparator + IDESource.ProjectShortName + 116 DirectorySeparator + 'config'; 99 117 Process.Execute; 100 118 finally 101 119 Process.Free; 120 end; 121 end; 122 123 procedure TInstance.UpdateLazarusConfig; 124 var 125 Config: TStringList; 126 begin 127 try 128 Config := TStringList.Create; 129 Config.LoadFromFile(MainForm.GetBaseDir + DirectorySeparator + 130 MainForm.TemplateDir + DirectorySeparator + 'environmentoptions.xml'); 131 Config.Text := StringReplace(Config.Text, '%FPCDir%', GetPath + DirectorySeparator + FPCSource.ProjectShortName, [rfReplaceAll]); 132 Config.Text := StringReplace(Config.Text, '%BaseDir%', MainForm.GetBaseDir, [rfReplaceAll]); 133 Config.Text := StringReplace(Config.Text, '%LazarusDir%', GetPath + DirectorySeparator + IDESource.ProjectShortName, [rfReplaceAll]); 134 Config.Text := StringReplace(Config.Text, '%FPCPlatform%', MainForm.Platform, [rfReplaceAll]); 135 Config.Text := StringReplace(Config.Text, '%Temp%', GetEnvironmentVariableUTF8('Temp'), [rfReplaceAll]); 136 Config.SaveToFile(GetPath + DirectorySeparator + IDESource.ProjectShortName + 137 DirectorySeparator + 'config' + DirectorySeparator + 'environmentoptions.xml'); 138 finally 139 Config.Free; 140 end; 141 end; 142 143 procedure TInstance.UpdateFPCConfig; 144 var 145 Config: TStringList; 146 begin 147 try 148 Config := TStringList.Create; 149 Config.LoadFromFile(MainForm.GetBaseDir + DirectorySeparator + 150 MainForm.TemplateDir + DirectorySeparator + 'fpc.cfg'); 151 Config.Text := StringReplace(Config.Text, '$(FPCDir)', GetPath + 152 DirectorySeparator + FPCSource.ProjectShortName, [rfReplaceAll]); 153 Config.SaveToFile(GetPath + DirectorySeparator + FPCSource.ProjectShortName + 154 DirectorySeparator + 'bin' + DirectorySeparator + 155 MainForm.Platform + DirectorySeparator + 'fpc.cfg'); 156 finally 157 Config.Free; 102 158 end; 103 159 end;
Note:
See TracChangeset
for help on using the changeset viewer.