diff --git a/utils/fppkg/pkgfpmake.pp b/utils/fppkg/pkgfpmake.pp index fe6f22fc51..ddc236cecc 100644 --- a/utils/fppkg/pkgfpmake.pp +++ b/utils/fppkg/pkgfpmake.pp @@ -139,13 +139,12 @@ Procedure TFPMakeCompiler.CompileFPMake; const TempBuildDir = 'build-fpmake'; Var + i : Integer; OOptions, DepDir, - DepDir2, FPMakeBin, FPMakeSrc : string; NeedFPMKUnitSource, - DoBootStrap, HaveFpmake : boolean; begin SetCurrentDir(PackageBuildPath); @@ -166,49 +165,26 @@ begin if Not HaveFPMake then Error(SErrMissingFPMake); OOptions:='-n'; - // Add FPMKUnit unit dir, if not installed we use the internal fpmkunit source - if HasFPMKUnitInstalled then + for i:=1 to FPMKUnitDepCount do begin - if CheckUnitDir('fpmkunit',DepDir) then - OOptions:=OOptions+' -Fu'+DepDir + if FPMKUnitDepAvailable[i] then + begin + if CheckUnitDir(FPMKUnitDeps[i].package,DepDir) then + OOptions:=OOptions+' -Fu'+DepDir + else + Error(SErrMissingInstallPackage,[FPMKUnitDeps[i].package]); + end else - Error(SErrMissingInstallPackage,['fpmkunit']); - end - else - begin - NeedFPMKUnitSource:=true; - OOptions:=OOptions+' -Fu'+TempBuildDir; - end; - // Add PaszLib and Hash units dir, when internal fpmkunit is used we - // can suppress the use by NO_UNIT_ZIPPER - if not CheckUnitDir('hash',DepDir) then - 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']); + begin + // If fpmkunit is not installed, we use the internal fpmkunit source + if FPMKUnitDeps[i].package='fpmkunit' then + begin + NeedFPMKUnitSource:=true; + OOptions:=OOptions+' -Fu'+TempBuildDir; + end; + if FPMKUnitDeps[i].undef<>'' then + OOptions:=OOptions+' -d'+FPMKUnitDeps[i].undef; + end; end; // Add RTL unit dir if not CheckUnitDir('rtl',DepDir) then diff --git a/utils/fppkg/pkgglobals.pp b/utils/fppkg/pkgglobals.pp index 9d5a17d47e..cd526d6844 100644 --- a/utils/fppkg/pkgglobals.pp +++ b/utils/fppkg/pkgglobals.pp @@ -17,9 +17,30 @@ Const AllFiles='*.*'; {$endif unix} +Type + TFPMKUnitDep=record + package : string[12]; + reqver : string[8]; + undef : string[16]; + end; + +Const // Dependencies for compiling the fpmkunit unit - RequiredFPMKUnitVersion = '2.2.0'; - FPMKUnitDeps : array[0..4] of string[11] = ('rtl','hash','paszlib','fcl-process','fpmkunit'); + FPMKUnitDepCount=4; + 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 TVerbosity = (vError,vWarning,vInfo,vCommands,vDebug); @@ -48,7 +69,7 @@ function IsSuperUser:boolean; var Verbosity : TVerbosities; - HasFPMKUnitInstalled : boolean; + FPMKUnitDepAvailable : array[1..FPMKUnitDepCount] of boolean; Implementation diff --git a/utils/fppkg/pkgmessages.pp b/utils/fppkg/pkgmessages.pp index e75b52d2a7..20883b25d2 100644 --- a/utils/fppkg/pkgmessages.pp +++ b/utils/fppkg/pkgmessages.pp @@ -62,8 +62,8 @@ Resourcestring SLogLoadingPackagesFile = 'Loading available packages from "%s"'; SLogLoadingStatusFile = 'Loading local status from "%s"'; SLogSavingStatusFile = 'Saving local status to "%s"'; - SLogPackageFPMKUnitVersion = 'Checking for fpmkunit %s, installed %s, available %s'; - SLogPackageFPMKUnitTooOld = 'Minimum fpmkunit version not installed, using internal fpmkunit'; + SLogFPMKUnitDepVersion = 'Checking for %s %s, installed %s, available %s'; + SLogFPMKUnitDepTooOld = 'Minimum version of %s is not installed, using internal fpmkunit with limited functionality'; SDbgFound = 'Found'; SDbgNotFound = 'Not Found'; diff --git a/utils/fppkg/pkgrepos.pp b/utils/fppkg/pkgrepos.pp index 20b261ab86..12d6a3c30d 100644 --- a/utils/fppkg/pkgrepos.pp +++ b/utils/fppkg/pkgrepos.pp @@ -90,30 +90,34 @@ end; procedure LoadFPMakeLocalStatus; var + i : Integer; S : String; P : TFPPackage; ReqVer : TFPVersion; begin - HasFPMKUnitInstalled:=false; S:=GlobalOptions.LocalVersionsFile(GlobalOptions.FPMakeCompilerConfig); Log(vDebug,SLogLoadingStatusFile,[S]); CurrentRepository.ClearStatus; if FileExists(S) then CurrentRepository.LoadStatusFromFile(S); - // Check for fpmkunit package - P:=CurrentRepository.PackageByName('fpmkunit'); - if P<>nil then + // Check for fpmkunit dependencies + for i:=1 to FPMKUnitDepCount do begin - ReqVer:=TFPVersion.Create; - ReqVer.AsString:=RequiredFPMKUnitVersion; - Log(vDebug,SLogPackageFPMKUnitVersion,[ReqVer.AsString,P.InstalledVersion.AsString,P.Version.AsString]); - if ReqVer.CompareVersion(P.InstalledVersion)<=0 then - HasFPMKUnitInstalled:=true + FPMKUnitDepAvailable[i]:=false; + P:=CurrentRepository.PackageByName(FPMKUnitDeps[i].package); + if P<>nil then + begin + 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 - Log(vDebug,SLogPackageFPMKUnitTooOld); - end - else - Log(vDebug,SLogPackageFPMKUnitTooOld); + Log(vDebug,SLogFPMKUnitDepTooOld,[FPMKUnitDeps[i].package]); + end; end;