mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-03 18:29:35 +01:00
* Added the option (-ie) to install the example-sources
git-svn-id: trunk@18109 -
This commit is contained in:
parent
a09a7f1b2e
commit
911a220a13
@ -598,7 +598,7 @@ Type
|
|||||||
Function GetBinOutputDir(ACPU:TCPU; AOS : TOS) : String;
|
Function GetBinOutputDir(ACPU:TCPU; AOS : TOS) : String;
|
||||||
Procedure GetCleanFiles(List : TStrings; ACPU:TCPU; AOS : TOS); virtual;
|
Procedure GetCleanFiles(List : TStrings; ACPU:TCPU; AOS : TOS); virtual;
|
||||||
procedure GetInstallFiles(List: TStrings;Types : TTargetTypes;ACPU:TCPU; AOS : TOS); virtual;
|
procedure GetInstallFiles(List: TStrings;Types : TTargetTypes;ACPU:TCPU; AOS : TOS); virtual;
|
||||||
procedure GetInstallSourceFiles(List: TStrings;Types : TSourceTypes); virtual;
|
procedure GetInstallSourceFiles(List: TStrings; SourceTypes : TSourceTypes; TargetTypes : TTargetTypes); virtual;
|
||||||
Procedure GetArchiveFiles(List : TStrings; ACPU:TCPU; AOS : TOS); virtual;
|
Procedure GetArchiveFiles(List : TStrings; ACPU:TCPU; AOS : TOS); virtual;
|
||||||
Procedure GetArchiveSourceFiles(List : TStrings); virtual;
|
Procedure GetArchiveSourceFiles(List : TStrings); virtual;
|
||||||
Procedure GetManifest(Manifest : TStrings);
|
Procedure GetManifest(Manifest : TStrings);
|
||||||
@ -680,6 +680,7 @@ Type
|
|||||||
FCopy: String;
|
FCopy: String;
|
||||||
FFPDocOutputDir: String;
|
FFPDocOutputDir: String;
|
||||||
FIgnoreInvalidOptions: Boolean;
|
FIgnoreInvalidOptions: Boolean;
|
||||||
|
FInstallExamples: Boolean;
|
||||||
FMkDir: String;
|
FMkDir: String;
|
||||||
FMove: String;
|
FMove: String;
|
||||||
FOptions: TStrings;
|
FOptions: TStrings;
|
||||||
@ -761,6 +762,8 @@ Type
|
|||||||
Property Archive : String Read FArchive Write FArchive; // zip $(ARCHIVE) $(FILESORDIRS)
|
Property Archive : String Read FArchive Write FArchive; // zip $(ARCHIVE) $(FILESORDIRS)
|
||||||
// Misc
|
// Misc
|
||||||
Property IgnoreInvalidOptions: Boolean read FIgnoreInvalidOptions write FIgnoreInvalidOptions;
|
Property IgnoreInvalidOptions: Boolean read FIgnoreInvalidOptions write FIgnoreInvalidOptions;
|
||||||
|
// Installation optioms
|
||||||
|
Property InstallExamples: Boolean read FInstallExamples write FInstallExamples;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TBasicDefaults }
|
{ TBasicDefaults }
|
||||||
@ -821,7 +824,7 @@ Type
|
|||||||
Function GetCompiler : String;
|
Function GetCompiler : String;
|
||||||
Function InstallPackageFiles(APAckage : TPackage; tt : TTargetType; Const Dest : String):Boolean;
|
Function InstallPackageFiles(APAckage : TPackage; tt : TTargetType; Const Dest : String):Boolean;
|
||||||
Procedure InstallUnitConfigFile(APAckage : TPackage; Const Dest : String);
|
Procedure InstallUnitConfigFile(APAckage : TPackage; Const Dest : String);
|
||||||
Function InstallPackageSourceFiles(APAckage : TPackage; tt : TSourceType; Const Dest : String):Boolean;
|
Function InstallPackageSourceFiles(APAckage : TPackage; stt : TSourceTypes; ttt : TTargetTypes; Const Dest : String):Boolean;
|
||||||
Function FileNewer(const Src,Dest : String) : Boolean;
|
Function FileNewer(const Src,Dest : String) : Boolean;
|
||||||
Procedure LogSearchPath(const ASearchPathName:string;Path:TConditionalStrings; ACPU:TCPU;AOS:TOS);
|
Procedure LogSearchPath(const ASearchPathName:string;Path:TConditionalStrings; ACPU:TCPU;AOS:TOS);
|
||||||
Function FindFileInPath(Path:TConditionalStrings; AFileName:String; var FoundPath:String;ACPU:TCPU;AOS:TOS):Boolean;
|
Function FindFileInPath(Path:TConditionalStrings; AFileName:String; var FoundPath:String;ACPU:TCPU;AOS:TOS):Boolean;
|
||||||
@ -1167,6 +1170,7 @@ ResourceString
|
|||||||
SHelpConfig = 'Use indicated config file when compiling.';
|
SHelpConfig = 'Use indicated config file when compiling.';
|
||||||
SHelpOptions = 'Pass extra options to the compiler.';
|
SHelpOptions = 'Pass extra options to the compiler.';
|
||||||
SHelpVerbose = 'Be verbose when working.';
|
SHelpVerbose = 'Be verbose when working.';
|
||||||
|
SHelpInstExamples = 'Install the example-sources.';
|
||||||
SHelpIgnoreInvOpt = 'Ignore further invalid options.';
|
SHelpIgnoreInvOpt = 'Ignore further invalid options.';
|
||||||
sHelpFpdocOutputDir = 'Use indicated directory as fpdoc output folder.';
|
sHelpFpdocOutputDir = 'Use indicated directory as fpdoc output folder.';
|
||||||
|
|
||||||
@ -1195,6 +1199,7 @@ Const
|
|||||||
KeyBinInstallDir = 'BinInstallDir';
|
KeyBinInstallDir = 'BinInstallDir';
|
||||||
KeyDocInstallDir = 'DocInstallDir';
|
KeyDocInstallDir = 'DocInstallDir';
|
||||||
KeyExamplesInstallDir = 'ExamplesInstallDir';
|
KeyExamplesInstallDir = 'ExamplesInstallDir';
|
||||||
|
KeyInstallExamples = 'InstallExamples';
|
||||||
// Keys for unit config
|
// Keys for unit config
|
||||||
KeyName = 'Name';
|
KeyName = 'Name';
|
||||||
KeyVersion = 'Version';
|
KeyVersion = 'Version';
|
||||||
@ -2381,17 +2386,24 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TPackage.GetInstallSourceFiles(List: TStrings; Types: TSourceTypes);
|
procedure TPackage.GetInstallSourceFiles(List: TStrings; SourceTypes : TSourceTypes; TargetTypes : TTargetTypes);
|
||||||
Var
|
Var
|
||||||
I : Integer;
|
I : Integer;
|
||||||
S : TSource;
|
S : TSource;
|
||||||
|
T : TTarget;
|
||||||
begin
|
begin
|
||||||
For I:=0 to FSources.Count-1 do
|
For I:=0 to FSources.Count-1 do
|
||||||
begin
|
begin
|
||||||
S:=FSources.SourceItems[I];
|
S:=FSources.SourceItems[I];
|
||||||
if (S.SourceType in Types) then
|
if (S.SourceType in SourceTypes) then
|
||||||
S.GetInstallFiles(List);
|
S.GetInstallFiles(List);
|
||||||
end;
|
end;
|
||||||
|
For I:=0 to FTargets.Count-1 do
|
||||||
|
begin
|
||||||
|
T:=FTargets.TargetItems[I];
|
||||||
|
if (T.TargetType in TargetTypes) then
|
||||||
|
T.GetArchiveFiles(List,Defaults.CPU,Defaults.OS);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -3042,6 +3054,8 @@ begin
|
|||||||
Values[KeyTarget]:=FTarget;
|
Values[KeyTarget]:=FTarget;
|
||||||
if FNoFPCCfg then
|
if FNoFPCCfg then
|
||||||
Values[KeyNoFPCCfg]:='Y';
|
Values[KeyNoFPCCfg]:='Y';
|
||||||
|
if FInstallExamples then
|
||||||
|
Values[KeyInstallExamples]:='Y';
|
||||||
end;
|
end;
|
||||||
L.SaveToStream(S);
|
L.SaveToStream(S);
|
||||||
Finally
|
Finally
|
||||||
@ -3099,6 +3113,7 @@ begin
|
|||||||
FBinInstallDir:=Values[KeyBinInstallDir];
|
FBinInstallDir:=Values[KeyBinInstallDir];
|
||||||
FDocInstallDir:=Values[KeyDocInstallDir];
|
FDocInstallDir:=Values[KeyDocInstallDir];
|
||||||
FExamplesInstallDir:=Values[KeyExamplesInstallDir];
|
FExamplesInstallDir:=Values[KeyExamplesInstallDir];
|
||||||
|
FInstallExamples:=(Upcase(Values[KeyInstallExamples])='Y');
|
||||||
FNoFPCCfg:=(Upcase(Values[KeyNoFPCCfg])='Y');
|
FNoFPCCfg:=(Upcase(Values[KeyNoFPCCfg])='Y');
|
||||||
end;
|
end;
|
||||||
Finally
|
Finally
|
||||||
@ -3361,6 +3376,8 @@ begin
|
|||||||
Defaults.Compiler:=OptionArg(I)
|
Defaults.Compiler:=OptionArg(I)
|
||||||
else if CheckOption(I,'f','config') then
|
else if CheckOption(I,'f','config') then
|
||||||
DefaultsFileName:=OptionArg(I)
|
DefaultsFileName:=OptionArg(I)
|
||||||
|
else if CheckOption(I,'ie','installexamples') then
|
||||||
|
Defaults.InstallExamples:=true
|
||||||
else if CheckOption(I,'io','ignoreinvalidoption') then
|
else if CheckOption(I,'io','ignoreinvalidoption') then
|
||||||
Defaults.IgnoreInvalidOptions:=true
|
Defaults.IgnoreInvalidOptions:=true
|
||||||
else if CheckOption(I,'d','doc-folder') then
|
else if CheckOption(I,'d','doc-folder') then
|
||||||
@ -3419,6 +3436,7 @@ begin
|
|||||||
LogOption('l','list-commands',SHelpList);
|
LogOption('l','list-commands',SHelpList);
|
||||||
LogOption('n','nofpccfg',SHelpNoFPCCfg);
|
LogOption('n','nofpccfg',SHelpNoFPCCfg);
|
||||||
LogOption('v','verbose',SHelpVerbose);
|
LogOption('v','verbose',SHelpVerbose);
|
||||||
|
LogOption('ie','installexamples',SHelpInstExamples);
|
||||||
LogArgOption('C','cpu',SHelpCPU);
|
LogArgOption('C','cpu',SHelpCPU);
|
||||||
LogArgOption('O','os',SHelpOS);
|
LogArgOption('O','os',SHelpOS);
|
||||||
LogArgOption('t','target',SHelpTarget);
|
LogArgOption('t','target',SHelpTarget);
|
||||||
@ -4903,14 +4921,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TBuildEngine.InstallPackageSourceFiles(APAckage: TPackage; tt: TSourceType; const Dest: String): Boolean;
|
function TBuildEngine.InstallPackageSourceFiles(APAckage : TPackage; stt : TSourceTypes; ttt : TTargetTypes; Const Dest : String): Boolean;
|
||||||
Var
|
Var
|
||||||
List : TStringList;
|
List : TStringList;
|
||||||
begin
|
begin
|
||||||
Result:=False;
|
Result:=False;
|
||||||
List:=TStringList.Create;
|
List:=TStringList.Create;
|
||||||
Try
|
Try
|
||||||
APackage.GetInstallSourceFiles(List,[tt]);
|
APackage.GetInstallSourceFiles(List,stt,ttt);
|
||||||
if (List.Count>0) then
|
if (List.Count>0) then
|
||||||
begin
|
begin
|
||||||
Result:=True;
|
Result:=True;
|
||||||
@ -4973,10 +4991,13 @@ begin
|
|||||||
//InstallPackageFiles(APAckage,ttExampleProgram,D);
|
//InstallPackageFiles(APAckage,ttExampleProgram,D);
|
||||||
// Documentation
|
// Documentation
|
||||||
D:=IncludeTrailingPathDelimiter(Defaults.DocInstallDir)+'fpc-'+APackage.FileName+PathDelim;
|
D:=IncludeTrailingPathDelimiter(Defaults.DocInstallDir)+'fpc-'+APackage.FileName+PathDelim;
|
||||||
InstallPackageSourceFiles(APackage,stDoc,D);
|
InstallPackageSourceFiles(APackage,[stDoc],[],D);
|
||||||
// Examples
|
// Examples
|
||||||
D:=IncludeTrailingPathDelimiter(Defaults.ExamplesInstallDir)+'fpc-'+APackage.FileName+PathDelim;
|
if Defaults.InstallExamples then
|
||||||
InstallPackageSourceFiles(APackage,stExample,D);
|
begin
|
||||||
|
D:=IncludeTrailingPathDelimiter(Defaults.ExamplesInstallDir)+'fpc-'+APackage.FileName+PathDelim+'examples'+PathDelim;
|
||||||
|
InstallPackageSourceFiles(APackage,[stExample],[ttExampleProgram,ttExampleUnit],D);
|
||||||
|
end;
|
||||||
// Done.
|
// Done.
|
||||||
APackage.FTargetState:=tsInstalled;
|
APackage.FTargetState:=tsInstalled;
|
||||||
DoAfterInstall(APackage);
|
DoAfterInstall(APackage);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user