Make idfpath and idf_version macros available as replacement vars in fpc.cfg

This commit is contained in:
Michael Ring 2024-05-29 13:31:22 +02:00 committed by FPK
parent 14b3c11c0d
commit e0229632fb

View File

@ -986,6 +986,22 @@ implementation
result:=getrealtime(st);
end;
function idfversionstring(version : longint):string;
{
Convert back the numerical idf_version for esp32 to string
}
begin
result := '';
if version > 0 then
begin
result := inttostr(version div 10000)+'.';
version := version - (version div 10000)*10000;
result := result + inttostr(version div 100)+'.';
version := version - (version div 100)*100;
result := result + inttostr(version);
end;
end;
{****************************************************************************
Default Macro Handling
****************************************************************************}
@ -1065,6 +1081,19 @@ implementation
Replace(s,'$OPENBSD_LOCALBASE',GetOpenBSDLocalBase);
Replace(s,'$OPENBSD_X11BASE',GetOpenBSDX11Base);
{$endif openbsd}
{$ifdef xtensa}
if idf_version > 0 then
Replace(s,'$IDF_VERSION',idfversionstring(idf_version));
if idfpath <> '' then
Replace(s,'$IDFPATH',idfpath);
{$endif xtensa}
{$ifdef riscv32}
if idf_version > 0 then
Replace(s,'$IDF_VERSION',idfversionstring(idf_version));
if idfpath <> '' then
Replace(s,'$IDFPATH',idfpath);
{$endif riscv32}
if not substitute_env_variables then
exit;
{ Replace environment variables between dollar signs }