mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-24 23:22:08 +02:00
IDE: Show why Lazarus marks the fppkg-configuration as being corrupt
git-svn-id: trunk@60758 -
This commit is contained in:
parent
f11f384ce4
commit
bbb8263057
@ -1377,7 +1377,7 @@ end;
|
|||||||
procedure TInitialSetupDialog.UpdateFppkgNote;
|
procedure TInitialSetupDialog.UpdateFppkgNote;
|
||||||
var
|
var
|
||||||
CurCaption: String;
|
CurCaption: String;
|
||||||
Msg, Note: string;
|
Msg, FppkgMsg, Note: string;
|
||||||
Quality: TSDFilenameQuality;
|
Quality: TSDFilenameQuality;
|
||||||
{$IF FPC_FULLVERSION>30100}
|
{$IF FPC_FULLVERSION>30100}
|
||||||
ImageIndex: Integer;
|
ImageIndex: Integer;
|
||||||
@ -1388,7 +1388,7 @@ begin
|
|||||||
if (fLastParsedFppkgPrefix=CurCaption) and (CurCaption<>'') then exit;
|
if (fLastParsedFppkgPrefix=CurCaption) and (CurCaption<>'') then exit;
|
||||||
fLastParsedFppkgPrefix:=CurCaption;
|
fLastParsedFppkgPrefix:=CurCaption;
|
||||||
|
|
||||||
Quality := CheckFppkgConfiguration();
|
Quality := CheckFppkgConfiguration(FppkgMsg);
|
||||||
|
|
||||||
Msg := '';
|
Msg := '';
|
||||||
if CheckFppkgQuality(CurCaption,fLastParsedFppkgLibPath,Note)<>sddqCompatible then
|
if CheckFppkgQuality(CurCaption,fLastParsedFppkgLibPath,Note)<>sddqCompatible then
|
||||||
@ -1401,7 +1401,7 @@ begin
|
|||||||
if Quality=sddqCompatible then
|
if Quality=sddqCompatible then
|
||||||
Note := lisOk
|
Note := lisOk
|
||||||
else
|
else
|
||||||
Note := lisError + lisIncorrectFppkgConfiguration + LineEnding;
|
Note := lisError + Format(lisIncorrectFppkgConfiguration, [FppkgMsg]) + LineEnding;
|
||||||
|
|
||||||
if Msg<>'' then
|
if Msg<>'' then
|
||||||
begin
|
begin
|
||||||
@ -1587,8 +1587,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TInitialSetupDialog.FppkgWriteConfigButtonClick(Sender: TObject);
|
procedure TInitialSetupDialog.FppkgWriteConfigButtonClick(Sender: TObject);
|
||||||
{$IF FPC_FULLVERSION>30100}
|
|
||||||
var
|
var
|
||||||
|
Msg: string;
|
||||||
|
{$IF FPC_FULLVERSION>30100}
|
||||||
FpcmkcfgExecutable, CompConfigFilename: string;
|
FpcmkcfgExecutable, CompConfigFilename: string;
|
||||||
Proc: TProcessUTF8;
|
Proc: TProcessUTF8;
|
||||||
Fppkg: TFppkgHelper;
|
Fppkg: TFppkgHelper;
|
||||||
@ -1659,8 +1660,8 @@ begin
|
|||||||
UpdateFppkgNote;
|
UpdateFppkgNote;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
if CheckFppkgConfiguration<>sddqCompatible then
|
if CheckFppkgConfiguration(Msg)<>sddqCompatible then
|
||||||
IDEMessageDialog(lisFppkgProblem, lisFppkgWriteConfFailed, mtWarning, [mbOK]);
|
IDEMessageDialog(lisFppkgProblem, Format(lisFppkgWriteConfFailed, [Msg], mtWarning, [mbOK]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TInitialSetupDialog.CheckFpcmkcfgQuality(out Note: string): TSDFilenameQuality;
|
function TInitialSetupDialog.CheckFpcmkcfgQuality(out Note: string): TSDFilenameQuality;
|
||||||
|
@ -107,7 +107,7 @@ function SearchFPCSrcDirCandidates(StopIfFits: boolean;
|
|||||||
const FPCVer: string): TSDFileInfoList;
|
const FPCVer: string): TSDFileInfoList;
|
||||||
|
|
||||||
// Fppkg
|
// Fppkg
|
||||||
function CheckFppkgConfiguration(): TSDFilenameQuality;
|
function CheckFppkgConfiguration(out Msg: string): TSDFilenameQuality;
|
||||||
|
|
||||||
// Make
|
// Make
|
||||||
// Checks a given file to see if it is a valid make executable
|
// Checks a given file to see if it is a valid make executable
|
||||||
@ -832,12 +832,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function CheckFppkgConfiguration(): TSDFilenameQuality;
|
function CheckFppkgConfiguration(out Msg: string): TSDFilenameQuality;
|
||||||
var
|
var
|
||||||
Fppkg: TFppkgHelper;
|
Fppkg: TFppkgHelper;
|
||||||
begin
|
begin
|
||||||
Fppkg := TFppkgHelper.Instance;
|
Fppkg := TFppkgHelper.Instance;
|
||||||
if Fppkg.IsProperlyConfigured then
|
if Fppkg.IsProperlyConfigured(Msg) then
|
||||||
Result := sddqCompatible
|
Result := sddqCompatible
|
||||||
else
|
else
|
||||||
Result := sddqInvalid;
|
Result := sddqInvalid;
|
||||||
|
@ -1039,7 +1039,7 @@ resourcestring
|
|||||||
lisInvalidFileName = 'Invalid file name';
|
lisInvalidFileName = 'Invalid file name';
|
||||||
lisTheTargetFileNameIsADirectory = 'The target file name is a directory.';
|
lisTheTargetFileNameIsADirectory = 'The target file name is a directory.';
|
||||||
lisNotAValidFppkgPrefix ='Free Pascal compiler not found at the given prefix.';
|
lisNotAValidFppkgPrefix ='Free Pascal compiler not found at the given prefix.';
|
||||||
lisIncorrectFppkgConfiguration = 'the Fppkg configuration is corrupt.';
|
lisIncorrectFppkgConfiguration = 'there is a problem with the Fppkg configuration. (%s)';
|
||||||
lisFppkgCompilerProblem = 'there is a problem with the Free Pascal compiler executable, ';
|
lisFppkgCompilerProblem = 'there is a problem with the Free Pascal compiler executable, ';
|
||||||
lisFppkgInstallationPath = 'The prefix of the Free Pascal Compiler installation ' +
|
lisFppkgInstallationPath = 'The prefix of the Free Pascal Compiler installation ' +
|
||||||
'is required to create new configuration files for Fppkg. For example it has ' +
|
'is required to create new configuration files for Fppkg. For example it has ' +
|
||||||
@ -1050,7 +1050,7 @@ resourcestring
|
|||||||
lisFreePascalPrefix = 'Free Pascal compiler prefix';
|
lisFreePascalPrefix = 'Free Pascal compiler prefix';
|
||||||
lisFppkgWriteConfException = 'A problem occurred while trying to create a new ' +
|
lisFppkgWriteConfException = 'A problem occurred while trying to create a new ' +
|
||||||
'Fppkg configuration: %s';
|
'Fppkg configuration: %s';
|
||||||
lisFppkgWriteConfFailed = 'Failed to create a new Fppkg configuration. You ' +
|
lisFppkgWriteConfFailed = 'Failed to create a new Fppkg configuration (%s) You ' +
|
||||||
'will have to fix the configuration manually or reinstall Free Pascal.';
|
'will have to fix the configuration manually or reinstall Free Pascal.';
|
||||||
lisNoFppkgPrefix = 'empty Free Pascal compiler prefix.';
|
lisNoFppkgPrefix = 'empty Free Pascal compiler prefix.';
|
||||||
lisFppkgCreateFileFailed = 'Failed to generate the configuration file "%s".';
|
lisFppkgCreateFileFailed = 'Failed to generate the configuration file "%s".';
|
||||||
@ -1064,6 +1064,10 @@ resourcestring
|
|||||||
lifFppkgFpcmkcfgProbTooOld = 'It is probably too old to create the configuration files.';
|
lifFppkgFpcmkcfgProbTooOld = 'It is probably too old to create the configuration files.';
|
||||||
lisFppkgFpcmkcfgMissing = 'Could not find the fpcmkcfg configuration tool, ' +
|
lisFppkgFpcmkcfgMissing = 'Could not find the fpcmkcfg configuration tool, ' +
|
||||||
'which is needed to create the configuration files.';
|
'which is needed to create the configuration files.';
|
||||||
|
lisFppkgRtlNotFound = 'Fppkg reports that the RTL is not installed.';
|
||||||
|
lisFppkgCompilerNotFound = 'Could not find the compiler [%s] configured for Fppkg.';
|
||||||
|
lisFppkgCompilerNotExists = 'The compiler [%s] configured for Fppkg does not exist.';
|
||||||
|
lisFppkgCompilerNotExecutable = 'The compiler [%s] configured for Fppkg is not an executable.';
|
||||||
|
|
||||||
// file dialogs
|
// file dialogs
|
||||||
lisOpenFile = 'Open File';
|
lisOpenFile = 'Open File';
|
||||||
|
@ -1446,7 +1446,7 @@ begin
|
|||||||
|
|
||||||
// check fppkg configuration
|
// check fppkg configuration
|
||||||
if (not ShowSetupDialog)
|
if (not ShowSetupDialog)
|
||||||
and (CheckFppkgConfiguration()<>sddqCompatible)
|
and (CheckFppkgConfiguration(Note)<>sddqCompatible)
|
||||||
then begin
|
then begin
|
||||||
debugln('Warning: (lazarus) fppkg not properly configured.');
|
debugln('Warning: (lazarus) fppkg not properly configured.');
|
||||||
ShowSetupDialog:=true;
|
ShowSetupDialog:=true;
|
||||||
|
@ -13,6 +13,7 @@ uses
|
|||||||
fprepos,
|
fprepos,
|
||||||
LazLogger,
|
LazLogger,
|
||||||
LazFileCache,
|
LazFileCache,
|
||||||
|
LazarusIDEStrConsts,
|
||||||
FileUtil,
|
FileUtil,
|
||||||
LazFileUtils;
|
LazFileUtils;
|
||||||
|
|
||||||
@ -30,6 +31,7 @@ type
|
|||||||
FFPpkg: TpkgFPpkg;
|
FFPpkg: TpkgFPpkg;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
FIsProperlyConfigured: TFppkgPropConfigured;
|
FIsProperlyConfigured: TFppkgPropConfigured;
|
||||||
|
FConfStatusMessage: string;
|
||||||
function HasFPCPackagesOnly(const PackageName: string): Boolean;
|
function HasFPCPackagesOnly(const PackageName: string): Boolean;
|
||||||
procedure InitializeFppkg;
|
procedure InitializeFppkg;
|
||||||
public
|
public
|
||||||
@ -39,7 +41,7 @@ type
|
|||||||
function HasPackage(const PackageName: string): Boolean;
|
function HasPackage(const PackageName: string): Boolean;
|
||||||
procedure ListPackages(AList: TStringList);
|
procedure ListPackages(AList: TStringList);
|
||||||
function GetPackageUnitPath(const PackageName: string): string;
|
function GetPackageUnitPath(const PackageName: string): string;
|
||||||
function IsProperlyConfigured: Boolean;
|
function IsProperlyConfigured(out Message: string): Boolean;
|
||||||
function GetCompilerFilename: string;
|
function GetCompilerFilename: string;
|
||||||
function GetCompilerConfigurationFileName: string;
|
function GetCompilerConfigurationFileName: string;
|
||||||
// Temporary solution, because fpc 3.2.0 does not has support for package-variants
|
// Temporary solution, because fpc 3.2.0 does not has support for package-variants
|
||||||
@ -109,11 +111,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TFppkgHelper.HasPackage(const PackageName: string): Boolean;
|
function TFppkgHelper.HasPackage(const PackageName: string): Boolean;
|
||||||
|
var
|
||||||
|
Msg: string;
|
||||||
begin
|
begin
|
||||||
{$IF NOT (FPC_FULLVERSION>30100)}
|
{$IF NOT (FPC_FULLVERSION>30100)}
|
||||||
Result := HasFPCPackagesOnly(PackageName);
|
Result := HasFPCPackagesOnly(PackageName);
|
||||||
{$ELSE }
|
{$ELSE }
|
||||||
if IsProperlyConfigured() then
|
if IsProperlyConfigured(Msg) then
|
||||||
begin
|
begin
|
||||||
Result :=
|
Result :=
|
||||||
Assigned(FFPpkg.FindPackage(PackageName,pkgpkInstalled)) or
|
Assigned(FFPpkg.FindPackage(PackageName,pkgpkInstalled)) or
|
||||||
@ -261,36 +265,53 @@ begin
|
|||||||
{$ENDIF FPC_FULLVERSION>30100}
|
{$ENDIF FPC_FULLVERSION>30100}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFppkgHelper.IsProperlyConfigured: Boolean;
|
function TFppkgHelper.IsProperlyConfigured(out Message: string): Boolean;
|
||||||
{$IF FPC_FULLVERSION>30100}
|
{$IF FPC_FULLVERSION>30100}
|
||||||
var
|
var
|
||||||
CompilerFilename: string;
|
CompilerFilename: string;
|
||||||
{$ENDIF FPC_FULLVERSION>30100}
|
{$ENDIF FPC_FULLVERSION>30100}
|
||||||
begin
|
begin
|
||||||
|
Message := '';
|
||||||
{$IF FPC_FULLVERSION>30100}
|
{$IF FPC_FULLVERSION>30100}
|
||||||
if Assigned(FFPpkg) and (FIsProperlyConfigured=fpcUnknown) then
|
if Assigned(FFPpkg) and (FIsProperlyConfigured=fpcUnknown) then
|
||||||
begin
|
begin
|
||||||
FIsProperlyConfigured := fpcYes;
|
FIsProperlyConfigured := fpcYes;
|
||||||
|
FConfStatusMessage := '';
|
||||||
|
|
||||||
if not HasPackage('rtl') then
|
if not HasPackage('rtl') then
|
||||||
FIsProperlyConfigured := fpcNo
|
begin
|
||||||
|
FIsProperlyConfigured := fpcNo;
|
||||||
|
FConfStatusMessage := lisFppkgRtlNotFound;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
CompilerFilename := FFPpkg.CompilerOptions.Compiler;
|
CompilerFilename := FFPpkg.CompilerOptions.Compiler;
|
||||||
if Pos(PathDelim, CompilerFilename) > 0 then
|
if Pos(PathDelim, CompilerFilename) > 0 then
|
||||||
begin
|
begin
|
||||||
if not FileExistsCached(CompilerFilename) then
|
if not FileExistsCached(CompilerFilename) then
|
||||||
FIsProperlyConfigured := fpcNo
|
begin
|
||||||
|
FIsProperlyConfigured := fpcNo;
|
||||||
|
FConfStatusMessage := Format(lisFppkgCompilerNotExists, [CompilerFilename]);
|
||||||
|
end
|
||||||
else if not FileIsExecutableCached(CompilerFilename) then
|
else if not FileIsExecutableCached(CompilerFilename) then
|
||||||
FIsProperlyConfigured := fpcNo
|
begin
|
||||||
|
FIsProperlyConfigured := fpcNo;
|
||||||
|
FConfStatusMessage := Format(lisFppkgCompilerNotExecutable, [CompilerFilename]);
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
CompilerFilename := ExeSearch(CompilerFilename);
|
CompilerFilename := ExeSearch(CompilerFilename);
|
||||||
if CompilerFilename = '' then
|
if CompilerFilename = '' then
|
||||||
FIsProperlyConfigured := fpcNo
|
begin
|
||||||
|
FIsProperlyConfigured := fpcNo;
|
||||||
|
FConfStatusMessage := Format(lisFppkgCompilerNotFound, [FFPpkg.CompilerOptions.Compiler]);
|
||||||
|
end
|
||||||
else if not FileIsExecutableCached(CompilerFilename) then
|
else if not FileIsExecutableCached(CompilerFilename) then
|
||||||
FIsProperlyConfigured := fpcNo
|
begin
|
||||||
|
FIsProperlyConfigured := fpcNo;
|
||||||
|
FConfStatusMessage := Format(lisFppkgCompilerNotExecutable, [CompilerFilename]);
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -298,6 +319,7 @@ begin
|
|||||||
{$ELSE}
|
{$ELSE}
|
||||||
result := True
|
result := True
|
||||||
{$ENDIF FPC_FULLVERSION>30100}
|
{$ENDIF FPC_FULLVERSION>30100}
|
||||||
|
Message := FConfStatusMessage;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFppkgHelper.HasFPCPackagesOnly(const PackageName: string): Boolean;
|
function TFppkgHelper.HasFPCPackagesOnly(const PackageName: string): Boolean;
|
||||||
|
Loading…
Reference in New Issue
Block a user