Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync branch #599

Merged
merged 27 commits into from
Feb 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
23913ce
Updated snapcraft file
chronoscz Aug 26, 2022
3339999
Updated snap description.
chronoscz Jan 18, 2023
29a0ed9
Merge branch 'bgrabitmap:master' into master
chronoscz Nov 25, 2024
040dc73
Added flatpak packaging files.
chronoscz Dec 15, 2024
2a20fa8
Fixes for flathub review comments.
chronoscz Dec 16, 2024
5da0ba0
Fixed Qt5 crash. Do not use image browser by default due to needed ex…
chronoscz Dec 16, 2024
0da2ca5
Merge pull request #592 from chronoscz/master
circular17 Dec 29, 2024
b52c8d0
add github-actions
theavege Dec 29, 2024
09b2798
small fix
theavege Dec 30, 2024
34c0d6e
small fix
theavege Dec 30, 2024
9edf65d
remove make.files to .github
theavege Jan 1, 2025
31ed66e
add lint
theavege Jan 1, 2025
67808dc
fix lint part
theavege Jan 1, 2025
7e62bf8
fix lint part
theavege Jan 1, 2025
deb5c1e
PR #594 AboutText property no longer exists
circular17 Jan 9, 2025
82112d1
Merge pull request #594 from theavege/add/github-actions
circular17 Jan 9, 2025
0030de7
explicit error handling
circular17 Jan 9, 2025
ab1e705
fix error with Jekyll
circular17 Jan 9, 2025
8294055
Rewrote CI to Pascal
theavege Jan 15, 2025
1b7269a
Rewrote CI to Pascal
theavege Jan 15, 2025
5f40b96
Rewrote CI to Pascal
theavege Jan 15, 2025
906b69b
fix github-actions
theavege Jan 15, 2025
4d684fd
fix github-actions
theavege Jan 15, 2025
f16955a
fix github-actions
theavege Jan 16, 2025
cbfde42
return use/bgrabitmap and use/bgracontrols
theavege Jan 16, 2025
733d78d
Merge pull request #598 from theavege/upd/ci
circular17 Jan 22, 2025
87aa62a
Update lazarus version
circular17 Feb 22, 2025
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
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
237 changes: 237 additions & 0 deletions .github/workflows/make.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
program Make;
{$mode objfpc}{$H+}

uses
Classes,
SysUtils,
StrUtils,
FileUtil,
Zipper,
fphttpclient,
RegExpr,
openssl,
opensslsockets,
Process;

const
Target: string = 'lazpaint';
Dependencies: array of string = ();

type
TLog = (audit, info, error);
Output = record
Success: boolean;
Output: string;
end;

procedure OutLog(Knd: TLog; Msg: string);
begin
case Knd of
error: Writeln(stderr, #27'[31m', Msg, #27'[0m');
info: Writeln(stderr, #27'[32m', Msg, #27'[0m');
audit: Writeln(stderr, #27'[33m', Msg, #27'[0m');
end;
end;

function CheckModules: Output;
begin
if FileExists('.gitmodules') then
if RunCommand('git', ['submodule', 'update', '--init', '--recursive',
'--force', '--remote'], Result.Output) then
OutLog(info, Result.Output);
end;

function AddPackage(Path: string): Output;
begin
with TRegExpr.Create do
begin
Expression :=
{$IFDEF MSWINDOWS}
'(cocoa|x11|_template)'
{$ELSE}
'(cocoa|gdi|_template)'
{$ENDIF}
;
if not Exec(Path) and RunCommand('lazbuild', ['--add-package-link', Path],
Result.Output) then
OutLog(audit, 'added ' + Path);
Free;
end;
end;

function BuildProject(Path: string): Output;
var
Line: string;
begin
OutLog(audit, 'build from ' + Path);
try
Result.Success := RunCommand('lazbuild', ['--build-all', '--recursive',
'--no-write-project', Path], Result.Output);
if Result.Success then
for Line in SplitString(Result.Output, LineEnding) do
begin
if ContainsStr(Line, 'Linking') then
begin
Result.Output := SplitString(Line, ' ')[2];
OutLog(info, ' to ' + Result.Output);
break;
end;
end
else
begin
ExitCode += 1;
for Line in SplitString(Result.Output, LineEnding) do
with TRegExpr.Create do
begin
Expression := '(Fatal|Error):';
if Exec(Line) then
OutLog(error, #10 + Line);
Free;
end;
end;
except
on E: Exception do
OutLog(error, E.ClassName + #13#10 + E.Message);
end;
end;

function RunTest(Path: string): Output;
var
Temp: string;
begin
Result := BuildProject(Path);
Temp:= Result.Output;
if Result.Success then
try
if not RunCommand(Temp, ['--all', '--format=plain', '--progress'], Result.Output) then
begin
ExitCode += 1;
OutLog(error, Result.Output);
end;
except
on E: Exception do
OutLog(error, E.ClassName + #13#10 + E.Message);
end;
end;

function InstallOPM(Each: string): string;
var
OutFile, Uri: string;
Zip: TStream;
begin
Result :=
{$IFDEF MSWINDOWS}
GetEnvironmentVariable('APPDATA') + '\.lazarus\onlinepackagemanager\packages\'
{$ELSE}
GetEnvironmentVariable('HOME') + '/.lazarus/onlinepackagemanager/packages/'
{$ENDIF}
+ Each;
OutFile := GetTempFileName;
Uri := 'https://packages.lazarus-ide.org/' + Each + '.zip';
if not DirectoryExists(Result) then
begin
Zip := TFileStream.Create(OutFile, fmCreate or fmOpenWrite);
with TFPHttpClient.Create(nil) do
begin
try
AddHeader('User-Agent', 'Mozilla/5.0 (compatible; fpweb)');
AllowRedirect := True;
Get(Uri, Zip);
OutLog(audit, 'Download from ' + Uri + ' to ' + OutFile);
finally
Free;
end;
end;
Zip.Free;
CreateDir(Result);
with TUnZipper.Create do
begin
try
FileName := OutFile;
OutputPath := Result;
Examine;
UnZipAllFiles;
OutLog(audit, 'Unzip from ' + OutFile + ' to ' + Result);
finally
Free;
end;
end;
DeleteFile(OutFile);
end;
end;

function LintPython(Path: string): Output;
begin
OutLog(audit, 'Linting Python file: ' + Path);
if not RunCommand('python3', ['-m', 'pylint', Path], Result.Output) then
begin
OutLog(error, Result.Output);
//ExitCode += 1;
end
end;

function LintC(Path: string): Output;
begin
OutLog(audit, 'Linting C file: ' + Path);
if not RunCommand('cppcheck', ['--language=c', '--enable=warning,style', '--template=gcc', Path], Result.Output) then
begin
OutLog(error, Result.Output);
//ExitCode += 1;
end
end;

function LintShell(Path: string): Output;
begin
OutLog(audit, 'Linting Shell file: ' + Path);
if not RunCommand('shellcheck', ['--external-sources', Path], Result.Output) then
begin
OutLog(error, Result.Output);
//ExitCode += 1;
end
end;

procedure BuildAll;
var
Each, Item: string;
List: TStringList;
begin
CheckModules;
InitSSLInterface;
for Item in Dependencies do
begin
List := FindAllFiles(InstallOPM(Item), '*.lpk', True);
try
for Each in List do
AddPackage(Each);
finally
List.Free;
end;
end;
List := FindAllFiles(GetCurrentDir, '*.lpk', True);
try
for Each in List do
AddPackage(Each);
finally
List.Free;
end;
List := FindAllFiles(Target, '*.lpi', True);
try
for Each in List do
if not ContainsStr(Each, 'zengl') then
if ContainsStr(ReadFileToString(ReplaceStr(Each, '.lpi', '.lpr')),
'consoletestrunner') then
RunTest(Each)
else
BuildProject(Each);
finally
List.Free;
end;
if ExitCode <> 0 then
OutLog(error, #10 + 'Errors: ' + IntToStr(ExitCode))
else
OutLog(info, #10 + 'Errors: ' + IntToStr(ExitCode));
end;

begin
BuildAll;
end.
56 changes: 56 additions & 0 deletions .github/workflows/make.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
name: Make

on:
schedule:
- cron: '0 0 1 * *'
push:
branches:
- "**"
pull_request:
branches:
- master
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 120
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true

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

- name: Build on Windows
if: runner.os == 'Windows'
shell: powershell
run: |
New-Variable -Option Constant -Name VAR -Value @{
Uri = 'https://fossies.org/windows/misc/lazarus-3.8-fpc-3.2.2-win64.exe'
OutFile = (New-TemporaryFile).FullName + '.exe'
}
Invoke-WebRequest @VAR
& $VAR.OutFile.Replace('Temp', 'Temp\.') /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Null
$Env:PATH+=';C:\Lazarus'
$Env:PATH+=';C:\Lazarus\fpc\3.2.2\bin\x86_64-win64'
(Get-Command 'lazbuild').Source | Out-Host
(Get-Command 'instantfpc').Source | Out-Host
instantfpc '-FuC:\Lazarus\components\lazutils' .github/workflows/make.pas
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "use/bgrabitmap"]
path = use/bgrabitmap
url = [email protected]:bgrabitmap/bgrabitmap.git
[submodule "use/bgracontrols"]
path = use/bgracontrols
url = [email protected]:bgrabitmap/bgracontrols.git
45 changes: 45 additions & 0 deletions Install/flatpak/0001-515-runtime-fix-for-Qt.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From 11b9c647dd96edaf4a3240a3683493fb37a0e0e0 Mon Sep 17 00:00:00 2001
From: Johann ELSASS <[email protected]>
Date: Thu, 28 Dec 2023 16:40:48 +0100
Subject: [PATCH] #515 runtime fix for Qt

---
lazpaint/lazpaintmainform.lfm | 1 +
lazpaint/lazpaintmainform.pas | 2 ++
2 files changed, 3 insertions(+)

diff --git a/lazpaint/lazpaintmainform.lfm b/lazpaint/lazpaintmainform.lfm
index a2dffa1..2765760 100644
--- a/lazpaint/lazpaintmainform.lfm
+++ b/lazpaint/lazpaintmainform.lfm
@@ -5769,6 +5769,7 @@ object FMain: TFMain
Top = 514
end
object TimerUpdate: TTimer
+ Enabled = False
Interval = 50
OnTimer = TimerUpdateTimer
Left = 653
diff --git a/lazpaint/lazpaintmainform.pas b/lazpaint/lazpaintmainform.pas
index 708cb24..551c7d0 100644
--- a/lazpaint/lazpaintmainform.pas
+++ b/lazpaint/lazpaintmainform.pas
@@ -1251,6 +1251,7 @@ begin
UpdateToolBar;
FShouldArrange := true;
QueryArrange;
+ TimerUpdate.Enabled := true;
end;

procedure TFMain.OnLatestVersionUpdate(ANewVersion: string);
@@ -2593,6 +2594,7 @@ end;

procedure TFMain.FormHide(Sender: TObject);
begin
+ TimerUpdate.Enabled := false;
FShouldArrange := false;
FTopMostInfo := LazPaintInstance.HideTopmost;
LazPaintInstance.SaveMainWindowPosition;
--
2.43.0

37 changes: 37 additions & 0 deletions Install/flatpak/0001-avoid-crash-on-Qt5.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
From d73455025d71226472e7eb880da36f6fb85c5df0 Mon Sep 17 00:00:00 2001
From: Johann ELSASS <[email protected]>
Date: Thu, 6 Oct 2022 21:44:47 +0200
Subject: [PATCH] avoid crash on Qt5

---
lazpaint/lazpaintinstance.pas | 1 +
lazpaint/lazpaintmainform.pas | 1 +
2 files changed, 2 insertions(+)

diff --git a/lazpaint/lazpaintinstance.pas b/lazpaint/lazpaintinstance.pas
index 5da9ac6..b5f624b 100644
--- a/lazpaint/lazpaintinstance.pas
+++ b/lazpaint/lazpaintinstance.pas
@@ -374,6 +374,7 @@ procedure TLazPaintInstance.ReportActionProgress(AProgressPercent: integer);
var
delay: Integer;
begin
+ {$IFDEF LCLqt5}exit;{$ENDIF}
if AProgressPercent < 100 then delay := 10000 else delay := 1000;
if Assigned(FMain) then FMain.UpdatingPopup:= true;
try
diff --git a/lazpaint/lazpaintmainform.pas b/lazpaint/lazpaintmainform.pas
index 0fe875c..708cb24 100644
--- a/lazpaint/lazpaintmainform.pas
+++ b/lazpaint/lazpaintmainform.pas
@@ -2695,6 +2695,7 @@ end;

procedure TFMain.TimerUpdateTimer(Sender: TObject);
begin
+ if FLazPaintInstance = nil then exit;
TimerUpdate.Enabled := false;
if ToolManager.ToolSleeping and not spacePressed and
([ssLeft,ssRight,ssMiddle] * FLayout.MouseButtonState = []) then
--
2.43.0

Loading