Changeset 9 for trunk/UInstance.pas


Ignore:
Timestamp:
Feb 12, 2011, 12:33:04 PM (13 years ago)
Author:
chronos
Message:
  • Fixed: Instance compilation on Linux.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        44Source
        55Instance
         6FreePascalManager
  • trunk/UInstance.pas

    r8 r9  
    3030    procedure UpdateFPCConfig;
    3131    function GetPath: string;
     32    function GetBinPath: string;
    3233    property Downloaded: Boolean read GetDownloaded;
    3334    property Compiled: Boolean read GetCompiled;
     
    6162function TInstance.GetCompiled: Boolean;
    6263begin
    63   Result := FileExistsUTF8(GetPath + DirectorySeparator + FPCSource.ProjectShortName +
    64     DirectorySeparator + 'bin' + DirectorySeparator +
    65     MainForm.Platform + DirectorySeparator + FPCSource.GetExecutableFile);
     64  Result := FileExistsUTF8(GetBinPath + DirectorySeparator + FPCSource.GetExecutableFile);
    6665  if Assigned(IDESource) then Result := Result and
    6766    FileExistsUTF8(GetPath + DirectorySeparator + IDESource.ProjectShortName +
     
    7877procedure TInstance.Build;
    7978begin
    80   OperationProgressForm.Environment := 'path=' + MainForm.GetBinUtilsDir;
     79  {$IFDEF Windows}
     80  OperationProgressForm.Environment := 'PATH=' + MainForm.GetBinUtilsDir;
     81  {$ENDIF}
    8182  OperationProgressForm.Path := GetPath + DirectorySeparator + FPCSource.ProjectShortName;
    8283  OperationProgressForm.CommandLine := 'make clean all PP="' +
    83     MainForm.GetBinUtilsDir + DirectorySeparator + 'fpc"';
     84    MainForm.GetCompilerPath + '"';
    8485  OperationProgressForm.ShowModal;
    8586
    86   OperationProgressForm.Environment := 'path=' + MainForm.GetBinUtilsDir;
     87  {$IFDEF Windows}
     88  OperationProgressForm.Environment := 'PATH=' + MainForm.GetBinUtilsDir;
     89  {$ENDIF}
    8790  OperationProgressForm.Path := GetPath + DirectorySeparator + FPCSource.ProjectShortName;
    88   OperationProgressForm.CommandLine := 'make install PREFIX="' +
    89     GetPath + DirectorySeparator + FPCSource.ProjectShortName + '"' +
    90     ' PP="' + MainForm.GetBinUtilsDir + DirectorySeparator + 'fpc"';
     91  OperationProgressForm.CommandLine := 'make install PREFIX=' +
     92    GetPath + DirectorySeparator + FPCSource.ProjectShortName + '' +
     93    ' PP=' + MainForm.GetCompilerPath + '';
    9194  OperationProgressForm.ShowModal;
    9295
    9396  if Assigned(IDESource) then begin
    94     OperationProgressForm.Environment := 'path=' + MainForm.GetBinUtilsDir;
     97    {$IFDEF Windows}
     98    OperationProgressForm.Environment := 'PATH=' + MainForm.GetBinUtilsDir;
     99    {$ENDIF}
    95100    OperationProgressForm.Path := GetPath + DirectorySeparator + IDESource.ProjectShortName;
    96101    OperationProgressForm.CommandLine :=
     
    124129  Config: TStringList;
    125130  ConfigFileName: string;
     131  ConfigPath: string;
    126132begin
    127   ConfigFileName := GetPath + DirectorySeparator + IDESource.ProjectShortName +
    128     DirectorySeparator + 'config' + DirectorySeparator + 'environmentoptions.xml';
     133  ConfigPath := GetPath + DirectorySeparator + IDESource.ProjectShortName +
     134    DirectorySeparator + 'config';
     135  ForceDirectoriesUTF8(ConfigPath);
     136  ConfigFileName := ConfigPath + DirectorySeparator + 'environmentoptions.xml';
    129137  if not FileExistsUTF8(ConfigFileName) then
    130138  try
     
    135143    Config.Text := StringReplace(Config.Text, '%BaseDir%', MainForm.GetBaseDir, [rfReplaceAll]);
    136144    Config.Text := StringReplace(Config.Text, '%LazarusDir%', GetPath + DirectorySeparator + IDESource.ProjectShortName, [rfReplaceAll]);
    137     Config.Text := StringReplace(Config.Text, '%FPCPlatform%', MainForm.Platform, [rfReplaceAll]);
    138     Config.Text := StringReplace(Config.Text, '%Temp%', GetEnvironmentVariableUTF8('Temp'), [rfReplaceAll]);
     145    Config.Text := StringReplace(Config.Text, '%FPCCompiler%', GetBinPath + DirectorySeparator + FPCSource.ExecutableFile, [rfReplaceAll]);
     146    Config.Text := StringReplace(Config.Text, '%Make%', MainForm.GetBinUtilsDir + DirectorySeparator + 'make', [rfReplaceAll]);
     147    {$IFDEF Windows}
     148    Config.Text := StringReplace(Config.Text, '%Temp%', GetEnvironmentVariableUTF8('TEMP'), [rfReplaceAll]);
     149    Config.Text := StringReplace(Config.Text, '%GDB%', MainForm.GetBinUtilsDir + DirectorySeparator + 'mingw\gdb.exe', [rfReplaceAll]);
     150    {$ENDIF}
     151    {$IFDEF Linux}
     152    Config.Text := StringReplace(Config.Text, '%Temp%', '/tmp', [rfReplaceAll]);
     153    Config.Text := StringReplace(Config.Text, '%GDB%', '/usr/bin/gdb', [rfReplaceAll]);
     154    {$ENDIF}
    139155    Config.SaveToFile(ConfigFileName);
    140156  finally
     
    153169    Config.Text := StringReplace(Config.Text, '$(FPCDir)', GetPath +
    154170      DirectorySeparator + FPCSource.ProjectShortName, [rfReplaceAll]);
    155     Config.SaveToFile(GetPath + DirectorySeparator + FPCSource.ProjectShortName +
    156       DirectorySeparator + 'bin' + DirectorySeparator +
    157       MainForm.Platform + DirectorySeparator + 'fpc.cfg');
     171    Config.SaveToFile(GetBinPath + DirectorySeparator + 'fpc.cfg');
    158172  finally
    159173    Config.Free;
     
    167181end;
    168182
     183function TInstance.GetBinPath: string;
     184begin
     185  Result := GetPath + DirectorySeparator + FPCSource.ProjectShortName +
     186    DirectorySeparator + 'bin';
     187  {$IFDEF Windows}
     188  Result := Result + DirectorySeparator +  MainForm.Platform;
     189  {$ENDIF}
     190end;
     191
    169192end.
    170193
Note: See TracChangeset for help on using the changeset viewer.