mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-21 10:51:05 +02:00
* Read package-information from .fpm file, if available
git-svn-id: trunk@29202 -
This commit is contained in:
parent
437272a037
commit
6f5637888b
@ -5,7 +5,7 @@ unit pkgcommands;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils,pkghandler;
|
Classes, SysUtils, pkghandler, fpmkunit;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -279,9 +279,64 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
procedure TCommandInstall.Execute;
|
procedure TCommandInstall.Execute;
|
||||||
|
|
||||||
var
|
var
|
||||||
UFN,S : String;
|
S : String;
|
||||||
P : TFPPackage;
|
P : TFPPackage;
|
||||||
|
|
||||||
|
function GetUnitConfigFilename: string;
|
||||||
|
begin
|
||||||
|
if P.RecompileBroken then
|
||||||
|
begin
|
||||||
|
// If the package is recompiled, the installation-location is dependent on where
|
||||||
|
// the package was installed originally.
|
||||||
|
if P.InstalledLocally then
|
||||||
|
Result:=CompilerOptions.LocalUnitDir
|
||||||
|
else
|
||||||
|
Result:=CompilerOptions.GlobalUnitDir;
|
||||||
|
// Setting RecompileBroken to false is in a strict sense not needed. But it is better
|
||||||
|
// to clean this temporary flag, to avoid problems with changes in the future
|
||||||
|
P.RecompileBroken := false;
|
||||||
|
AvailableRepository.FindPackage(P.Name).RecompileBroken:=false;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if (IsSuperUser or GlobalOptions.InstallGlobal) then
|
||||||
|
Result:=CompilerOptions.GlobalUnitDir
|
||||||
|
else
|
||||||
|
Result:=CompilerOptions.LocalUnitDir;
|
||||||
|
end;
|
||||||
|
Result:=IncludeTrailingPathDelimiter(Result)+S+PathDelim+UnitConfigFileName;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetFpmFilename: string;
|
||||||
|
begin
|
||||||
|
if P.RecompileBroken then
|
||||||
|
begin
|
||||||
|
// If the package is recompiled, the installation-location is dependent on where
|
||||||
|
// the package was installed originally.
|
||||||
|
if P.InstalledLocally then
|
||||||
|
Result:=CompilerOptions.LocalInstallDir
|
||||||
|
else
|
||||||
|
Result:=CompilerOptions.GlobalInstallDir;
|
||||||
|
// Setting RecompileBroken to false is in a strict sense not needed. But it is better
|
||||||
|
// to clean this temporary flag, to avoid problems with changes in the future
|
||||||
|
P.RecompileBroken := false;
|
||||||
|
AvailableRepository.FindPackage(P.Name).RecompileBroken:=false;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if (IsSuperUser or GlobalOptions.InstallGlobal) then
|
||||||
|
Result:=CompilerOptions.GlobalInstallDir
|
||||||
|
else
|
||||||
|
Result:=CompilerOptions.LocalInstallDir;
|
||||||
|
end;
|
||||||
|
Result:=IncludeTrailingPathDelimiter(Result)+'fpmkinst'+PathDelim+CompilerOptions.CompilerTarget+PathDelim+s+FpmkExt;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
var
|
||||||
|
UFN : String;
|
||||||
begin
|
begin
|
||||||
if PackageName<>'' then
|
if PackageName<>'' then
|
||||||
begin
|
begin
|
||||||
@ -301,27 +356,13 @@ begin
|
|||||||
P:=InstalledRepository.FindPackage(S);
|
P:=InstalledRepository.FindPackage(S);
|
||||||
if not assigned(P) then
|
if not assigned(P) then
|
||||||
P:=InstalledRepository.AddPackage(S);
|
P:=InstalledRepository.AddPackage(S);
|
||||||
if P.RecompileBroken then
|
|
||||||
begin
|
UFN:=GetFpmFilename;
|
||||||
// If the package is recompiled, the installation-location is dependent on where
|
// If there is no fpm-file, search for an (obsolete, pre-2.7.x)
|
||||||
// the package was installed originally.
|
// fpunits.cfg-file
|
||||||
if P.InstalledLocally then
|
if not FileExists(ufn) then
|
||||||
UFN:=CompilerOptions.LocalUnitDir
|
UFN:=GetUnitConfigFilename;
|
||||||
else
|
|
||||||
UFN:=CompilerOptions.GlobalUnitDir;
|
|
||||||
// Setting RecompileBroken to false is in a strict sense not needed. But it is better
|
|
||||||
// to clean this temporary flag, to avoid problems with changes in the future
|
|
||||||
P.RecompileBroken := false;
|
|
||||||
AvailableRepository.FindPackage(P.Name).RecompileBroken:=false;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
if (IsSuperUser or GlobalOptions.InstallGlobal) then
|
|
||||||
UFN:=CompilerOptions.GlobalUnitDir
|
|
||||||
else
|
|
||||||
UFN:=CompilerOptions.LocalUnitDir;
|
|
||||||
end;
|
|
||||||
UFN:=IncludeTrailingPathDelimiter(UFN)+S+PathDelim+UnitConfigFileName;
|
|
||||||
P.LoadUnitConfigFromFile(UFN);
|
P.LoadUnitConfigFromFile(UFN);
|
||||||
if P.IsFPMakeAddIn then
|
if P.IsFPMakeAddIn then
|
||||||
AddFPMakeAddIn(P);
|
AddFPMakeAddIn(P);
|
||||||
|
Loading…
Reference in New Issue
Block a user