mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 16:10:20 +02:00
lazbuild: fixed compilation
git-svn-id: trunk@29913 -
This commit is contained in:
parent
f00e8050b6
commit
c011106ea9
@ -150,11 +150,13 @@ function ShowInitialSetupDialog: TModalResult;
|
|||||||
function CheckLazarusDirectoryQuality(ADirectory: string;
|
function CheckLazarusDirectoryQuality(ADirectory: string;
|
||||||
out Note: string): TSDFilenameQuality;
|
out Note: string): TSDFilenameQuality;
|
||||||
function SearchLazarusDirectoryCandidates(StopIfFits: boolean): TObjectList;
|
function SearchLazarusDirectoryCandidates(StopIfFits: boolean): TObjectList;
|
||||||
|
procedure SetupLazarusDirectory;
|
||||||
|
|
||||||
function CheckCompilerQuality(AFilename: string;
|
function CheckCompilerQuality(AFilename: string;
|
||||||
out Note: string; TestSrcFilename: string): TSDFilenameQuality;
|
out Note: string; TestSrcFilename: string): TSDFilenameQuality;
|
||||||
function SearchCompilerCandidates(StopIfFits: boolean;
|
function SearchCompilerCandidates(StopIfFits: boolean;
|
||||||
const LazarusDir, TestSrcFilename: string): TObjectList;
|
const LazarusDir, TestSrcFilename: string): TObjectList;
|
||||||
|
procedure SetupCompilerFilename;
|
||||||
|
|
||||||
function CheckFPCSrcDirQuality(ADirectory: string;
|
function CheckFPCSrcDirQuality(ADirectory: string;
|
||||||
out Note: string; FPCVer: string): TSDFilenameQuality;
|
out Note: string; FPCVer: string): TSDFilenameQuality;
|
||||||
@ -322,6 +324,34 @@ begin
|
|||||||
if CheckDir(Dirs[i],Result) then exit;
|
if CheckDir(Dirs[i],Result) then exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure SetupLazarusDirectory;
|
||||||
|
var
|
||||||
|
Note: string;
|
||||||
|
Dir: String;
|
||||||
|
Quality: TSDFilenameQuality;
|
||||||
|
BestDir: TSDFileInfo;
|
||||||
|
List: TObjectList;
|
||||||
|
begin
|
||||||
|
Dir:=EnvironmentOptions.LazarusDirectory;
|
||||||
|
Quality:=CheckLazarusDirectoryQuality(Dir,Note);
|
||||||
|
if Quality<>sddqInvalid then exit;
|
||||||
|
debugln(['SetupLazarusDirectory: The Lazarus directory "',Dir,'" is invalid (Error: ',Note,'). Searching a proper one ...']);
|
||||||
|
List:=SearchLazarusDirectoryCandidates(true);
|
||||||
|
try
|
||||||
|
BestDir:=nil;
|
||||||
|
if List<>nil then
|
||||||
|
BestDir:=TSDFileInfo(List[List.Count-1]);
|
||||||
|
if (BestDir=nil) or (BestDir.Quality=sddqInvalid) then begin
|
||||||
|
debugln(['SetupCompilerFilename: no proper Lazarus directory found.']);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
EnvironmentOptions.LazarusDirectory:=BestDir.Filename;
|
||||||
|
debugln(['SetupLazarusDirectory: using ',EnvironmentOptions.LazarusDirectory]);
|
||||||
|
finally
|
||||||
|
List.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function CheckCompilerQuality(AFilename: string; out Note: string;
|
function CheckCompilerQuality(AFilename: string; out Note: string;
|
||||||
TestSrcFilename: string): TSDFilenameQuality;
|
TestSrcFilename: string): TSDFilenameQuality;
|
||||||
var
|
var
|
||||||
@ -456,12 +486,46 @@ begin
|
|||||||
finally
|
finally
|
||||||
Files.Free;
|
Files.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// ToDo: search for different versions
|
||||||
|
// under windows: %PROGRAMFILES%\FPC\*, %SYSTEMDRIVE%\FPC\*\, C:\pp\, $(LazDir)\FPC
|
||||||
|
// containing bin\i386-win32\fpc.exe
|
||||||
|
|
||||||
finally
|
finally
|
||||||
if Macros<>nil then
|
if Macros<>nil then
|
||||||
Macros.Free;
|
Macros.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure SetupCompilerFilename;
|
||||||
|
var
|
||||||
|
Note: string;
|
||||||
|
CompFile: String;
|
||||||
|
Quality: TSDFilenameQuality;
|
||||||
|
BestDir: TSDFileInfo;
|
||||||
|
List: TObjectList;
|
||||||
|
begin
|
||||||
|
CompFile:=EnvironmentOptions.GetCompilerFilename;
|
||||||
|
Quality:=CheckCompilerQuality(CompFile,Note,'');
|
||||||
|
if Quality<>sddqInvalid then exit;
|
||||||
|
debugln(['SetupCompilerFilename: The compiler path "',CompFile,'" is invalid (Error: ',Note,'). Searching a proper one ...']);
|
||||||
|
List:=SearchCompilerCandidates(true,EnvironmentOptions.LazarusDirectory,
|
||||||
|
CodeToolBoss.FPCDefinesCache.TestFilename);
|
||||||
|
try
|
||||||
|
BestDir:=nil;
|
||||||
|
if List<>nil then
|
||||||
|
BestDir:=TSDFileInfo(List[List.Count-1]);
|
||||||
|
if (BestDir=nil) or (BestDir.Quality=sddqInvalid) then begin
|
||||||
|
debugln(['SetupCompilerFilename: no proper compiler found.']);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
EnvironmentOptions.CompilerFilename:=BestDir.Filename;
|
||||||
|
debugln(['SetupCompilerFilename: using ',EnvironmentOptions.CompilerFilename]);
|
||||||
|
finally
|
||||||
|
List.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function CheckFPCSrcDirQuality(ADirectory: string; out Note: string;
|
function CheckFPCSrcDirQuality(ADirectory: string; out Note: string;
|
||||||
FPCVer: string): TSDFilenameQuality;
|
FPCVer: string): TSDFilenameQuality;
|
||||||
|
|
||||||
@ -860,9 +924,14 @@ begin
|
|||||||
if MsgResult<>mrIgnore then exit;
|
if MsgResult<>mrIgnore then exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
EnvironmentOptions.LazarusDirectory:=GetCurrentLazarusDir;
|
s:=GetCurrentLazarusDir;
|
||||||
EnvironmentOptions.CompilerFilename:=GetCurrentCompilerFilename;
|
if s<>'' then EnvironmentOptions.LazarusDirectory:=s;
|
||||||
EnvironmentOptions.FPCSourceDirectory:=GetCurrentFPCSrcDir;
|
s:=GetCurrentCompilerFilename;
|
||||||
|
if s<>'' then
|
||||||
|
EnvironmentOptions.CompilerFilename:=s;
|
||||||
|
s:=GetCurrentFPCSrcDir;
|
||||||
|
if s<>'' then
|
||||||
|
EnvironmentOptions.FPCSourceDirectory:=s;
|
||||||
|
|
||||||
ModalResult:=mrOk;
|
ModalResult:=mrOk;
|
||||||
end;
|
end;
|
||||||
@ -975,7 +1044,9 @@ begin
|
|||||||
sl.Add(TSDFileInfo(List[i]).Caption);
|
sl.Add(TSDFileInfo(List[i]).Caption);
|
||||||
ABox.Items.Assign(sl);
|
ABox.Items.Assign(sl);
|
||||||
if (ItemIndex>=0) and (ItemIndex<sl.Count) then
|
if (ItemIndex>=0) and (ItemIndex<sl.Count) then
|
||||||
ABox.Text:=sl[ItemIndex];
|
ABox.Text:=sl[ItemIndex]
|
||||||
|
else if ABox.Text=ABox.Name then
|
||||||
|
ABox.Text:='';
|
||||||
finally
|
finally
|
||||||
sl.Free;
|
sl.Free;
|
||||||
end;
|
end;
|
||||||
|
@ -763,8 +763,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TLazBuildApplication.Init: boolean;
|
function TLazBuildApplication.Init: boolean;
|
||||||
var
|
|
||||||
InteractiveSetup: Boolean;
|
|
||||||
begin
|
begin
|
||||||
if fInitialized then exit(fInitResult);
|
if fInitialized then exit(fInitResult);
|
||||||
fInitResult:=false;
|
fInitResult:=false;
|
||||||
@ -776,12 +774,11 @@ begin
|
|||||||
MainBuildBoss.HasGUI:=false;
|
MainBuildBoss.HasGUI:=false;
|
||||||
LoadEnvironmentOptions;
|
LoadEnvironmentOptions;
|
||||||
LoadMiscellaneousOptions;
|
LoadMiscellaneousOptions;
|
||||||
InteractiveSetup:=false;
|
|
||||||
SetupMacros;
|
SetupMacros;
|
||||||
SetupCompilerFilename(InteractiveSetup);
|
SetupLazarusDirectory;
|
||||||
// create a test unit needed to get from the compiler all macros and search paths
|
// create a test unit needed to get from the compiler all macros and search paths
|
||||||
CodeToolBoss.FPCDefinesCache.TestFilename:=CreateCompilerTestPascalFilename;
|
CodeToolBoss.FPCDefinesCache.TestFilename:=CreateCompilerTestPascalFilename;
|
||||||
SetupLazarusDirectory(InteractiveSetup);
|
SetupCompilerFilename;
|
||||||
SetupPackageSystem;
|
SetupPackageSystem;
|
||||||
SetupOutputFilter;
|
SetupOutputFilter;
|
||||||
MainBuildBoss.SetupCompilerInterface;
|
MainBuildBoss.SetupCompilerInterface;
|
||||||
|
Loading…
Reference in New Issue
Block a user