Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 78 additions & 7 deletions .github/workflows/make.pas
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
Classes,
SysUtils,
StrUtils,
FileUtil,
Zipper,
fphttpclient,
RegExpr,
Expand All @@ -26,18 +25,90 @@

// Package path filter — skip platform-incompatible and template packages
PackageExcludePattern =
{$IFDEF MSWINDOWS}
{$IF DEFINED(MSWINDOWS)}
'(cocoa|x11|_template)'
{$ELSE}
{$ELSEIF DEFINED(DARWIN)}
'(gdi|x11|_template)'
{$ELSE}
'(cocoa|gdi|_template)'
{$ENDIF}
;
{$IFEND}
;

OPMBaseUrl = 'https://packages.lazarus-ide.org/';

var
ErrorCount: Integer = 0;

// ---------------------------------------------------------------------------
// FCL/RTL-only helpers (replace FileUtil usage)
// ---------------------------------------------------------------------------

function ReadFileToString(const AFileName: string): string;
var
Stream: TFileStream;
Size: Int64;
begin
Result := '';
Stream := TFileStream.Create(AFileName, fmOpenRead or fmShareDenyNone);
try
Size := Stream.Size;
if Size <= 0 then
Exit;
SetLength(Result, Size);
Stream.Position := 0;
Stream.ReadBuffer(Pointer(Result)^, Size);
finally
Stream.Free;
end;
end;

function MatchesMaskSimple(const AFileName, AMask: string): Boolean;
var
LExt: string;
begin
LExt := LowerCase(ExtractFileExt(AFileName));

if AMask = '*.lpk' then
Exit(LExt = '.lpk');

if AMask = '*.lpi' then
Exit(LExt = '.lpi');

Result := False;
end;

procedure FindAllFilesRecursive(const ADir, AMask: string; AList: TStrings);
var
Search: TSearchRec;
DirPath: string;
EntryPath: string;
begin
DirPath := IncludeTrailingPathDelimiter(ExpandFileName(ADir));

if FindFirst(DirPath + '*', faAnyFile, Search) = 0 then
try
repeat
if (Search.Name = '.') or (Search.Name = '..') then
Continue;

EntryPath := DirPath + Search.Name;

if (Search.Attr and faDirectory) <> 0 then
FindAllFilesRecursive(EntryPath, AMask, AList)
else if MatchesMaskSimple(Search.Name, AMask) then
AList.Add(EntryPath);
until FindNext(Search) <> 0;
finally
FindClose(Search);
end;
end;

function FindAllFilesList(const ASearchDir, AMask: string): TStringList;
begin
Result := TStringList.Create;
FindAllFilesRecursive(ASearchDir, AMask, Result);
end;

// ---------------------------------------------------------------------------
// Logging helpers
// ---------------------------------------------------------------------------
Expand Down Expand Up @@ -279,7 +350,7 @@ procedure RegisterAllPackages(const ASearchDir: string);
List: TStringList;
Each: string;
begin
List := FindAllFiles(ASearchDir, '*.lpk', True);
List := FindAllFilesList(ASearchDir, '*.lpk');
try
for Each in List do
RegisterPackage(Each);
Expand All @@ -297,7 +368,7 @@ procedure BuildAllProjects;
List: TStringList;
Each: string;
begin
List := FindAllFiles(Target, '*.lpi', True);
List := FindAllFilesList(Target, '*.lpi');
try
for Each in List do
if IsTestProject(Each) then
Expand Down
23 changes: 19 additions & 4 deletions .github/workflows/make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ jobs:
- ubuntu-latest
- ubuntu-24.04-arm
- windows-latest
- macos-latest

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: true

Expand All @@ -38,15 +39,29 @@ jobs:
run: |
set -xeuo pipefail
sudo bash -c 'apt-get update; apt-get install -y lazarus' >/dev/null
instantfpc -Fu/usr/lib/lazarus/*/components/lazutils .github/workflows/make.pas
instantfpc .github/workflows/make.pas

- name: Build on Linux (AArch64)
if: runner.os == 'Linux' && runner.arch == 'ARM64'
shell: bash
run: |
set -xeuo pipefail
sudo bash -c 'apt-get update; apt-get install -y lazarus' >/dev/null
instantfpc -Fu/usr/lib/lazarus/*/components/lazutils .github/workflows/make.pas
instantfpc .github/workflows/make.pas

- name: Install Lazarus on macOS
if: runner.os == 'macOS'
uses: gcarreno/setup-lazarus@v3
with:
lazarus-version: stable
with-cache: false

- name: Build on macOS
if: runner.os == 'macOS'
shell: bash
run: |
set -xeuo pipefail
instantfpc .github/workflows/make.pas

- name: Build on Windows
if: runner.os == 'Windows'
Expand All @@ -72,4 +87,4 @@ jobs:
Get-Command instantfpc

Write-Host "Building make.pas..."
instantfpc '-FuC:\Lazarus\components\lazutils' .github/workflows/make.pas
instantfpc .github/workflows/make.pas
Loading