mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 17:29:11 +02:00
* check for all fpmkunit dependencies with version check
git-svn-id: trunk@9306 -
This commit is contained in:
parent
b72cb5f4b8
commit
0852ce56a9
@ -139,13 +139,12 @@ Procedure TFPMakeCompiler.CompileFPMake;
|
|||||||
const
|
const
|
||||||
TempBuildDir = 'build-fpmake';
|
TempBuildDir = 'build-fpmake';
|
||||||
Var
|
Var
|
||||||
|
i : Integer;
|
||||||
OOptions,
|
OOptions,
|
||||||
DepDir,
|
DepDir,
|
||||||
DepDir2,
|
|
||||||
FPMakeBin,
|
FPMakeBin,
|
||||||
FPMakeSrc : string;
|
FPMakeSrc : string;
|
||||||
NeedFPMKUnitSource,
|
NeedFPMKUnitSource,
|
||||||
DoBootStrap,
|
|
||||||
HaveFpmake : boolean;
|
HaveFpmake : boolean;
|
||||||
begin
|
begin
|
||||||
SetCurrentDir(PackageBuildPath);
|
SetCurrentDir(PackageBuildPath);
|
||||||
@ -166,49 +165,26 @@ begin
|
|||||||
if Not HaveFPMake then
|
if Not HaveFPMake then
|
||||||
Error(SErrMissingFPMake);
|
Error(SErrMissingFPMake);
|
||||||
OOptions:='-n';
|
OOptions:='-n';
|
||||||
// Add FPMKUnit unit dir, if not installed we use the internal fpmkunit source
|
for i:=1 to FPMKUnitDepCount do
|
||||||
if HasFPMKUnitInstalled then
|
|
||||||
begin
|
begin
|
||||||
if CheckUnitDir('fpmkunit',DepDir) then
|
if FPMKUnitDepAvailable[i] then
|
||||||
OOptions:=OOptions+' -Fu'+DepDir
|
begin
|
||||||
|
if CheckUnitDir(FPMKUnitDeps[i].package,DepDir) then
|
||||||
|
OOptions:=OOptions+' -Fu'+DepDir
|
||||||
|
else
|
||||||
|
Error(SErrMissingInstallPackage,[FPMKUnitDeps[i].package]);
|
||||||
|
end
|
||||||
else
|
else
|
||||||
Error(SErrMissingInstallPackage,['fpmkunit']);
|
begin
|
||||||
end
|
// If fpmkunit is not installed, we use the internal fpmkunit source
|
||||||
else
|
if FPMKUnitDeps[i].package='fpmkunit' then
|
||||||
begin
|
begin
|
||||||
NeedFPMKUnitSource:=true;
|
NeedFPMKUnitSource:=true;
|
||||||
OOptions:=OOptions+' -Fu'+TempBuildDir;
|
OOptions:=OOptions+' -Fu'+TempBuildDir;
|
||||||
end;
|
end;
|
||||||
// Add PaszLib and Hash units dir, when internal fpmkunit is used we
|
if FPMKUnitDeps[i].undef<>'' then
|
||||||
// can suppress the use by NO_UNIT_ZIPPER
|
OOptions:=OOptions+' -d'+FPMKUnitDeps[i].undef;
|
||||||
if not CheckUnitDir('hash',DepDir) then
|
end;
|
||||||
begin
|
|
||||||
if NeedFPMKUnitSource then
|
|
||||||
DepDir:=''
|
|
||||||
else
|
|
||||||
Error(SErrMissingInstallPackage,['hash']);
|
|
||||||
end;
|
|
||||||
if not CheckUnitDir('paszlib',DepDir2) then
|
|
||||||
begin
|
|
||||||
if NeedFPMKUnitSource then
|
|
||||||
DepDir2:=''
|
|
||||||
else
|
|
||||||
Error(SErrMissingInstallPackage,['paszlib']);
|
|
||||||
end;
|
|
||||||
if (DepDir<>'') and (DepDir2<>'') then
|
|
||||||
OOptions:=OOptions+' -Fu'+DepDir+' -Fu'+DepDir2
|
|
||||||
else
|
|
||||||
OOptions:=OOptions+' -dNO_UNIT_ZIPPER';
|
|
||||||
// Add Process unit dir, when internal fpmkunit is used we
|
|
||||||
// can suppress the use by NO_UNIT_PROCESS
|
|
||||||
if CheckUnitDir('fcl-process',DepDir) then
|
|
||||||
OOptions:=OOptions+' -Fu'+DepDir
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
if NeedFPMKUnitSource then
|
|
||||||
OOptions:=OOptions+' -dNO_UNIT_PROCESS'
|
|
||||||
else
|
|
||||||
Error(SErrMissingInstallPackage,['fcl-process']);
|
|
||||||
end;
|
end;
|
||||||
// Add RTL unit dir
|
// Add RTL unit dir
|
||||||
if not CheckUnitDir('rtl',DepDir) then
|
if not CheckUnitDir('rtl',DepDir) then
|
||||||
|
@ -17,9 +17,30 @@ Const
|
|||||||
AllFiles='*.*';
|
AllFiles='*.*';
|
||||||
{$endif unix}
|
{$endif unix}
|
||||||
|
|
||||||
|
Type
|
||||||
|
TFPMKUnitDep=record
|
||||||
|
package : string[12];
|
||||||
|
reqver : string[8];
|
||||||
|
undef : string[16];
|
||||||
|
end;
|
||||||
|
|
||||||
|
Const
|
||||||
// Dependencies for compiling the fpmkunit unit
|
// Dependencies for compiling the fpmkunit unit
|
||||||
RequiredFPMKUnitVersion = '2.2.0';
|
FPMKUnitDepCount=4;
|
||||||
FPMKUnitDeps : array[0..4] of string[11] = ('rtl','hash','paszlib','fcl-process','fpmkunit');
|
FPMKUnitDeps : array[1..4] of TFPMKUnitDep = (
|
||||||
|
(package: 'hash';
|
||||||
|
reqver : '2.0.0';
|
||||||
|
undef : 'NO_UNIT_ZIPPER'),
|
||||||
|
(package: 'paszlib';
|
||||||
|
reqver : '2.2.0';
|
||||||
|
undef : 'NO_UNIT_ZIPPER'),
|
||||||
|
(package: 'fcl-process';
|
||||||
|
reqver : '2.0.0';
|
||||||
|
undef : 'NO_UNIT_PROCESS'),
|
||||||
|
(package: 'fpmkunit';
|
||||||
|
reqver : '2.2.0';
|
||||||
|
undef : '')
|
||||||
|
);
|
||||||
|
|
||||||
Type
|
Type
|
||||||
TVerbosity = (vError,vWarning,vInfo,vCommands,vDebug);
|
TVerbosity = (vError,vWarning,vInfo,vCommands,vDebug);
|
||||||
@ -48,7 +69,7 @@ function IsSuperUser:boolean;
|
|||||||
|
|
||||||
var
|
var
|
||||||
Verbosity : TVerbosities;
|
Verbosity : TVerbosities;
|
||||||
HasFPMKUnitInstalled : boolean;
|
FPMKUnitDepAvailable : array[1..FPMKUnitDepCount] of boolean;
|
||||||
|
|
||||||
|
|
||||||
Implementation
|
Implementation
|
||||||
|
@ -62,8 +62,8 @@ Resourcestring
|
|||||||
SLogLoadingPackagesFile = 'Loading available packages from "%s"';
|
SLogLoadingPackagesFile = 'Loading available packages from "%s"';
|
||||||
SLogLoadingStatusFile = 'Loading local status from "%s"';
|
SLogLoadingStatusFile = 'Loading local status from "%s"';
|
||||||
SLogSavingStatusFile = 'Saving local status to "%s"';
|
SLogSavingStatusFile = 'Saving local status to "%s"';
|
||||||
SLogPackageFPMKUnitVersion = 'Checking for fpmkunit %s, installed %s, available %s';
|
SLogFPMKUnitDepVersion = 'Checking for %s %s, installed %s, available %s';
|
||||||
SLogPackageFPMKUnitTooOld = 'Minimum fpmkunit version not installed, using internal fpmkunit';
|
SLogFPMKUnitDepTooOld = 'Minimum version of %s is not installed, using internal fpmkunit with limited functionality';
|
||||||
|
|
||||||
SDbgFound = 'Found';
|
SDbgFound = 'Found';
|
||||||
SDbgNotFound = 'Not Found';
|
SDbgNotFound = 'Not Found';
|
||||||
|
@ -90,30 +90,34 @@ end;
|
|||||||
|
|
||||||
procedure LoadFPMakeLocalStatus;
|
procedure LoadFPMakeLocalStatus;
|
||||||
var
|
var
|
||||||
|
i : Integer;
|
||||||
S : String;
|
S : String;
|
||||||
P : TFPPackage;
|
P : TFPPackage;
|
||||||
ReqVer : TFPVersion;
|
ReqVer : TFPVersion;
|
||||||
begin
|
begin
|
||||||
HasFPMKUnitInstalled:=false;
|
|
||||||
S:=GlobalOptions.LocalVersionsFile(GlobalOptions.FPMakeCompilerConfig);
|
S:=GlobalOptions.LocalVersionsFile(GlobalOptions.FPMakeCompilerConfig);
|
||||||
Log(vDebug,SLogLoadingStatusFile,[S]);
|
Log(vDebug,SLogLoadingStatusFile,[S]);
|
||||||
CurrentRepository.ClearStatus;
|
CurrentRepository.ClearStatus;
|
||||||
if FileExists(S) then
|
if FileExists(S) then
|
||||||
CurrentRepository.LoadStatusFromFile(S);
|
CurrentRepository.LoadStatusFromFile(S);
|
||||||
// Check for fpmkunit package
|
// Check for fpmkunit dependencies
|
||||||
P:=CurrentRepository.PackageByName('fpmkunit');
|
for i:=1 to FPMKUnitDepCount do
|
||||||
if P<>nil then
|
|
||||||
begin
|
begin
|
||||||
ReqVer:=TFPVersion.Create;
|
FPMKUnitDepAvailable[i]:=false;
|
||||||
ReqVer.AsString:=RequiredFPMKUnitVersion;
|
P:=CurrentRepository.PackageByName(FPMKUnitDeps[i].package);
|
||||||
Log(vDebug,SLogPackageFPMKUnitVersion,[ReqVer.AsString,P.InstalledVersion.AsString,P.Version.AsString]);
|
if P<>nil then
|
||||||
if ReqVer.CompareVersion(P.InstalledVersion)<=0 then
|
begin
|
||||||
HasFPMKUnitInstalled:=true
|
ReqVer:=TFPVersion.Create;
|
||||||
|
ReqVer.AsString:=FPMKUnitDeps[i].ReqVer;
|
||||||
|
Log(vDebug,SLogFPMKUnitDepVersion,[P.Name,ReqVer.AsString,P.InstalledVersion.AsString,P.Version.AsString]);
|
||||||
|
if ReqVer.CompareVersion(P.InstalledVersion)<=0 then
|
||||||
|
FPMKUnitDepAvailable[i]:=true
|
||||||
|
else
|
||||||
|
Log(vDebug,SLogFPMKUnitDepTooOld,[FPMKUnitDeps[i].package]);
|
||||||
|
end
|
||||||
else
|
else
|
||||||
Log(vDebug,SLogPackageFPMKUnitTooOld);
|
Log(vDebug,SLogFPMKUnitDepTooOld,[FPMKUnitDeps[i].package]);
|
||||||
end
|
end;
|
||||||
else
|
|
||||||
Log(vDebug,SLogPackageFPMKUnitTooOld);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user