mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 06:06:17 +02:00
* Search config file in same directory as actual compiler binary
This commit is contained in:
parent
0028e6816f
commit
b2c7f852d6
@ -265,7 +265,7 @@ Const
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function FindConfigFile(const aFile : string) : String;
|
Function FindConfigFile(const aFile : string; const aCompiler : String) : String;
|
||||||
// Adapted from check_configfile(fn:string; var foundfn:string):boolean;
|
// Adapted from check_configfile(fn:string; var foundfn:string):boolean;
|
||||||
{
|
{
|
||||||
Order to read configuration file :
|
Order to read configuration file :
|
||||||
@ -286,6 +286,7 @@ Function FindConfigFile(const aFile : string) : String;
|
|||||||
}
|
}
|
||||||
|
|
||||||
var
|
var
|
||||||
|
{$ifdef unix}sl : rawbytestring;{$endif}
|
||||||
{$ifdef unix}hs,{$endif} aSearchPath,exepath,configpath : string;
|
{$ifdef unix}hs,{$endif} aSearchPath,exepath,configpath : string;
|
||||||
|
|
||||||
Procedure AddToPath(aDir : String);
|
Procedure AddToPath(aDir : String);
|
||||||
@ -313,7 +314,22 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
if configpath='' then
|
if configpath='' then
|
||||||
|
begin
|
||||||
|
{
|
||||||
|
We need to search relative to compiler binary, not relative to FPC binary.
|
||||||
|
Beware of symlinks !
|
||||||
|
}
|
||||||
|
hs:=aCompiler;
|
||||||
|
While FileGetSymLinkTarget(hs,sl) do
|
||||||
|
begin
|
||||||
|
if copy(sl,1,1)<>'/' then
|
||||||
|
hs:=ExpandFileName(ExtractFilePath(hs)+sl)
|
||||||
|
else
|
||||||
|
hs:=sl;
|
||||||
|
end;
|
||||||
|
ExePath:=ExtractFilePath(hs);
|
||||||
configpath:=ExpandFileName(ExePath+'../etc/');
|
configpath:=ExpandFileName(ExePath+'../etc/');
|
||||||
|
end;
|
||||||
{$endif}
|
{$endif}
|
||||||
AddToPath(ConfigPath);
|
AddToPath(ConfigPath);
|
||||||
{$ifdef WINDOWS}
|
{$ifdef WINDOWS}
|
||||||
@ -467,16 +483,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
ppcbin := findcompiler(ppcbin, cpusuffix, exesuffix);
|
||||||
if (TargetName<>'') then
|
if (TargetName<>'') then
|
||||||
begin
|
begin
|
||||||
S:='fpc-'+lowercase(TargetName)+'.cfg';
|
S:='fpc-'+lowercase(TargetName)+'.cfg';
|
||||||
CfgFile:=FindConfigFile(s);
|
CfgFile:=FindConfigFile(s,ppcbin);
|
||||||
if CfgFile='' then
|
if CfgFile='' then
|
||||||
Error('Cannot find subtarget config file: '+s);
|
Error('Cannot find subtarget config file: '+s);
|
||||||
ProcessConfigFile(CfgFile,ExeSuffix);
|
ProcessConfigFile(CfgFile,ExeSuffix);
|
||||||
end;
|
end;
|
||||||
SetLength(ppccommandline, ppccommandlinelen);
|
SetLength(ppccommandline, ppccommandlinelen);
|
||||||
ppcbin := findcompiler(ppcbin, cpusuffix, exesuffix);
|
|
||||||
|
|
||||||
{ call ppcXXX }
|
{ call ppcXXX }
|
||||||
try
|
try
|
||||||
|
Loading…
Reference in New Issue
Block a user