1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
{%MainUnit ../win32/lazconf.inc}
// included by win32/lazconf.inc, win64/lazconf.inc
// todo: use $target here ?
{
***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA. *
* *
***************************************************************************
}
const
DefaultFPCSrcDirs: array[1..2] of string = (
'$(LazarusDir)\fpcsrc', // this value is set in internalinit
'c:\pp\source'
);
DefaultLazarusSrcDirs: array[1..1] of string = (
'c:\lazarus'
);
var
DefaultDrive: String;
PrimaryConfigPath,
SecondaryConfigPath: string;
DefaultFPCTarget,
DefaultFPCVersion : string;
type
TGetFileListProc = procedure (List: TStrings);
function FindExecutableInList(GetFileList: TGetFileListProc): string;
var
FileNames: TStrings;
i : integer;
begin
FileNames := TStringList.Create;
GetFileList(FileNames);
try
for i := 0 to FileNames.Count -1 do begin
Result := FileNames[i];
if FileExistsUTF8(Result) then exit;
end;
Result := '';
finally
FileNames.Free;
end;
end;
function FindDefaultCompilerPath: string;
begin
Result := SearchFileInPath(GetDefaultCompilerFilename,
format('%sfpc\%s\bin\%s',
[AppendPathDelim(ProgramDirectory), DefaultFPCVersion, DefaultFPCTarget]),
GetEnvironmentVariableUTF8('PATH'),';',
[]);
if Result <> '' then exit;
Result := DefaultDrive + AppendPathDelim(ProgramDirectory) +
format('fpc\%s\bin\%s\%s',
[DefaultFPCVersion, DefaultFPCTarget, GetDefaultCompilerFilename]);
if FileExistsUTF8(Result) then exit;
Result := FindExecutableInList(@GetDefaultCompilerFilenames);
end;
function FindDefaultMakePath: string;
begin
Result := SearchFileInPath('make.exe',
format('%sfpc\%s\bin\%s',
[AppendPathDelim(ProgramDirectory), DefaultFPCVersion, DefaultFPCTarget]),
GetEnvironmentVariableUTF8('PATH'),';',
[]);
if Result <> '' then exit;
Result := FindExecutableInList(@GetDefaultMakeFilenames)
end;
function GetDefaultCompiledUnitExt(FPCVersion, FPCRelease: integer): string;
begin
Result:='.ppu';
end;
function OSLocksExecutables: boolean;
begin
Result:=true;
end;
function GetDefaultTestBuildDirectory: string;
begin
Result := SysUtils.GetTempDir;
if Result <> '' then exit;
Result := DefaultDrive + '\temp\';
if DirPathExists(Result) then exit;
Result := DefaultDrive + '\windows\temp\';
end;
procedure GetDefaultCompilerFilenames(List: TStrings);
begin
List.Add(DefaultDrive + format('\fpc\%s\bin\%s\%s',
[DefaultFPCVersion, DefaultFPCTarget, GetDefaultCompilerFilename]));
List.Add(AppendPathDelim(ProgramDirectory) + format('fpc\%s\bin\%s\%s',
[DefaultFPCVersion, DefaultFPCTarget, GetDefaultCompilerFilename]));
end;
procedure GetDefaultMakeFilenames(List: TStrings);
begin
List.Add(DefaultDrive + format('\fpc\%s\bin\%s\make.exe',
[DefaultFPCVersion, DefaultFPCTarget]));
List.Add(AppendPathDelim(ProgramDirectory) +
format('fpc\%s\bin\%s\make.exe',[DefaultFPCVersion, DefaultFPCTarget]));
end;
procedure GetDefaultTestBuildDirs(List: TStrings);
begin
List.Add(SysUtils.GetTempDir);
List.Add(DefaultDrive + '\temp\');
List.Add(DefaultDrive + '\windows\temp\');
end;
procedure GetDefaultBrowser(var Browser, Params: string);
begin
Browser:= SearchFileInPath('rundll32.exe','',
GetEnvironmentVariableUTF8('PATH'),';',
[sffDontSearchInBasePath]);
Params:='url.dll,FileProtocolHandler %s';
end;
{---------------------------------------------------------------------------
procedure InternalInit;
---------------------------------------------------------------------------}
procedure InternalInit;
begin
DefaultDrive := ExtractFileDrive(ProgramDirectory);
DefaultFPCTarget:= GetCompiledTargetCPU + '-' + GetCompiledTargetOS;
DefaultFPCVersion:= {$I %FPCVERSION%};
// the last part of the path returned by GetAppConfigDir is the application
// name. Replace that by 'lazarus', to make sure that lazbuild uses
// the same primary config path
PrimaryConfigPath:= ExtractFilePath(ChompPathDelim(GetAppConfigDirUTF8(False))) + 'lazarus';
SecondaryConfigPath:=ChompPathDelim(ProgramDirectory);
DefaultFPCSrcDirs[1] := AppendPathDelim(ProgramDirectory) + 'fpcsrc';
DefaultLazarusSrcDirs[1] := DefaultDrive + '\lazarus';
end;
|