* Enabled usage of dictionary-macros in DocInstallDir and ExamplesInstallDir

* Install examples in examples/<packagename> on non-unices
 * Install examples in share/examples/<packagename> on FreeBSD
 * Install docs in share/doc/<packagename> on FreeBSD

git-svn-id: trunk@28982 -
This commit is contained in:
joost 2014-11-04 08:04:44 +00:00
parent 91eac4986d
commit d011c8b423

View File

@ -3771,11 +3771,12 @@ function TCustomDefaults.GetDocInstallDir: String;
begin begin
If (FDocInstallDir<>'') then If (FDocInstallDir<>'') then
Result:=FDocInstallDir Result:=FDocInstallDir
else if Defaults.BuildOS=freebsd then
result := Prefix+PathDelim+'share'+PathDelim+'doc'+PathDelim+'$(PackageName)'
else If UnixPaths then
Result:=Prefix+'share'+PathDelim+'doc'+PathDelim+'fpc-$(PackageName)-$(PACKAGEVERSION)'
else else
If UnixPaths then Result:=BaseInstallDir+'docs'+PathDelim+'$(PackageName)';
Result:=Prefix+'share'+PathDelim+'doc'
else
Result:=BaseInstallDir+'docs';
end; end;
@ -3783,11 +3784,12 @@ function TCustomDefaults.GetExamplesInstallDir: String;
begin begin
If (FExamplesInstallDir<>'') then If (FExamplesInstallDir<>'') then
Result:=FExamplesInstallDir Result:=FExamplesInstallDir
else if Defaults.BuildOS=freebsd then
result := Prefix+PathDelim+'share'+PathDelim+'examples'+PathDelim+'$(PackageName)'
else If UnixPaths then
Result:=Prefix+'share'+PathDelim+'doc'+PathDelim+'fpc-$(PackageName)-$(PACKAGEVERSION)'+PathDelim+'examples'
else else
If UnixPaths then Result:=BaseInstallDir+'examples'+PathDelim+'$(PackageName)';
Result:=Prefix+'share'+PathDelim+'doc'
else
Result:=BaseInstallDir+'examples';
end; end;
function TCustomDefaults.GetOptions: TStrings; function TCustomDefaults.GetOptions: TStrings;
@ -3810,7 +3812,7 @@ end;
function TCustomDefaults.GetUnitInstallDir: String; function TCustomDefaults.GetUnitInstallDir: String;
begin begin
result := FixPath(GlobalDictionary.ReplaceStrings(FUnitInstallDir), False); result := FUnitInstallDir;
end; end;
@ -3945,7 +3947,7 @@ end;
procedure TCustomDefaults.SetUnitInstallDir(const AValue: String); procedure TCustomDefaults.SetUnitInstallDir(const AValue: String);
begin begin
if AValue<>'' then if AValue<>'' then
FUnitInstallDir:=IncludeTrailingPathDelimiter(AValue) FUnitInstallDir:=AValue
else else
FUnitInstallDir:=''; FUnitInstallDir:='';
end; end;
@ -5406,6 +5408,7 @@ begin
APackage.Dictionary.AddVariable('BINOUTPUTDIR',AddPathPrefix(APackage,APackage.GetBinOutputDir(Defaults.CPU,Defaults.OS))); APackage.Dictionary.AddVariable('BINOUTPUTDIR',AddPathPrefix(APackage,APackage.GetBinOutputDir(Defaults.CPU,Defaults.OS)));
APackage.Dictionary.AddVariable('PACKAGEVERSION',APackage.Version); APackage.Dictionary.AddVariable('PACKAGEVERSION',APackage.Version);
APackage.Dictionary.AddVariable('PACKAGEDIRECTORY',APackage.Directory); APackage.Dictionary.AddVariable('PACKAGEDIRECTORY',APackage.Directory);
APackage.Dictionary.AddVariable('PackageName',APackage.Name);
end; end;
Procedure TBuildEngine.ResolveFileNames(APackage : TPackage; ACPU:TCPU;AOS:TOS;DoChangeDir:boolean=true; WarnIfNotFound:boolean=true); Procedure TBuildEngine.ResolveFileNames(APackage : TPackage; ACPU:TCPU;AOS:TOS;DoChangeDir:boolean=true; WarnIfNotFound:boolean=true);
@ -6687,8 +6690,8 @@ begin
DoBeforeInstall(APackage); DoBeforeInstall(APackage);
// units // units
B:=false; B:=false;
GlobalDictionary.AddVariable('PackageName',APackage.Name); AddPackageMacrosToDictionary(APackage, APackage.Dictionary);
GlobalDictionary.AddVariable('unitinstalldir',Defaults.UnitInstallDir); GlobalDictionary.AddVariable('unitinstalldir', FixPath(APackage.Dictionary.ReplaceStrings(Defaults.UnitInstallDir), False));
GlobalDictionary.AddVariable('packageunitinstalldir',APackage.GetPackageUnitInstallDir(Defaults.CPU,Defaults.OS)); GlobalDictionary.AddVariable('packageunitinstalldir',APackage.GetPackageUnitInstallDir(Defaults.CPU,Defaults.OS));
D:=FixPath(Defaults.Prefix); D:=FixPath(Defaults.Prefix);
@ -6696,14 +6699,14 @@ begin
// target // target
if InstallPackageFiles(APackage,[],D) then if InstallPackageFiles(APackage,[],D) then
B:=true; B:=true;
D:=IncludeTrailingPathDelimiter(Defaults.UnitInstallDir)+APackage.GetPackageUnitInstallDir(Defaults.CPU,Defaults.OS); D:=FixPath(APackage.Dictionary.ReplaceStrings(Defaults.UnitInstallDir), True)+APackage.GetPackageUnitInstallDir(Defaults.CPU,Defaults.OS);
if InstallPackageFiles(APackage,[ttUnit, ttImplicitUnit],D) then if InstallPackageFiles(APackage,[ttUnit, ttImplicitUnit],D) then
B:=true; B:=true;
// By default do not install the examples. Maybe add an option for this later // By default do not install the examples. Maybe add an option for this later
//if InstallPackageFiles(APAckage,ttExampleUnit,D) then //if InstallPackageFiles(APAckage,ttExampleUnit,D) then
// B:=true; // B:=true;
// Unit (dependency) configuration if there were units installed // Unit (dependency) configuration if there were units installed
D:=IncludeTrailingPathDelimiter(Defaults.UnitInstallDir); D:=FixPath(APackage.Dictionary.ReplaceStrings(Defaults.UnitInstallDir), True);
if B then if B then
InstallUnitConfigFile(APackage,D); InstallUnitConfigFile(APackage,D);
// Programs // Programs
@ -6711,12 +6714,12 @@ begin
InstallPackageFiles(APAckage,[ttProgram],D); InstallPackageFiles(APAckage,[ttProgram],D);
//InstallPackageFiles(APAckage,ttExampleProgram,D); //InstallPackageFiles(APAckage,ttExampleProgram,D);
// Documentation // Documentation
D:=IncludeTrailingPathDelimiter(Defaults.DocInstallDir)+'fpc-'+APackage.FileName+PathDelim; D:=FixPath(APackage.Dictionary.ReplaceStrings(Defaults.DocInstallDir), True);
InstallPackageSourceFiles(APackage,[stDoc],[],D); InstallPackageSourceFiles(APackage,[stDoc],[],D);
// Examples // Examples
if Defaults.InstallExamples then if Defaults.InstallExamples then
begin begin
D:=IncludeTrailingPathDelimiter(Defaults.ExamplesInstallDir)+'fpc-'+APackage.FileName+PathDelim+'examples'+PathDelim; D:=FixPath(APackage.Dictionary.ReplaceStrings(Defaults.ExamplesInstallDir), True);
InstallPackageSourceFiles(APackage,[stExample],[ttExampleProgram,ttExampleUnit],D); InstallPackageSourceFiles(APackage,[stExample],[ttExampleProgram,ttExampleUnit],D);
end; end;
// Done. // Done.