Skip to content

Commit

Permalink
Use the new libs.
Browse files Browse the repository at this point in the history
  • Loading branch information
LongDirtyAnimAlf committed Jul 14, 2023
1 parent 3cb7fd8 commit 1bdbf21
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 30 deletions.
2 changes: 1 addition & 1 deletion public/gitrevision.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[master]crosslibs_all-2786(5ebd61f)
[master]crosslibs_all-2787(3cb7fd8)
3 changes: 3 additions & 0 deletions sources/installercore.pas
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ interface

DIFFMAGIC = 'revhash_';

NEWLIBSTAG = 'crosslibs_all';
OLDLIBSTAG = 'crosslibs';

//Sequence contants for statemachine

_SEP = ';';
Expand Down
105 changes: 80 additions & 25 deletions sources/installermanager.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,20 @@ procedure TFPCupManager.GetCrossToolsFileName(out BinsFileName,LibsFileName:stri
{$else}
BinsFileName:='CrossBins'+BinsFileName;
{$endif MSWINDOWS}

// Check for the new libs !!
if (CrossOS_Target=TOS.linux) then
begin
s:='';
if (CrossCPU_Target=TCPU.arm) then s:='LinuxARMHF_Raspbian_09.zip';
if (CrossCPU_Target=TCPU.x86_64) then s:='LinuxAMD64_Ubuntu_1804.zip';
if (CrossCPU_Target=TCPU.i386) then s:='Linuxi386_Ubuntu_1804.zip';
if (Length(s)>0) then
begin
LibsFileName:=s;
end;
end;

end;

procedure TFPCupManager.GetCrossToolsPath(out BinPath,LibPath:string);
Expand Down Expand Up @@ -1450,7 +1464,7 @@ function TFPCupManager.GetCrossLibsURL(out BaseLibsURL:string; var LibsFileName:
begin
result:=false;

BaseLibsURL:='crosslibs';
BaseLibsURL:='notfound';

s:=GetURLDataFromCache(FPCUPGITREPOAPIRELEASES+'?per_page=100');
success:=(Length(s)>0);
Expand All @@ -1475,47 +1489,88 @@ function TFPCupManager.GetCrossLibsURL(out BaseLibsURL:string; var LibsFileName:

success:=false;
FileURL:='';
for i:=0 to Pred(Json.Count) do

// First, look for new libs

if (NOT success) then
begin
Item := TJSONObject(Json.Items[i]);
TagName:=Item{%H-}.Get('tag_name');
if (Pos(BaseLibsURL,TagName)<>1) then continue;
Assets:=Item.Get('assets',TJSONArray(nil));
// Search zip
for iassets:=0 to Pred(Assets.Count) do
BaseLibsURL:=NEWLIBSTAG;
for i:=0 to Pred(Json.Count) do
begin
Asset := TJSONObject(Assets[iassets]);
FileName:=Asset{%H-}.Get('name');
if AnsiStartsText(LibsFileName+'.zip',FileName) then
Item := TJSONObject(Json.Items[i]);
TagName:=Item{%H-}.Get('tag_name');
success:=(BaseLibsURL=TagName);
if success then break;
end;
if success then
begin
success:=false;
Assets:=Item.Get('assets',TJSONArray(nil));
// Search zip
for iassets:=0 to Pred(Assets.Count) do
begin
LibsFileName:=FileName;
FileURL:=Asset{%H-}.Get('browser_download_url');
Asset := TJSONObject(Assets[iassets]);
FileName:=Asset{%H-}.Get('name');
if (FileName=LibsFileName) then
begin
FileURL:=Asset{%H-}.Get('browser_download_url');
end;
success:=(Length(FileURL)>0);
if success then
begin
BaseLibsURL:=FileURL;
result:=true;
break;
end;
end;
success:=(Length(FileURL)>0);
if success then break;
end;
if (NOT success) then
end;

if (NOT success) then
begin
BaseLibsURL:=OLDLIBSTAG;
for i:=0 to Pred(Json.Count) do
begin
// Search any
Item := TJSONObject(Json.Items[i]);
TagName:=Item{%H-}.Get('tag_name');
if (Pos(BaseLibsURL,TagName)<>1) then continue;
Assets:=Item.Get('assets',TJSONArray(nil));
// Search zip
for iassets:=0 to Pred(Assets.Count) do
begin
Asset := TJSONObject(Assets[iassets]);
FileName:=Asset{%H-}.Get('name');
if ((ExtractFileExt(FileName)<>'.zip') AND AnsiStartsText(LibsFileName,FileName)) then
if AnsiStartsText(LibsFileName+'.zip',FileName) then
begin
LibsFileName:=FileName;
FileURL:=Asset{%H-}.Get('browser_download_url');
end;
success:=(Length(FileURL)>0);
if success then break;
end;
end;
if success then
begin
BaseLibsURL:=FileURL;
LibsFileName:=FileName;
result:=true;
break;
if (NOT success) then
begin
// Search any
for iassets:=0 to Pred(Assets.Count) do
begin
Asset := TJSONObject(Assets[iassets]);
FileName:=Asset{%H-}.Get('name');
if ((ExtractFileExt(FileName)<>'.zip') AND AnsiStartsText(LibsFileName,FileName)) then
begin
LibsFileName:=FileName;
FileURL:=Asset{%H-}.Get('browser_download_url');
end;
success:=(Length(FileURL)>0);
if success then break;
end;
end;
if success then
begin
BaseLibsURL:=FileURL;
LibsFileName:=FileName;
result:=true;
break;
end;
end;
end;

Expand Down
6 changes: 3 additions & 3 deletions sources/revision.inc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const
{%H-}DELUXEVERSION='2.2.0t';
{%H-}RevisionStr='474';
{%H-}VersionDate='20230710';
{%H-}DELUXEVERSION='2.4.0a';
{%H-}RevisionStr='476';
{%H-}VersionDate='20230714';
8 changes: 7 additions & 1 deletion sources/updeluxe/fpcupdeluxemainform.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3322,6 +3322,7 @@ function TForm1.ProcessCrossCompiler(Sender: TObject):boolean;
FPCupManager.GetCrossToolsFileName(BinsFileName,LibsFileName);
FPCupManager.GetCrossToolsPath(BinPath,LibPath);


// bit tricky ... if bins and/or libs are already there exit this retry ... ;-)
if (NOT DirectoryIsEmpty(IncludeTrailingPathDelimiter(FPCupManager.BaseDirectory)+BinPath)) then MissingCrossBins:=false;

Expand Down Expand Up @@ -3500,7 +3501,12 @@ function TForm1.ProcessCrossCompiler(Sender: TObject):boolean;
begin
ZipFile:=(ExtractFileExt(ToolTargetFile)='.zip');
ToolTargetPath:=IncludeTrailingPathDelimiter(FPCupManager.BaseDirectory);
//ToolTargetPath:=IncludeTrailingPathDelimiter(FPCupManager.BaseDirectory)+LibPath+DirectorySeparator;
// Check if we have the new libs
if (Pos(NEWLIBSTAG,BaseLibsURL)>0) then
begin
ToolTargetPath:=IncludeTrailingPathDelimiter(FPCupManager.BaseDirectory)+LibPath+DirectorySeparator;
end;

ForceDirectoriesSafe(ToolTargetPath);

AddMessage('Going to extract archive into '+ToolTargetPath);
Expand Down

0 comments on commit 1bdbf21

Please sign in to comment.