From 23913cef17bce0e5b86202c7cdd16f2c84dbe119 Mon Sep 17 00:00:00 2001 From: Chronos Date: Fri, 26 Aug 2022 13:29:55 +0200 Subject: [PATCH 01/23] Updated snapcraft file --- Install/snap/local/build.sh | 2 +- Install/snap/snapcraft.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Install/snap/local/build.sh b/Install/snap/local/build.sh index 99a1e1f8..bb78ccdb 100755 --- a/Install/snap/local/build.sh +++ b/Install/snap/local/build.sh @@ -3,7 +3,7 @@ ln -s Install/snap ../../../snap pushd ../../.. -snapcraft --debug --use-lxd +snapcraft --debug --use-lxd $@ popd rm ../../../snap diff --git a/Install/snap/snapcraft.yaml b/Install/snap/snapcraft.yaml index 89792f9f..32ccb7af 100644 --- a/Install/snap/snapcraft.yaml +++ b/Install/snap/snapcraft.yaml @@ -1,6 +1,6 @@ name: lazpaint title: LazPaint -version: '7.1.6' +version: '7.2.2' summary: Image editor with raster and vector layers. description: | Can read layered files (lzp, ora, pdn, oXo, flat psd), multi-images (gif, ico, tiff), flat files (bmp, jpeg, pcx, png, tga, webp, xpm, xwd), raw images (dng, cr2, nef, arw...), vectorial (svg), 3D (obj). Has drawing tools, vector shapes, phong shading, curve adjustments, filters, render some textures, Python scripting. Uses Qt5 widgetset. @@ -19,10 +19,10 @@ parts: - wget - libgtk2.0-dev override-build: | - wget -nc https://deac-ams.dl.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.0.12/lazarus-project_2.0.12-0_amd64.deb - wget -nc https://netix.dl.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.0.12/fpc-laz_3.2.0-1_amd64.deb - wget -nc https://netix.dl.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.0.12/fpc-src_3.2.0-1_amd64.deb - apt install ./lazarus-project_2.0.12-0_amd64.deb ./fpc-laz_3.2.0-1_amd64.deb ./fpc-src_3.2.0-1_amd64.deb + wget -nc https://downloads.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.2.2/lazarus-project_2.2.2-0_amd64.deb + wget -nc https://downloads.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.2.2/fpc-laz_3.2.2-210709_amd64.deb + wget -nc https://downloads.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.2.2/fpc-src_3.2.2-210709_amd64.deb + apt install ./lazarus-project_2.2.2-0_amd64.deb ./fpc-laz_3.2.2-210709_amd64.deb ./fpc-src_3.2.2-210709_amd64.deb prime: [-*] lazpaint: plugin: nil From 33399993475baee4007e45fa9a6eb3bb977798d0 Mon Sep 17 00:00:00 2001 From: Chronos Date: Wed, 18 Jan 2023 22:20:11 +0100 Subject: [PATCH 02/23] Updated snap description. --- Install/snap/snapcraft.yaml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Install/snap/snapcraft.yaml b/Install/snap/snapcraft.yaml index 32ccb7af..7ee4079a 100644 --- a/Install/snap/snapcraft.yaml +++ b/Install/snap/snapcraft.yaml @@ -3,7 +3,44 @@ title: LazPaint version: '7.2.2' summary: Image editor with raster and vector layers. description: | + Free cross-platform image editor with raster and vector layers, written in Lazarus (Free Pascal). Can read layered files (lzp, ora, pdn, oXo, flat psd), multi-images (gif, ico, tiff), flat files (bmp, jpeg, pcx, png, tga, webp, xpm, xwd), raw images (dng, cr2, nef, arw...), vectorial (svg), 3D (obj). Has drawing tools, vector shapes, phong shading, curve adjustments, filters, render some textures, Python scripting. Uses Qt5 widgetset. + + **Features** + * Files: read and write a variety of file formats, including layered bitmaps and 3D files. + * Tools: many tools are available to draw on the layers. + * Edit/Select: select parts of an image with antialiasing and modify the selection as a mask. + * View: color window, layer stack window and toolbox window. + * Command line: call LazPaint from a console. + + **Image manipulation** + * An image can be resampled, flipped horizontally and vertically. + * Smart zoom x3 : resize the image x3 and detects borders; this provides a useful zoom with ancient games sprites. + + **Color manipulation** + * Colorize : set the color of an image while preserving intensities + * Shift colors : cycle colors and change colorness (saturation) + * Intensity : make colors lighter or darker without making them white + * Lightness : make colors lighter or darker by making them whiter + * Normalize : use the whole range of each color channel and alpha channel + * Negative : invert colors (with gamma correction) + * Linear negative : invert colors (without gamma correction) + * Grayscale : converts colors to grayscale with gamma correction + + **Filters** + Filters can be applied to the whole image or to the active selection. + * Radial blur : non directional blur + * Motion blur : directional blur + * Custom blur : blur according to a mask + * Sharpen : makes contours more accurate, complementary to Smooth + * Smooth : softens whole image, complementary to Sharpen + * Median : computes the median of colors around each pixel, which softens corners + * Contour : draws contours on a white background (like a pencil drawing) + * Emboss : draws contours with shadow + * Sphere : spherical projection + * Cylinder : cylinder projection + * Clouds : add clouds of the current pen color + * Scripts: scripts are provided to do layer effects. You can as well write your own Python scripts. confinement: strict base: core20 grade: stable From 040dc731315956be584cfb076d9685f41f207a73 Mon Sep 17 00:00:00 2001 From: Chronos Date: Sun, 15 Dec 2024 23:56:01 +0100 Subject: [PATCH 03/23] Added flatpak packaging files. --- .../flatpak/0001-515-runtime-fix-for-Qt.patch | 45 +++++ Install/flatpak/build.sh | 22 +++ .../io.github.bgrabitmap.LazPaint.desktop | 13 ++ ...io.github.bgrabitmap.LazPaint.metainfo.xml | 187 ++++++++++++++++++ .../flatpak/io.github.bgrabitmap.LazPaint.yml | 60 ++++++ 5 files changed, 327 insertions(+) create mode 100644 Install/flatpak/0001-515-runtime-fix-for-Qt.patch create mode 100755 Install/flatpak/build.sh create mode 100644 Install/flatpak/io.github.bgrabitmap.LazPaint.desktop create mode 100644 Install/flatpak/io.github.bgrabitmap.LazPaint.metainfo.xml create mode 100644 Install/flatpak/io.github.bgrabitmap.LazPaint.yml diff --git a/Install/flatpak/0001-515-runtime-fix-for-Qt.patch b/Install/flatpak/0001-515-runtime-fix-for-Qt.patch new file mode 100644 index 00000000..00ad3579 --- /dev/null +++ b/Install/flatpak/0001-515-runtime-fix-for-Qt.patch @@ -0,0 +1,45 @@ +From 11b9c647dd96edaf4a3240a3683493fb37a0e0e0 Mon Sep 17 00:00:00 2001 +From: Johann ELSASS +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 + diff --git a/Install/flatpak/build.sh b/Install/flatpak/build.sh new file mode 100755 index 00000000..9b7706ea --- /dev/null +++ b/Install/flatpak/build.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -x + +BUILD_DIR=build +REPO_DIR=repo +FLATPAK_ID=io.github.bgrabitmap.LazPaint + +# Install dependencies +flatpak install --system flathub org.kde.Sdk//5.15-24.08 +flatpak install --system flathub org.kde.Platform//5.15-24.08 +flatpak install --system flathub org.freedesktop.Sdk.Extension.freepascal//24.08 +flatpak install --system flathub org.flatpak.Builder + +# Build +flatpak run org.flatpak.Builder --force-clean --sandbox --user --install --ccache --mirror-screenshots-url=https://dl.flathub.org/media/ --repo=$REPO_DIR $BUILD_DIR $FLATPAK_ID.yml + +# Run +flatpak run $FLATPAK_ID + +# Linter +flatpak run --command=flatpak-builder-lint org.flatpak.Builder manifest $FLATPAK_ID.yml +flatpak run --command=flatpak-builder-lint org.flatpak.Builder repo $REPO_DIR diff --git a/Install/flatpak/io.github.bgrabitmap.LazPaint.desktop b/Install/flatpak/io.github.bgrabitmap.LazPaint.desktop new file mode 100644 index 00000000..6461a9b2 --- /dev/null +++ b/Install/flatpak/io.github.bgrabitmap.LazPaint.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Name=LazPaint +Name[fr]=LazPaint +Comment=LazPaint +Comment[fr]=LazPaint +Icon=io.github.bgrabitmap.LazPaint.png +Exec=lazpaint %f +Terminal=false +Type=Application +Categories=Graphics +GenericName=LazPaint +Keywords=image;editor;raster;vectorial;paint;layer;photo +MimeType=application/lzp;image/bmp;image/jpeg;image/png;image/gif;image/tiff;image/x-tga;image/vnd.microsoft.icon;image/svg+xml;image/x-adobe-dng;image/x-nikon-nef;image/x-sony-arw;image/x-canon-cr2;image/webp diff --git a/Install/flatpak/io.github.bgrabitmap.LazPaint.metainfo.xml b/Install/flatpak/io.github.bgrabitmap.LazPaint.metainfo.xml new file mode 100644 index 00000000..5f276447 --- /dev/null +++ b/Install/flatpak/io.github.bgrabitmap.LazPaint.metainfo.xml @@ -0,0 +1,187 @@ + + + io.github.bgrabitmap.LazPaint + + LazPaint + Fast raster image editor + + BGRABitmap team + + + https://wiki.freepascal.org/LazPaint + https://github.com/bgrabitmap/lazpaint + http://sourceforge.net/donate/index.php?group_id=404555 + https://github.com/bgrabitmap/lazpaint/issues + https://github.com/bgrabitmap/lazpaint/tree/master/lazpaint/release/bin/i18n + + CC0-1.0 + GPL-3.0-only + + +

Free cross-platform image editor with raster and vector layers, written in Lazarus (Free Pascal). +Can read layered files (lzp, ora, pdn, oXo, flat psd), multi-images (gif, ico, tiff), flat files (bmp, jpeg, pcx, png, tga, webp, xpm, xwd), raw images (dng, cr2, nef, arw...), vectorial (svg), 3D (obj). Has drawing tools, vector shapes, phong shading, curve adjustments, filters, render some textures, Python scripting. Uses Qt5 widgetset.

+ +

Features:

+
    +
  • Files: read and write a variety of file formats, including layered bitmaps and 3D files.
  • +
  • Tools: many tools are available to draw on the layers.
  • +
  • Edit/Select: select parts of an image with antialiasing and modify the selection as a mask.
  • +
  • View: color window, layer stack window and toolbox window.
  • +
  • Command line: call LazPaint from a console.
  • +
+ +

Image manipulation:

+
    +
  • An image can be resampled, flipped horizontally and vertically.
  • +
  • Smart zoom x3 : resize the image x3 and detects borders; this provides a useful zoom with ancient games sprites.
  • +
+ +

Color manipulation:

+
    +
  • Colorize : set the color of an image while preserving intensities
  • +
  • Shift colors : cycle colors and change colorness (saturation)
  • +
  • Intensity : make colors lighter or darker without making them white
  • +
  • Lightness : make colors lighter or darker by making them whiter
  • +
  • Normalize : use the whole range of each color channel and alpha channel
  • +
  • Negative : invert colors (with gamma correction)
  • +
  • Linear negative : invert colors (without gamma correction)
  • +
  • Grayscale : converts colors to grayscale with gamma correction
  • +
+ +

Filters: +Filters can be applied to the whole image or to the active selection. +

+
    +
  • Radial blur : non directional blur
  • +
  • Motion blur : directional blur
  • +
  • Custom blur : blur according to a mask
  • +
  • Sharpen : makes contours more accurate, complementary to Smooth
  • +
  • Smooth : softens whole image, complementary to Sharpen
  • +
  • Median : computes the median of colors around each pixel, which softens corners
  • +
  • Contour : draws contours on a white background (like a pencil drawing)
  • +
  • Emboss : draws contours with shadow
  • +
  • Sphere : spherical projection
  • +
  • Cylinder : cylinder projection
  • +
  • Clouds : add clouds of the current pen color
  • +
  • Scripts: scripts are provided to do layer effects. You can as well write your own Python scripts.
  • +
+
+ + io.github.bgrabitmap.LazPaint.desktop + + + #dc8add + #613583 + + + + + Light theme + https://wiki.freepascal.org/images/a/a3/lazpaint_pallete.jpg + + + Dark theme + https://wiki.freepascal.org/images/1/17/lazpaint_pallete_dark.jpg + + + + + + + https://github.com/bgrabitmap/lazpaint/releases/tag/v7.2.2 + +
    +
  • Completed Czech translation
  • +
  • Compilation fixes for Debian and legacy LCL
  • +
  • Linux shortcut: specify file parameter
  • +
+
+
+ + https://github.com/bgrabitmap/lazpaint/releases/tag/v7.2.1 + +
    +
  • adapt quick save shortcut on MacOS
  • +
  • translations : German, Portuguese, Chinese, Dutch, Spanish
  • +
  • added "screenshot" command line
  • +
  • libavif dll
  • +
  • multi click on text (#266)
  • +
  • fix in Python scripting (dialog.py)
  • +
  • added "-editor" parameter
  • +
+
+
+ + https://github.com/bgrabitmap/lazpaint/releases/tag/v7.2 + +
    +
  • MacOS: handle right-click on layerstack
  • +
  • MacOS: fixed light theme interface
  • +
  • MacOS: avoid key binding conflict with CMD-H
  • +
  • interface: handle cancel language or icon size change
  • +
  • interface: restore main form after embedded editor
  • +
  • interface: restore selection tool after delete
  • +
  • interface: fix shift-arrows in file list
  • +
  • interface: handle right click on switch color button
  • +
  • interface: remember docked toolbox visibility
  • +
  • interface: center on zoom fit
  • +
  • interface: less margin to select outside of color circle
  • +
  • interface: tooltip on arrow start/end
  • +
  • interface: show hotkey in toolbar
  • +
  • interface: update workspace when resizing/rotating
  • +
  • interface: handle keys in embedded editors
  • +
  • interface: prevent ALT key from opening menu
  • +
  • interface: handle ALT-wheel only when applicable
  • +
  • interface: keep fill options visible when changing opacity
  • +
  • layer stack: tooltip for visible and opacity controls
  • +
  • blend mode: removed horizontal scrollbar in blend mode lists
  • +
  • language: tool shortcuts for Cyrillic keyboard
  • +
  • language: translation of color description
  • +
  • language: completed Russian translation
  • +
  • file: prevent saving incorrect filename
  • +
  • file: handle path in file textbox
  • +
  • file: generate new filename with number
  • +
  • file: added quick save action (Ctlr-Q shortcut)
  • +
  • file: overwrite prompt when saving palette
  • +
  • file: experimental support for AVIF format
  • +
  • file: show save prompt when drag'n'drop image to the program
  • +
  • file: save CUR and ICO with command line
  • +
  • SVG: close path when export as SVG
  • +
  • SVG: fixed RTL text export
  • +
  • new file: better handling of ratios
  • +
  • motion blur: fixed sticky mouse click
  • +
  • canvas size: restrict percent to max accepted size
  • +
  • tools: update shape when pressing/releasing SHIFT key
  • +
  • tools: ignore 0 alpha with solid colors
  • +
  • tools: improved hints timing
  • +
  • tools: disambiguation of shortcut keys (Y, K, F and R)
  • +
  • deformation grid tool: handle extreme deformation
  • +
  • déformation grid tool: ESCAPE to exit tool
  • +
  • layer perspective tool: change cursor when hovering points
  • +
  • layer tools: delete current layer with DELETE key
  • +
  • rectangle tool: fixed bug when changing join type
  • +
  • text tool: update when change antialiasing
  • +
  • text tool: provide text style, bidi mode, vertical alignment in toolbar
  • +
  • text tool: allow travel mode with space
  • +
  • text tool: display flipped text
  • +
  • vector tools: avoid error after rasterizing
  • +
  • polygon/closed curve tools: hide center point when ALT key pressed
  • +
  • polyline/opened curve tool: don't reopen shape
  • +
  • poly tools: added RIGHT-click hint
  • +
  • selection tools: deselect when ESCAPE pressed and selection layer empty
  • +
  • selection tools: keep selection mode after undo/redo
  • +
  • rectangle selection tool: include ratio of current image
  • +
  • selection pen: show circular cursor
  • +
  • filter: added negative angle for twirl
  • +
  • script: ignore some Python errors
  • +
+
+
+
+ + + Graphics + + + +
diff --git a/Install/flatpak/io.github.bgrabitmap.LazPaint.yml b/Install/flatpak/io.github.bgrabitmap.LazPaint.yml new file mode 100644 index 00000000..15ec3e85 --- /dev/null +++ b/Install/flatpak/io.github.bgrabitmap.LazPaint.yml @@ -0,0 +1,60 @@ +app-id: io.github.bgrabitmap.LazPaint +runtime: org.kde.Platform +runtime-version: '5.15-24.08' +sdk: org.kde.Sdk +sdk-extensions: + - org.freedesktop.Sdk.Extension.freepascal +command: lazpaint +build-options: + no-debuginfo: true +finish-args: + - --share=ipc + - --socket=fallback-x11 + - --socket=wayland + - --device=dri +modules: + - name: qt5pas + buildsystem: qmake + config-opts: + - -after + - target.path=/app/lib + sources: + - type: shell + commands: + - cp -r /usr/lib/sdk/freepascal/share/lazarus/lcl/interfaces/qt5/cbindings/. . + - name: LazPaint + sources: + - type: git + url: https://github.com/bgrabitmap/bgrabitmap.git + commit: f9748a37f5382b18d1cd197293d1032a522e8561 + dest: 'bgrabitmap' + - type: git + url: https://github.com/bgrabitmap/bgracontrols.git + commit: f5efbf8b79d0725d33b88c5bd41857d9139428bd + dest: 'bgracontrols' + - type: git + url: https://github.com/bgrabitmap/lazpaint.git + commit: 501d44c511fb49ca166dc0ec101305dddbf3aee6 + - type: file + path: io.github.bgrabitmap.LazPaint.metainfo.xml + - type: file + path: io.github.bgrabitmap.LazPaint.desktop + - type: patch + path: 0001-515-runtime-fix-for-Qt.patch + buildsystem: simple + build-commands: + - | + . /usr/lib/sdk/freepascal/enable.sh + lazbuild --build-mode=Release --ws=qt5 bgrabitmap/bgrabitmap/bgrabitmappack.lpk + lazbuild --build-mode=Release --ws=qt5 bgracontrols/bgracontrols.lpk + lazbuild --build-mode=Release --ws=qt5 lazpaintcontrols/lazpaintcontrols.lpk + lazbuild --build-mode=Release --ws=qt5 lazpaint/lazpaint.lpi + - install -Dm755 lazpaint/release/bin/lazpaint -t $FLATPAK_DEST/bin + - install -d $FLATPAK_DEST/share/lazpaint + - install -Dm644 ${FLATPAK_ID}.desktop -t $FLATPAK_DEST/share/applications + - install -Dm644 resources/icon/256x256.png $FLATPAK_DEST/share/icons/hicolor/256x256/apps/${FLATPAK_ID}.png + - install -Dm644 lazpaint/release/bin/i18n/*.po -t $FLATPAK_DEST/share/lazpaint/i18n + - cp -r resources/scripts $FLATPAK_DEST/share/lazpaint + - cp -r lazpaint/release/bin/models $FLATPAK_DEST/share/lazpaint + - install -Dm644 Install/snap/local/lazpaint.xml -t $FLATPAK_DEST/share/mime/packages + - install -Dm644 ${FLATPAK_ID}.metainfo.xml -t $FLATPAK_DEST/share/metainfo From 2a20fa81473784abc2b17ffba53533c18889774e Mon Sep 17 00:00:00 2001 From: Chronos Date: Mon, 16 Dec 2024 09:00:04 +0100 Subject: [PATCH 04/23] Fixes for flathub review comments. --- .../flatpak/io.github.bgrabitmap.LazPaint.desktop | 13 ------------- .../io.github.bgrabitmap.LazPaint.metainfo.xml | 3 +-- Install/flatpak/io.github.bgrabitmap.LazPaint.yml | 13 +++++-------- 3 files changed, 6 insertions(+), 23 deletions(-) delete mode 100644 Install/flatpak/io.github.bgrabitmap.LazPaint.desktop diff --git a/Install/flatpak/io.github.bgrabitmap.LazPaint.desktop b/Install/flatpak/io.github.bgrabitmap.LazPaint.desktop deleted file mode 100644 index 6461a9b2..00000000 --- a/Install/flatpak/io.github.bgrabitmap.LazPaint.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Name=LazPaint -Name[fr]=LazPaint -Comment=LazPaint -Comment[fr]=LazPaint -Icon=io.github.bgrabitmap.LazPaint.png -Exec=lazpaint %f -Terminal=false -Type=Application -Categories=Graphics -GenericName=LazPaint -Keywords=image;editor;raster;vectorial;paint;layer;photo -MimeType=application/lzp;image/bmp;image/jpeg;image/png;image/gif;image/tiff;image/x-tga;image/vnd.microsoft.icon;image/svg+xml;image/x-adobe-dng;image/x-nikon-nef;image/x-sony-arw;image/x-canon-cr2;image/webp diff --git a/Install/flatpak/io.github.bgrabitmap.LazPaint.metainfo.xml b/Install/flatpak/io.github.bgrabitmap.LazPaint.metainfo.xml index 5f276447..5cb92d73 100644 --- a/Install/flatpak/io.github.bgrabitmap.LazPaint.metainfo.xml +++ b/Install/flatpak/io.github.bgrabitmap.LazPaint.metainfo.xml @@ -79,11 +79,10 @@ Filters can be applied to the whole image or to the active selection. Light theme https://wiki.freepascal.org/images/a/a3/lazpaint_pallete.jpg - + Dark theme https://wiki.freepascal.org/images/1/17/lazpaint_pallete_dark.jpg - diff --git a/Install/flatpak/io.github.bgrabitmap.LazPaint.yml b/Install/flatpak/io.github.bgrabitmap.LazPaint.yml index 15ec3e85..48440819 100644 --- a/Install/flatpak/io.github.bgrabitmap.LazPaint.yml +++ b/Install/flatpak/io.github.bgrabitmap.LazPaint.yml @@ -5,8 +5,8 @@ sdk: org.kde.Sdk sdk-extensions: - org.freedesktop.Sdk.Extension.freepascal command: lazpaint -build-options: - no-debuginfo: true +rename-icon: lazpaint +rename-desktop-file: lazpaint.desktop finish-args: - --share=ipc - --socket=fallback-x11 @@ -37,8 +37,6 @@ modules: commit: 501d44c511fb49ca166dc0ec101305dddbf3aee6 - type: file path: io.github.bgrabitmap.LazPaint.metainfo.xml - - type: file - path: io.github.bgrabitmap.LazPaint.desktop - type: patch path: 0001-515-runtime-fix-for-Qt.patch buildsystem: simple @@ -50,11 +48,10 @@ modules: lazbuild --build-mode=Release --ws=qt5 lazpaintcontrols/lazpaintcontrols.lpk lazbuild --build-mode=Release --ws=qt5 lazpaint/lazpaint.lpi - install -Dm755 lazpaint/release/bin/lazpaint -t $FLATPAK_DEST/bin - - install -d $FLATPAK_DEST/share/lazpaint - - install -Dm644 ${FLATPAK_ID}.desktop -t $FLATPAK_DEST/share/applications - - install -Dm644 resources/icon/256x256.png $FLATPAK_DEST/share/icons/hicolor/256x256/apps/${FLATPAK_ID}.png + - install -Dm644 lazpaint/release/debian/applications/lazpaint.desktop -t $FLATPAK_DEST/share/applications + - install -Dm644 resources/icon/256x256.png $FLATPAK_DEST/share/icons/hicolor/256x256/apps/lazpaint.png - install -Dm644 lazpaint/release/bin/i18n/*.po -t $FLATPAK_DEST/share/lazpaint/i18n - cp -r resources/scripts $FLATPAK_DEST/share/lazpaint - cp -r lazpaint/release/bin/models $FLATPAK_DEST/share/lazpaint - - install -Dm644 Install/snap/local/lazpaint.xml -t $FLATPAK_DEST/share/mime/packages + - install -Dm644 Install/snap/local/lazpaint.xml $FLATPAK_DEST/share/mime/packages/$FLAPTAK_ID.xml - install -Dm644 ${FLATPAK_ID}.metainfo.xml -t $FLATPAK_DEST/share/metainfo From 5da0ba088de49f675a1cf8c7bb7702b571d313a3 Mon Sep 17 00:00:00 2001 From: Chronos Date: Mon, 16 Dec 2024 17:43:47 +0100 Subject: [PATCH 05/23] Fixed Qt5 crash. Do not use image browser by default due to needed extra permissions. --- Install/flatpak/0001-avoid-crash-on-Qt5.patch | 37 +++++++++++++++++++ .../flatpak/io.github.bgrabitmap.LazPaint.yml | 4 ++ .../flatpak/no-image-browser-by-default.patch | 13 +++++++ 3 files changed, 54 insertions(+) create mode 100644 Install/flatpak/0001-avoid-crash-on-Qt5.patch create mode 100644 Install/flatpak/no-image-browser-by-default.patch diff --git a/Install/flatpak/0001-avoid-crash-on-Qt5.patch b/Install/flatpak/0001-avoid-crash-on-Qt5.patch new file mode 100644 index 00000000..b0e8ce2d --- /dev/null +++ b/Install/flatpak/0001-avoid-crash-on-Qt5.patch @@ -0,0 +1,37 @@ +From d73455025d71226472e7eb880da36f6fb85c5df0 Mon Sep 17 00:00:00 2001 +From: Johann ELSASS +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 + diff --git a/Install/flatpak/io.github.bgrabitmap.LazPaint.yml b/Install/flatpak/io.github.bgrabitmap.LazPaint.yml index 48440819..549602fd 100644 --- a/Install/flatpak/io.github.bgrabitmap.LazPaint.yml +++ b/Install/flatpak/io.github.bgrabitmap.LazPaint.yml @@ -39,6 +39,10 @@ modules: path: io.github.bgrabitmap.LazPaint.metainfo.xml - type: patch path: 0001-515-runtime-fix-for-Qt.patch + - type: patch + path: 0001-avoid-crash-on-Qt5.patch + - type: patch + path: no-image-browser-by-default.patch buildsystem: simple build-commands: - | diff --git a/Install/flatpak/no-image-browser-by-default.patch b/Install/flatpak/no-image-browser-by-default.patch new file mode 100644 index 00000000..19d8345e --- /dev/null +++ b/Install/flatpak/no-image-browser-by-default.patch @@ -0,0 +1,13 @@ +diff --git a/lazpaint/uconfig.pas b/lazpaint/uconfig.pas +index ee16357..b13b491 100644 +--- a/lazpaint/uconfig.pas ++++ b/lazpaint/uconfig.pas +@@ -804,7 +804,7 @@ end; + + function TLazPaintConfig.DefaultUseImageBrowser: boolean; + begin +- result := iniOptions.ReadBool('General','UseImageBrowser',{$IFDEF DARWIN}false{$ELSE}true{$ENDIF}); ++ result := iniOptions.ReadBool('General','UseImageBrowser',{$IFDEF DARWIN}false{$ELSE}false{$ENDIF}); + end; + + procedure TLazPaintConfig.SetDefaultUseImageBrowser(value: boolean); From b52c8d07585663cd18e0944384396298ba51b9a8 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Sun, 29 Dec 2024 16:48:29 +0200 Subject: [PATCH 06/23] add github-actions --- .github/dependabot.yml | 7 + .github/workflows/make.yml | 49 +++++++ .gitmodules | 6 + make.ps1 | 123 ++++++++++++++++++ make.sh | 86 ++++++++++++ use/bgrabitmap | 1 + use/bgracontrols | 1 + .../lazpaintcontrols}/lazpaintcontrols.lpk | 0 .../lazpaintcontrols}/lazpaintcontrols.pas | 0 .../lazpaintcontrols}/lcresourcestring.pas | 0 .../lazpaintcontrols}/lcscaledpi.pas | 0 .../lazpaintcontrols}/lctoolbars.pas | 0 .../lazpaintcontrols}/lcvectorclipboard.pas | 0 .../lazpaintcontrols}/lcvectorialfill.pas | 0 .../lcvectorialfillcontrol.pas | 0 .../lcvectorialfillinterface.pas | 0 .../lazpaintcontrols}/lcvectormultishape.pas | 0 .../lazpaintcontrols}/lcvectororiginal.pas | 0 .../lazpaintcontrols}/lcvectorpolyshapes.pas | 0 .../lazpaintcontrols}/lcvectorrectshapes.pas | 0 .../lazpaintcontrols}/lcvectorshapes.pas | 0 .../lazpaintcontrols}/lcvectortextshapes.pas | 0 22 files changed, 273 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/make.yml create mode 100644 .gitmodules create mode 100644 make.ps1 create mode 100644 make.sh create mode 160000 use/bgrabitmap create mode 160000 use/bgracontrols rename {lazpaintcontrols => use/lazpaintcontrols}/lazpaintcontrols.lpk (100%) rename {lazpaintcontrols => use/lazpaintcontrols}/lazpaintcontrols.pas (100%) rename {lazpaintcontrols => use/lazpaintcontrols}/lcresourcestring.pas (100%) rename {lazpaintcontrols => use/lazpaintcontrols}/lcscaledpi.pas (100%) rename {lazpaintcontrols => use/lazpaintcontrols}/lctoolbars.pas (100%) rename {lazpaintcontrols => use/lazpaintcontrols}/lcvectorclipboard.pas (100%) rename {lazpaintcontrols => use/lazpaintcontrols}/lcvectorialfill.pas (100%) rename {lazpaintcontrols => use/lazpaintcontrols}/lcvectorialfillcontrol.pas (100%) rename {lazpaintcontrols => use/lazpaintcontrols}/lcvectorialfillinterface.pas (100%) rename {lazpaintcontrols => use/lazpaintcontrols}/lcvectormultishape.pas (100%) rename {lazpaintcontrols => use/lazpaintcontrols}/lcvectororiginal.pas (100%) rename {lazpaintcontrols => use/lazpaintcontrols}/lcvectorpolyshapes.pas (100%) rename {lazpaintcontrols => use/lazpaintcontrols}/lcvectorrectshapes.pas (100%) rename {lazpaintcontrols => use/lazpaintcontrols}/lcvectorshapes.pas (100%) rename {lazpaintcontrols => use/lazpaintcontrols}/lcvectortextshapes.pas (100%) diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..64284b90 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +--- +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml new file mode 100644 index 00000000..213e35f5 --- /dev/null +++ b/.github/workflows/make.yml @@ -0,0 +1,49 @@ +--- +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: bash make.sh build + + - name: Build on Windows + if: runner.os == 'Windows' + shell: powershell + run: pwsh -File make.ps1 build + + - name: Archive + if: runner.os == 'Windows' + uses: actions/upload-artifact@v4 + with: + retention-days: 1 + path: src\bin\*.exe diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..fe8b2cba --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "use/bgracontrols"] + path = use/bgracontrols + url = git@github.com:bgrabitmap/bgracontrols.git +[submodule "use/bgrabitmap"] + path = use/bgrabitmap + url = git@github.com:bgrabitmap/bgrabitmap.git diff --git a/make.ps1 b/make.ps1 new file mode 100644 index 00000000..35f046f1 --- /dev/null +++ b/make.ps1 @@ -0,0 +1,123 @@ +#!/usr/bin/env pwsh +############################################################################################################## + +Function Show-Usage { + " +Usage: pwsh -File $($PSCommandPath) [OPTIONS] +Options: + build Build program +" | Out-Host +} + +Function Request-File { + While ($Input.MoveNext()) { + $VAR = @{ + Uri = $Input.Current + OutFile = (Split-Path -Path $Input.Current -Leaf).Split('?')[0] + } + Invoke-WebRequest @VAR + Return $VAR.OutFile + } +} + +Function Install-Program { + While ($Input.MoveNext()) { + Switch ((Split-Path -Path $Input.Current -Leaf).Split('.')[-1]) { + 'msi' { + & msiexec /passive /package $Input.Current | Out-Null + } + Default { + & ".\$($Input.Current)" /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Null + } + } + Remove-Item $Input.Current + } +} + +Function Build-Project { + @( + @{ + Cmd = 'lazbuild' + Url = 'https://fossies.org/windows/misc/lazarus-3.6-fpc-3.2.2-win64.exe' + Path = "C:\Lazarus" + } + ) | Where-Object { ! (Test-Path -Path $_.Path) } | + ForEach-Object { + $_.Url | Request-File | Install-Program + $Env:PATH+=";$($_.Path)" + (Get-Command $_.Cmd).Source | Out-Host + } + If (Test-Path -Path '.gitmodules') { + & git submodule update --init --recursive --force --remote | Out-Host + ".... [[$($LastExitCode)]] git submodule update" | Out-Host + } + $Env:Src = 'lazpaint' + $Env:Use = 'use' + $Env:Pkg = 'use\components.txt' + If (Test-Path -Path $Env:Use) { + If (Test-Path -Path $Env:Pkg) { + Get-Content -Path $Env:Pkg | + Where-Object { + ! (Test-Path -Path "$($Env:Use)\$($_)") && + ! (& lazbuild --verbose-pkgsearch $_ ) && + ! (& lazbuild --add-package $_) + } | ForEach-Object { + Return @{ + Uri = "https://packages.lazarus-ide.org/$($_).zip" + Path = "$($Env:Use)\$($_)" + OutFile = (New-TemporaryFile).FullName + } + } | ForEach-Object -Parallel { + Invoke-WebRequest -OutFile $_.OutFile -Uri $_.Uri + Expand-Archive -Path $_.OutFile -DestinationPath $_.Path + Remove-Item $_.OutFile + Return ".... download $($_.Uri)" + } | Out-Host + } + (Get-ChildItem -Filter '*.lpk' -Recurse -File –Path $Env:Use).FullName | + ForEach-Object { + & lazbuild --add-package-link $_ | Out-Null + Return ".... [$($LastExitCode)] add package link $($_)" + } | Out-Host + } + If (Test-Path -Path $Env:Src) { + Exit ( + (Get-ChildItem -Filter '*.lpi' -Recurse -File –Path $Env:Src).FullName | + Sort-Object | + ForEach-Object { + $error = 0 + $Output = (& lazbuild --build-all --recursive --no-write-project --build-mode='release' $_) + $Result = @(".... [$($LastExitCode)] build project $($_)") + If ($LastExitCode -eq 0) { + $Result += $Output | Select-String -Pattern 'Linking' + } Else { + $error = 1 + $Result += $Output | Select-String -Pattern 'Error:', 'Fatal:' + } + $Result | Out-Host + Return $error + } | Measure-Object -Sum + ).Sum + } +} + +Function Switch-Action { + $ErrorActionPreference = 'stop' + Set-PSDebug -Strict #-Trace 1 + Invoke-ScriptAnalyzer -EnableExit -Path $PSCommandPath + If ($args.count -gt 0) { + Switch ($args[0]) { + 'build' { + Build-Project + } + Default { + Show-Usage + } + } + } Else { + Show-Usage + } +} + +############################################################################################################## +Switch-Action @args | Out-Null diff --git a/make.sh b/make.sh new file mode 100644 index 00000000..5e8eb4e5 --- /dev/null +++ b/make.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash + +function priv_clippit +( + cat <&2 + fi + if [[ -d "${VAR[src]}" ]]; then + declare -i errors=0 + while read -r; do + declare -A TMP=( + [out]=$(mktemp) + ) + if (lazbuild --build-all --recursive --no-write-project --build-mode='release' "${REPLY}" > "${TMP[out]}"); then + printf '\x1b[32m\t[%s]\t%s\x1b[0m\n' "${?}" "${REPLY}" + grep --color='always' 'Linking' "${TMP[out]}" + else + printf '\x1b[31m\t[%s]\t%s\x1b[0m\n' "${?}" "${REPLY}" + grep --color='always' --extended-regexp '(Error|Fatal):' "${TMP[out]}" + ((errors+=1)) + fi 1>&2 + rm "${TMP[out]}" + done < <(find "${VAR[src]}" -type 'f' -name '*.lpi' | sort) + exit "${errors}" + fi +) + +function priv_main +( + set -euo pipefail + if ((${#})); then + case ${1} in + build) priv_lazbuild ;; + *) priv_clippit ;; + esac + else + priv_clippit + fi +) + +priv_main "${@}" >/dev/null diff --git a/use/bgrabitmap b/use/bgrabitmap new file mode 160000 index 00000000..311fa8d5 --- /dev/null +++ b/use/bgrabitmap @@ -0,0 +1 @@ +Subproject commit 311fa8d5f9b2baabdb3490ded5f721e68ea67ae2 diff --git a/use/bgracontrols b/use/bgracontrols new file mode 160000 index 00000000..555c0df8 --- /dev/null +++ b/use/bgracontrols @@ -0,0 +1 @@ +Subproject commit 555c0df8e2c52c60a9099d1bfd7b14c19852d5a4 diff --git a/lazpaintcontrols/lazpaintcontrols.lpk b/use/lazpaintcontrols/lazpaintcontrols.lpk similarity index 100% rename from lazpaintcontrols/lazpaintcontrols.lpk rename to use/lazpaintcontrols/lazpaintcontrols.lpk diff --git a/lazpaintcontrols/lazpaintcontrols.pas b/use/lazpaintcontrols/lazpaintcontrols.pas similarity index 100% rename from lazpaintcontrols/lazpaintcontrols.pas rename to use/lazpaintcontrols/lazpaintcontrols.pas diff --git a/lazpaintcontrols/lcresourcestring.pas b/use/lazpaintcontrols/lcresourcestring.pas similarity index 100% rename from lazpaintcontrols/lcresourcestring.pas rename to use/lazpaintcontrols/lcresourcestring.pas diff --git a/lazpaintcontrols/lcscaledpi.pas b/use/lazpaintcontrols/lcscaledpi.pas similarity index 100% rename from lazpaintcontrols/lcscaledpi.pas rename to use/lazpaintcontrols/lcscaledpi.pas diff --git a/lazpaintcontrols/lctoolbars.pas b/use/lazpaintcontrols/lctoolbars.pas similarity index 100% rename from lazpaintcontrols/lctoolbars.pas rename to use/lazpaintcontrols/lctoolbars.pas diff --git a/lazpaintcontrols/lcvectorclipboard.pas b/use/lazpaintcontrols/lcvectorclipboard.pas similarity index 100% rename from lazpaintcontrols/lcvectorclipboard.pas rename to use/lazpaintcontrols/lcvectorclipboard.pas diff --git a/lazpaintcontrols/lcvectorialfill.pas b/use/lazpaintcontrols/lcvectorialfill.pas similarity index 100% rename from lazpaintcontrols/lcvectorialfill.pas rename to use/lazpaintcontrols/lcvectorialfill.pas diff --git a/lazpaintcontrols/lcvectorialfillcontrol.pas b/use/lazpaintcontrols/lcvectorialfillcontrol.pas similarity index 100% rename from lazpaintcontrols/lcvectorialfillcontrol.pas rename to use/lazpaintcontrols/lcvectorialfillcontrol.pas diff --git a/lazpaintcontrols/lcvectorialfillinterface.pas b/use/lazpaintcontrols/lcvectorialfillinterface.pas similarity index 100% rename from lazpaintcontrols/lcvectorialfillinterface.pas rename to use/lazpaintcontrols/lcvectorialfillinterface.pas diff --git a/lazpaintcontrols/lcvectormultishape.pas b/use/lazpaintcontrols/lcvectormultishape.pas similarity index 100% rename from lazpaintcontrols/lcvectormultishape.pas rename to use/lazpaintcontrols/lcvectormultishape.pas diff --git a/lazpaintcontrols/lcvectororiginal.pas b/use/lazpaintcontrols/lcvectororiginal.pas similarity index 100% rename from lazpaintcontrols/lcvectororiginal.pas rename to use/lazpaintcontrols/lcvectororiginal.pas diff --git a/lazpaintcontrols/lcvectorpolyshapes.pas b/use/lazpaintcontrols/lcvectorpolyshapes.pas similarity index 100% rename from lazpaintcontrols/lcvectorpolyshapes.pas rename to use/lazpaintcontrols/lcvectorpolyshapes.pas diff --git a/lazpaintcontrols/lcvectorrectshapes.pas b/use/lazpaintcontrols/lcvectorrectshapes.pas similarity index 100% rename from lazpaintcontrols/lcvectorrectshapes.pas rename to use/lazpaintcontrols/lcvectorrectshapes.pas diff --git a/lazpaintcontrols/lcvectorshapes.pas b/use/lazpaintcontrols/lcvectorshapes.pas similarity index 100% rename from lazpaintcontrols/lcvectorshapes.pas rename to use/lazpaintcontrols/lcvectorshapes.pas diff --git a/lazpaintcontrols/lcvectortextshapes.pas b/use/lazpaintcontrols/lcvectortextshapes.pas similarity index 100% rename from lazpaintcontrols/lcvectortextshapes.pas rename to use/lazpaintcontrols/lcvectortextshapes.pas From 09b2798ad2cb952dd9d60e5f4984ca963ff97c83 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Mon, 30 Dec 2024 13:28:13 +0200 Subject: [PATCH 07/23] small fix --- make.ps1 | 69 +++++++++-------- make.sh | 75 ++++++++++--------- .../lcvectorialfillinterface.pas | 2 +- 3 files changed, 79 insertions(+), 67 deletions(-) diff --git a/make.ps1 b/make.ps1 index 35f046f1..4b99d7e8 100644 --- a/make.ps1 +++ b/make.ps1 @@ -11,7 +11,7 @@ Options: Function Request-File { While ($Input.MoveNext()) { - $VAR = @{ + New-Variable -Name VAR -Option Constant -Value @{ Uri = $Input.Current OutFile = (Split-Path -Path $Input.Current -Leaf).Split('?')[0] } @@ -35,6 +35,19 @@ Function Install-Program { } Function Build-Project { + New-Variable -Name VAR -Option Constant -Value @{ + Src = 'lazpaint' + Use = 'use' + Pkg = 'use\components.txt' + } + If (! (Test-Path -Path $Var.Src)) { + 'Source do not find!' | Out-Host + Exit 1 + } + If (Test-Path -Path '.gitmodules') { + & git submodule update --init --recursive --force --remote | Out-Host + ".... [[$($LastExitCode)]] git submodule update" | Out-Host + } @( @{ Cmd = 'lazbuild' @@ -47,24 +60,17 @@ Function Build-Project { $Env:PATH+=";$($_.Path)" (Get-Command $_.Cmd).Source | Out-Host } - If (Test-Path -Path '.gitmodules') { - & git submodule update --init --recursive --force --remote | Out-Host - ".... [[$($LastExitCode)]] git submodule update" | Out-Host - } - $Env:Src = 'lazpaint' - $Env:Use = 'use' - $Env:Pkg = 'use\components.txt' - If (Test-Path -Path $Env:Use) { - If (Test-Path -Path $Env:Pkg) { - Get-Content -Path $Env:Pkg | + If (Test-Path -Path $VAR.Use) { + If (Test-Path -Path $VAR.Pkg) { + Get-Content -Path $VAR.Pkg | Where-Object { - ! (Test-Path -Path "$($Env:Use)\$($_)") && + ! (Test-Path -Path "$($VAR.Use)\$($_)") && ! (& lazbuild --verbose-pkgsearch $_ ) && ! (& lazbuild --add-package $_) } | ForEach-Object { Return @{ Uri = "https://packages.lazarus-ide.org/$($_).zip" - Path = "$($Env:Use)\$($_)" + Path = "$($VAR.Use)\$($_)" OutFile = (New-TemporaryFile).FullName } } | ForEach-Object -Parallel { @@ -74,31 +80,32 @@ Function Build-Project { Return ".... download $($_.Uri)" } | Out-Host } - (Get-ChildItem -Filter '*.lpk' -Recurse -File –Path $Env:Use).FullName | + (Get-ChildItem -Filter '*.lpk' -Recurse -File –Path $VAR.Use).FullName | ForEach-Object { & lazbuild --add-package-link $_ | Out-Null Return ".... [$($LastExitCode)] add package link $($_)" } | Out-Host } - If (Test-Path -Path $Env:Src) { - Exit ( - (Get-ChildItem -Filter '*.lpi' -Recurse -File –Path $Env:Src).FullName | - Sort-Object | - ForEach-Object { - $error = 0 - $Output = (& lazbuild --build-all --recursive --no-write-project --build-mode='release' $_) - $Result = @(".... [$($LastExitCode)] build project $($_)") - If ($LastExitCode -eq 0) { + Exit ( + (Get-ChildItem -Filter '*.lpi' -Recurse -File –Path $Var.Src).FullName | + Sort-Object | + ForEach-Object { + $Output = (& lazbuild --build-all --recursive --no-write-project --build-mode='release' $_) + $Result = @(".... [$($LastExitCode)] build project $($_)") + $exitCode = Switch ($LastExitCode) { + 0 { $Result += $Output | Select-String -Pattern 'Linking' - } Else { - $error = 1 + 0 + } + Default { $Result += $Output | Select-String -Pattern 'Error:', 'Fatal:' + 1 } - $Result | Out-Host - Return $error - } | Measure-Object -Sum - ).Sum - } + } + $Result | Out-Host + Return $exitCode + } | Measure-Object -Sum + ).Sum } Function Switch-Action { @@ -120,4 +127,4 @@ Function Switch-Action { } ############################################################################################################## -Switch-Action @args | Out-Null +Switch-Action @args diff --git a/make.sh b/make.sh index 5e8eb4e5..8c4b491a 100644 --- a/make.sh +++ b/make.sh @@ -11,24 +11,28 @@ EOF function priv_lazbuild ( + declare -rA VAR=( + [src]='lazpaint' + [use]='use' + [pkg]='use/components.txt' + ) + if ! [[ -d "${VAR[src]}" ]]; then + printf '\x1b[31m\tSource do not find!\x1b[0m\n' "${?}" "${REPLY}" + exit 1 + fi + if [[ -f '.gitmodules' ]]; then + git submodule update --init --recursive --force --remote & + fi if ! (command -v lazbuild); then source '/etc/os-release' case ${ID:?} in debian | ubuntu) sudo apt-get update - sudo apt-get install -y lazarus & + sudo apt-get install -y lazarus{-ide-qt5,} & ;; esac fi - if [[ -f '.gitmodules' ]]; then - git submodule update --init --recursive --force --remote & - fi wait - declare -rA VAR=( - [src]='lazpaint' - [use]='use' - [pkg]='use/components.txt' - ) if [[ -d "${VAR[use]}" ]]; then if [[ -f "${VAR[pkg]}" ]]; then while read -r; do @@ -36,38 +40,39 @@ function priv_lazbuild ! [[ -d "${VAR[use]}/${REPLY}" ]] && ! (lazbuild --verbose-pkgsearch "${REPLY}") && ! (lazbuild --add-package "${REPLY}"); then - declare -A TMP=( - [url]="https://packages.lazarus-ide.org/${REPLY}.zip" - [dir]="${VAR[use]}/${REPLY}" - [out]=$(mktemp) - ) - wget --quiet --output-document "${TMP[out]}" "${TMP[url]}" - unzip -o "${TMP[out]}" -d "${TMP[dir]}" - rm --verbose "${TMP[out]}" + ( + declare -A TMP=( + [url]="https://packages.lazarus-ide.org/${REPLY}.zip" + [dir]="${VAR[use]}/${REPLY}" + [out]=$(mktemp) + ) + wget --quiet --output-document "${TMP[out]}" "${TMP[url]}" + unzip -o "${TMP[out]}" -d "${TMP[dir]}" + rm --verbose "${TMP[out]}" + ) & fi done < "${VAR[pkg]}" + wait fi find "${VAR[use]}" -type 'f' -name '*.lpk' -printf '\033[32m\tadd package link\t%p\033[0m\n' -exec \ lazbuild --add-package-link {} + 1>&2 fi - if [[ -d "${VAR[src]}" ]]; then - declare -i errors=0 - while read -r; do - declare -A TMP=( - [out]=$(mktemp) - ) - if (lazbuild --build-all --recursive --no-write-project --build-mode='release' "${REPLY}" > "${TMP[out]}"); then - printf '\x1b[32m\t[%s]\t%s\x1b[0m\n' "${?}" "${REPLY}" - grep --color='always' 'Linking' "${TMP[out]}" - else - printf '\x1b[31m\t[%s]\t%s\x1b[0m\n' "${?}" "${REPLY}" - grep --color='always' --extended-regexp '(Error|Fatal):' "${TMP[out]}" - ((errors+=1)) - fi 1>&2 - rm "${TMP[out]}" - done < <(find "${VAR[src]}" -type 'f' -name '*.lpi' | sort) - exit "${errors}" - fi + declare -i errors=0 + while read -r; do + declare -A TMP=( + [out]=$(mktemp) + ) + if (lazbuild --build-all --recursive --no-write-project --build-mode='release' --widgetset='qt5' "${REPLY}" > "${TMP[out]}"); then + printf '\x1b[32m\t[%s]\t%s\x1b[0m\n' "${?}" "${REPLY}" + grep --color='always' 'Linking' "${TMP[out]}" + else + printf '\x1b[31m\t[%s]\t%s\x1b[0m\n' "${?}" "${REPLY}" + grep --color='always' --extended-regexp '(Error|Fatal):' "${TMP[out]}" + ((errors+=1)) + fi 1>&2 + rm "${TMP[out]}" + done < <(find "${VAR[src]}" -type 'f' -name '*.lpi' | sort) + exit "${errors}" ) function priv_main diff --git a/use/lazpaintcontrols/lcvectorialfillinterface.pas b/use/lazpaintcontrols/lcvectorialfillinterface.pas index 0237f5b2..965a6c67 100644 --- a/use/lazpaintcontrols/lcvectorialfillinterface.pas +++ b/use/lazpaintcontrols/lcvectorialfillinterface.pas @@ -1407,6 +1407,6 @@ procedure TVectorialFillInterface.UpdateShapeFill(AShape: TVectorShape; end; begin - {$i fillimages.lrs} + {$i ../../resources/fillimages.lrs} end. From 34c0d6e72164403b0830c21b08f7973adfbf6144 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Mon, 30 Dec 2024 13:32:12 +0200 Subject: [PATCH 08/23] small fix --- lazpaint/test_embedded/project1.lpi | 92 +++++++++++++++++++++++++---- 1 file changed, 82 insertions(+), 10 deletions(-) diff --git a/lazpaint/test_embedded/project1.lpi b/lazpaint/test_embedded/project1.lpi index 11e06e50..d06c50d8 100644 --- a/lazpaint/test_embedded/project1.lpi +++ b/lazpaint/test_embedded/project1.lpi @@ -1,10 +1,12 @@ - + - + + + @@ -12,18 +14,88 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + @@ -40,7 +112,7 @@ - + @@ -52,7 +124,7 @@ - + From 9edf65dc370223b2018ccf75a3c4a9843eb13d9e Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Wed, 1 Jan 2025 16:07:59 +0200 Subject: [PATCH 09/23] remove make.files to .github --- make.ps1 => .github/workflows/make.ps1 | 52 +++++++++---------- make.sh => .github/workflows/make.sh | 2 +- .github/workflows/make.yml | 4 +- .../lazpaintcontrols.lpk | 0 .../lazpaintcontrols.pas | 0 .../lcresourcestring.pas | 0 .../lcscaledpi.pas | 0 .../lctoolbars.pas | 0 .../lcvectorclipboard.pas | 0 .../lcvectorialfill.pas | 0 .../lcvectorialfillcontrol.pas | 0 .../lcvectorialfillinterface.pas | 2 +- .../lcvectormultishape.pas | 0 .../lcvectororiginal.pas | 0 .../lcvectorpolyshapes.pas | 0 .../lcvectorrectshapes.pas | 0 .../lcvectorshapes.pas | 0 .../lcvectortextshapes.pas | 0 18 files changed, 30 insertions(+), 30 deletions(-) rename make.ps1 => .github/workflows/make.ps1 (99%) rename make.sh => .github/workflows/make.sh (99%) rename {use/lazpaintcontrols => lazpaintcontrols}/lazpaintcontrols.lpk (100%) rename {use/lazpaintcontrols => lazpaintcontrols}/lazpaintcontrols.pas (100%) rename {use/lazpaintcontrols => lazpaintcontrols}/lcresourcestring.pas (100%) rename {use/lazpaintcontrols => lazpaintcontrols}/lcscaledpi.pas (100%) rename {use/lazpaintcontrols => lazpaintcontrols}/lctoolbars.pas (100%) rename {use/lazpaintcontrols => lazpaintcontrols}/lcvectorclipboard.pas (100%) rename {use/lazpaintcontrols => lazpaintcontrols}/lcvectorialfill.pas (100%) rename {use/lazpaintcontrols => lazpaintcontrols}/lcvectorialfillcontrol.pas (100%) rename {use/lazpaintcontrols => lazpaintcontrols}/lcvectorialfillinterface.pas (99%) rename {use/lazpaintcontrols => lazpaintcontrols}/lcvectormultishape.pas (100%) rename {use/lazpaintcontrols => lazpaintcontrols}/lcvectororiginal.pas (100%) rename {use/lazpaintcontrols => lazpaintcontrols}/lcvectorpolyshapes.pas (100%) rename {use/lazpaintcontrols => lazpaintcontrols}/lcvectorrectshapes.pas (100%) rename {use/lazpaintcontrols => lazpaintcontrols}/lcvectorshapes.pas (100%) rename {use/lazpaintcontrols => lazpaintcontrols}/lcvectortextshapes.pas (100%) diff --git a/make.ps1 b/.github/workflows/make.ps1 similarity index 99% rename from make.ps1 rename to .github/workflows/make.ps1 index 4b99d7e8..0f8c2d91 100644 --- a/make.ps1 +++ b/.github/workflows/make.ps1 @@ -9,35 +9,10 @@ Options: " | Out-Host } -Function Request-File { - While ($Input.MoveNext()) { - New-Variable -Name VAR -Option Constant -Value @{ - Uri = $Input.Current - OutFile = (Split-Path -Path $Input.Current -Leaf).Split('?')[0] - } - Invoke-WebRequest @VAR - Return $VAR.OutFile - } -} - -Function Install-Program { - While ($Input.MoveNext()) { - Switch ((Split-Path -Path $Input.Current -Leaf).Split('.')[-1]) { - 'msi' { - & msiexec /passive /package $Input.Current | Out-Null - } - Default { - & ".\$($Input.Current)" /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Null - } - } - Remove-Item $Input.Current - } -} - Function Build-Project { New-Variable -Name VAR -Option Constant -Value @{ Src = 'lazpaint' - Use = 'use' + Use = '.' Pkg = 'use\components.txt' } If (! (Test-Path -Path $Var.Src)) { @@ -108,6 +83,31 @@ Function Build-Project { ).Sum } +Function Request-File { + While ($Input.MoveNext()) { + New-Variable -Name VAR -Option Constant -Value @{ + Uri = $Input.Current + OutFile = (Split-Path -Path $Input.Current -Leaf).Split('?')[0] + } + Invoke-WebRequest @VAR + Return $VAR.OutFile + } +} + +Function Install-Program { + While ($Input.MoveNext()) { + Switch ((Split-Path -Path $Input.Current -Leaf).Split('.')[-1]) { + 'msi' { + & msiexec /passive /package $Input.Current | Out-Null + } + Default { + & ".\$($Input.Current)" /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Null + } + } + Remove-Item $Input.Current + } +} + Function Switch-Action { $ErrorActionPreference = 'stop' Set-PSDebug -Strict #-Trace 1 diff --git a/make.sh b/.github/workflows/make.sh similarity index 99% rename from make.sh rename to .github/workflows/make.sh index 8c4b491a..d94f1c73 100644 --- a/make.sh +++ b/.github/workflows/make.sh @@ -13,7 +13,7 @@ function priv_lazbuild ( declare -rA VAR=( [src]='lazpaint' - [use]='use' + [use]='.' [pkg]='use/components.txt' ) if ! [[ -d "${VAR[src]}" ]]; then diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index 213e35f5..006d55cd 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -34,12 +34,12 @@ jobs: - name: Build on Linux if: runner.os == 'Linux' shell: bash - run: bash make.sh build + run: bash .github/workflows/make.sh build - name: Build on Windows if: runner.os == 'Windows' shell: powershell - run: pwsh -File make.ps1 build + run: pwsh -File .github/workflows/make.ps1 build - name: Archive if: runner.os == 'Windows' diff --git a/use/lazpaintcontrols/lazpaintcontrols.lpk b/lazpaintcontrols/lazpaintcontrols.lpk similarity index 100% rename from use/lazpaintcontrols/lazpaintcontrols.lpk rename to lazpaintcontrols/lazpaintcontrols.lpk diff --git a/use/lazpaintcontrols/lazpaintcontrols.pas b/lazpaintcontrols/lazpaintcontrols.pas similarity index 100% rename from use/lazpaintcontrols/lazpaintcontrols.pas rename to lazpaintcontrols/lazpaintcontrols.pas diff --git a/use/lazpaintcontrols/lcresourcestring.pas b/lazpaintcontrols/lcresourcestring.pas similarity index 100% rename from use/lazpaintcontrols/lcresourcestring.pas rename to lazpaintcontrols/lcresourcestring.pas diff --git a/use/lazpaintcontrols/lcscaledpi.pas b/lazpaintcontrols/lcscaledpi.pas similarity index 100% rename from use/lazpaintcontrols/lcscaledpi.pas rename to lazpaintcontrols/lcscaledpi.pas diff --git a/use/lazpaintcontrols/lctoolbars.pas b/lazpaintcontrols/lctoolbars.pas similarity index 100% rename from use/lazpaintcontrols/lctoolbars.pas rename to lazpaintcontrols/lctoolbars.pas diff --git a/use/lazpaintcontrols/lcvectorclipboard.pas b/lazpaintcontrols/lcvectorclipboard.pas similarity index 100% rename from use/lazpaintcontrols/lcvectorclipboard.pas rename to lazpaintcontrols/lcvectorclipboard.pas diff --git a/use/lazpaintcontrols/lcvectorialfill.pas b/lazpaintcontrols/lcvectorialfill.pas similarity index 100% rename from use/lazpaintcontrols/lcvectorialfill.pas rename to lazpaintcontrols/lcvectorialfill.pas diff --git a/use/lazpaintcontrols/lcvectorialfillcontrol.pas b/lazpaintcontrols/lcvectorialfillcontrol.pas similarity index 100% rename from use/lazpaintcontrols/lcvectorialfillcontrol.pas rename to lazpaintcontrols/lcvectorialfillcontrol.pas diff --git a/use/lazpaintcontrols/lcvectorialfillinterface.pas b/lazpaintcontrols/lcvectorialfillinterface.pas similarity index 99% rename from use/lazpaintcontrols/lcvectorialfillinterface.pas rename to lazpaintcontrols/lcvectorialfillinterface.pas index 965a6c67..fcb6e8f1 100644 --- a/use/lazpaintcontrols/lcvectorialfillinterface.pas +++ b/lazpaintcontrols/lcvectorialfillinterface.pas @@ -1407,6 +1407,6 @@ procedure TVectorialFillInterface.UpdateShapeFill(AShape: TVectorShape; end; begin - {$i ../../resources/fillimages.lrs} + {$i ../resources/fillimages.lrs} end. diff --git a/use/lazpaintcontrols/lcvectormultishape.pas b/lazpaintcontrols/lcvectormultishape.pas similarity index 100% rename from use/lazpaintcontrols/lcvectormultishape.pas rename to lazpaintcontrols/lcvectormultishape.pas diff --git a/use/lazpaintcontrols/lcvectororiginal.pas b/lazpaintcontrols/lcvectororiginal.pas similarity index 100% rename from use/lazpaintcontrols/lcvectororiginal.pas rename to lazpaintcontrols/lcvectororiginal.pas diff --git a/use/lazpaintcontrols/lcvectorpolyshapes.pas b/lazpaintcontrols/lcvectorpolyshapes.pas similarity index 100% rename from use/lazpaintcontrols/lcvectorpolyshapes.pas rename to lazpaintcontrols/lcvectorpolyshapes.pas diff --git a/use/lazpaintcontrols/lcvectorrectshapes.pas b/lazpaintcontrols/lcvectorrectshapes.pas similarity index 100% rename from use/lazpaintcontrols/lcvectorrectshapes.pas rename to lazpaintcontrols/lcvectorrectshapes.pas diff --git a/use/lazpaintcontrols/lcvectorshapes.pas b/lazpaintcontrols/lcvectorshapes.pas similarity index 100% rename from use/lazpaintcontrols/lcvectorshapes.pas rename to lazpaintcontrols/lcvectorshapes.pas diff --git a/use/lazpaintcontrols/lcvectortextshapes.pas b/lazpaintcontrols/lcvectortextshapes.pas similarity index 100% rename from use/lazpaintcontrols/lcvectortextshapes.pas rename to lazpaintcontrols/lcvectortextshapes.pas From 31ed66edb5c5d8fc8f61c1935fe840256aca844d Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Wed, 1 Jan 2025 16:32:23 +0200 Subject: [PATCH 10/23] add lint --- .github/workflows/make.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/make.sh b/.github/workflows/make.sh index d94f1c73..ecd78a7a 100644 --- a/.github/workflows/make.sh +++ b/.github/workflows/make.sh @@ -72,6 +72,12 @@ function priv_lazbuild fi 1>&2 rm "${TMP[out]}" done < <(find "${VAR[src]}" -type 'f' -name '*.lpi' | sort) + find "${VAR[src]}" -type 'f' -name '*.py' -printf '\033[32m\tlint files.py\t%p\033[0m\n' -exec \ + python3 -m pylint {} + 1>&2 + find "${VAR[src]}" -type 'f' -name '*.c' -printf '\033[32m\tlint files.c\t%p\033[0m\n' -exec \ + cppcheck --language=c --enable=warning,style --template=gcc {} + 1>&2 + find "${VAR[src]}" -type 'f' -name '*.sh' -printf '\033[32m\tlint files.sh\t%p\033[0m\n' -exec \ + shellcheck --external-sources {} + 1>&2 exit "${errors}" ) From 67808dc19f8b70bba13418bceae88d2c579e318c Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Wed, 1 Jan 2025 16:37:22 +0200 Subject: [PATCH 11/23] fix lint part --- .github/workflows/make.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/make.sh b/.github/workflows/make.sh index ecd78a7a..5f51695c 100644 --- a/.github/workflows/make.sh +++ b/.github/workflows/make.sh @@ -72,11 +72,11 @@ function priv_lazbuild fi 1>&2 rm "${TMP[out]}" done < <(find "${VAR[src]}" -type 'f' -name '*.lpi' | sort) - find "${VAR[src]}" -type 'f' -name '*.py' -printf '\033[32m\tlint files.py\t%p\033[0m\n' -exec \ + find 'resources' -type 'f' -name '*.py' -printf '\033[32m\tlint files.py\t%p\033[0m\n' -exec \ python3 -m pylint {} + 1>&2 find "${VAR[src]}" -type 'f' -name '*.c' -printf '\033[32m\tlint files.c\t%p\033[0m\n' -exec \ cppcheck --language=c --enable=warning,style --template=gcc {} + 1>&2 - find "${VAR[src]}" -type 'f' -name '*.sh' -printf '\033[32m\tlint files.sh\t%p\033[0m\n' -exec \ + find "${PWD}" -type 'f' -name '*.sh' -printf '\033[32m\tlint files.sh\t%p\033[0m\n' -exec \ shellcheck --external-sources {} + 1>&2 exit "${errors}" ) From 7e62bf8de712603f3581ba16b3e12ca314c2f804 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Wed, 1 Jan 2025 16:39:15 +0200 Subject: [PATCH 12/23] fix lint part --- .github/workflows/make.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/make.sh b/.github/workflows/make.sh index 5f51695c..c38ce4e5 100644 --- a/.github/workflows/make.sh +++ b/.github/workflows/make.sh @@ -28,7 +28,7 @@ function priv_lazbuild case ${ID:?} in debian | ubuntu) sudo apt-get update - sudo apt-get install -y lazarus{-ide-qt5,} & + sudo apt-get install -y lazarus{-ide-qt5,} cppcheck pylint& ;; esac fi From deb5c1ed04130fb1d65a339d5c6e0c19752bc7d3 Mon Sep 17 00:00:00 2001 From: circular17 Date: Thu, 9 Jan 2025 09:01:46 +0100 Subject: [PATCH 13/23] PR #594 AboutText property no longer exists --- lazpaint/test_embedded/unit1.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lazpaint/test_embedded/unit1.pas b/lazpaint/test_embedded/unit1.pas index 7b829158..31cfa91f 100644 --- a/lazpaint/test_embedded/unit1.pas +++ b/lazpaint/test_embedded/unit1.pas @@ -41,7 +41,7 @@ procedure TForm1.Button1Click(Sender: TObject); var lazpaint: TLazPaintInstance; begin lazpaint := TLazPaintInstance.Create; - lazpaint.AboutText:= 'This is the normal application'; + //lazpaint.AboutText:= 'This is the normal application'; lazpaint.Run; lazpaint.Free; end; @@ -51,7 +51,7 @@ procedure TForm1.Button2Click(Sender: TObject); bmp: TBitmap; begin lazpaint := TLazPaintInstance.Create(True); - lazpaint.AboutText:= 'This is an embedded application'; + //lazpaint.AboutText:= 'This is an embedded application'; lazpaint.Run; if lazpaint.EmbeddedResult = mrOK then begin From 0030de77f0e66c0540b5d02579b5ebac9905377a Mon Sep 17 00:00:00 2001 From: circular17 Date: Thu, 9 Jan 2025 10:18:57 +0100 Subject: [PATCH 14/23] explicit error handling --- .github/workflows/make.sh | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/.github/workflows/make.sh b/.github/workflows/make.sh index c38ce4e5..f696624e 100644 --- a/.github/workflows/make.sh +++ b/.github/workflows/make.sh @@ -72,18 +72,40 @@ function priv_lazbuild fi 1>&2 rm "${TMP[out]}" done < <(find "${VAR[src]}" -type 'f' -name '*.lpi' | sort) - find 'resources' -type 'f' -name '*.py' -printf '\033[32m\tlint files.py\t%p\033[0m\n' -exec \ - python3 -m pylint {} + 1>&2 - find "${VAR[src]}" -type 'f' -name '*.c' -printf '\033[32m\tlint files.c\t%p\033[0m\n' -exec \ - cppcheck --language=c --enable=warning,style --template=gcc {} + 1>&2 - find "${PWD}" -type 'f' -name '*.sh' -printf '\033[32m\tlint files.sh\t%p\033[0m\n' -exec \ - shellcheck --external-sources {} + 1>&2 + + # Python linting + find 'resources' -type 'f' -name '*.py' | while read -r file; do + printf '\033[32m\tLinting Python file: %s\033[0m\n' "$file" + if ! python3 -m pylint "$file" 1>&2; then + printf '\033[31m\tError in Python linting: %s\033[0m\n' "$file" + ((errors+=1)) + fi + done + + # C linting + find "${VAR[src]}" -type 'f' -name '*.c' | while read -r file; do + printf '\033[32m\tLinting C file: %s\033[0m\n' "$file" + if ! cppcheck --language=c --enable=warning,style --template=gcc "$file" 1>&2; then + printf '\033[31m\tError in C linting: %s\033[0m\n' "$file" + ((errors+=1)) + fi + done + + # Shell script linting + find "${PWD}" -type 'f' -name '*.sh' | while read -r file; do + printf '\033[32m\tLinting Shell script: %s\033[0m\n' "$file" + if ! shellcheck --external-sources "$file" 1>&2; then + printf '\033[31m\tError in Shell linting: %s\033[0m\n' "$file" + ((errors+=1)) + fi + done + exit "${errors}" ) function priv_main ( - set -euo pipefail + set -uo pipefail if ((${#})); then case ${1} in build) priv_lazbuild ;; From ab1e70523eee3cbf5902f11c8124cc8347003441 Mon Sep 17 00:00:00 2001 From: circular17 Date: Thu, 9 Jan 2025 10:43:45 +0100 Subject: [PATCH 15/23] fix error with Jekyll --- _config.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/_config.yml b/_config.yml index b08ee4f7..10ffb0d8 100644 --- a/_config.yml +++ b/_config.yml @@ -1,2 +1,7 @@ title: LazPaint theme: jekyll-theme-cayman +exclude: + - use/ + - Install/ + - web/ + - winmake/ From 8294055e53d6c811a68ff2dd0bbb6c92ba071724 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Wed, 15 Jan 2025 21:40:16 +0200 Subject: [PATCH 16/23] Rewrote CI to Pascal --- .github/workflows/make.pas | 260 +++++++++++++++++++++++++++++++++++++ .github/workflows/make.ps1 | 130 ------------------- .github/workflows/make.yml | 25 ++-- .gitmodules | 6 - use/bgrabitmap | 1 - use/bgracontrols | 1 - 6 files changed, 276 insertions(+), 147 deletions(-) create mode 100644 .github/workflows/make.pas delete mode 100644 .github/workflows/make.ps1 delete mode 100644 .gitmodules delete mode 160000 use/bgrabitmap delete mode 160000 use/bgracontrols diff --git a/.github/workflows/make.pas b/.github/workflows/make.pas new file mode 100644 index 00000000..4c875216 --- /dev/null +++ b/.github/workflows/make.pas @@ -0,0 +1,260 @@ +program Make; +{$mode objfpc}{$H+} + +uses + Classes, + SysUtils, + StrUtils, + FileUtil, + Zipper, + fphttpclient, + RegExpr, + openssl, + opensslsockets, + Process; + +const + Target: string = 'lazpaint'; + Dependencies: array of string = ('BGRAControls', 'BGRABitmap'); + +type + Output = record + Code: boolean; + Output: ansistring; + end; + + function CheckModules: Output; + begin + if FileExists('.gitmodules') then + if RunCommand('git', ['submodule', 'update', '--init', '--recursive', + '--force', '--remote'], Result.Output) then + Writeln(stderr, #27'[33m', Result.Output, #27'[0m'); + 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 + Writeln(stderr, #27'[33m', 'added ', Path, #27'[0m'); + Free; + end; + end; + + function BuildProject(Path: string): Output; + var + Line: string; + begin + Write(stderr, #27'[33m', 'build from ', Path, #27'[0m'); + try + Result.Code := RunCommand('lazbuild', ['--build-all', '--recursive', + '--no-write-project', Path], Result.Output); + if Result.Code then + for Line in SplitString(Result.Output, LineEnding) do + begin + if ContainsStr(Line, 'Linking') then + begin + Result.Output := SplitString(Line, ' ')[2]; + Writeln(stderr, #27'[32m', ' to ', Result.Output, #27'[0m'); + 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 + begin + WriteLn(stderr); + Writeln(stderr, #27'[31m', Line, #27'[0m'); + end; + Free; + end; + end; + except + on E: Exception do + WriteLn(stderr, '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.Code then + try + if not RunCommand(Temp, ['--all', '--format=plain', '--progress'], Result.Output) then + ExitCode += 1; + WriteLn(stderr, Result.Output); + except + on E: Exception do + WriteLn(stderr, 'Error: ' + E.ClassName + #13#10 + E.Message); + end; + end; + + function AddOPM(Each: string): string; + var + TempFile, Url: string; + Zip: TStream; + begin + Result := + {$IFDEF MSWINDOWS} + GetEnvironmentVariable('APPDATA') + '\.lazarus\onlinepackagemanager\packages\' + {$ELSE} + GetEnvironmentVariable('HOME') + '/.lazarus/onlinepackagemanager/packages/' + {$ENDIF} + + Each; + TempFile := GetTempFileName; + Url := 'https://packages.lazarus-ide.org/' + Each + '.zip'; + if not DirectoryExists(Result) then + begin + Zip := TFileStream.Create(TempFile, fmCreate or fmOpenWrite); + with TFPHttpClient.Create(nil) do + begin + try + AddHeader('User-Agent', 'Mozilla/5.0 (compatible; fpweb)'); + AllowRedirect := True; + Get(Url, Zip); + WriteLn(stderr, 'Download from ', Url, ' to ', TempFile); + finally + Free; + end; + end; + Zip.Free; + CreateDir(Result); + with TUnZipper.Create do + begin + try + FileName := TempFile; + OutputPath := Result; + Examine; + UnZipAllFiles; + WriteLn(stderr, 'Unzip from ', TempFile, ' to ', Result); + finally + Free; + end; + end; + DeleteFile(TempFile); + end; + end; + + function LintPython(Path: string): Output; + begin + WriteLn(stderr, #27'[33m', 'Linting Python file: ', Path, #27'[0m'); + if not RunCommand('python3', ['-m', 'pylint', Path], Result.Output) then + begin + Writeln(stderr, #27'[31m', Result.Output, #27'[0m'); + ExitCode += 1; + end + end; + + function LintC(Path: string): Output; + begin + WriteLn(stderr, #27'[33m', 'Linting C file: ', Path, #27'[0m'); + if not RunCommand('cppcheck', ['--language=c', '--enable=warning,style', '--template=gcc', Path], Result.Output) then + begin + Writeln(stderr, #27'[31m', Result.Output, #27'[0m'); + ExitCode += 1; + end + end; + + function LintPython(Path: string): Output; + begin + WriteLn(stderr, #27'[33m', 'Linting Shell file: ', Path, #27'[0m'); + if not RunCommand('shellcheck', ['--external-sources', Path], Result.Output) then + begin + Writeln(stderr, #27'[31m', Result.Output, #27'[0m'); + ExitCode += 1; + end + end; + + function LintShell(Path: string): Output; + begin + if RunCommand('python3', ['-m', 'pylint', Path], Result.Output) then + Writeln(stderr, #27'[33m', Result.Output, #27'[0m') + else + begin + Writeln(stderr, #27'[31m', Result.Output, #27'[0m'); + ExitCode += 1; + end + end; + + procedure Main; + var + Each, Item: string; + List: TStringList; + begin + CheckModules; + InitSSLInterface; + for Each in Dependencies do + begin + List := FindAllFiles(AddOPM(Each), '*.lpk', True); + try + for Item in List do + AddPackage(Item); + 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 ContainsStr(ReadFileToString(ReplaceStr(Each, '.lpi', '.lpr')), + 'consoletestrunner') then + RunTest(Each) + else + BuildProject(Each); + finally + List.Free; + end; + List := FindAllFiles(GetCurrentDir, '*.py', True); + try + for Each in List do + LintPython(Each); + finally + List.Free; + end; + List := FindAllFiles(GetCurrentDir, '*.c', True); + try + for Each in List do + LintC(Each); + finally + List.Free; + end; + List := FindAllFiles(GetCurrentDir, '*.sh', True); + try + for Each in List do + LintShell(Each); + finally + List.Free; + end; + WriteLn(stderr); + if ExitCode <> 0 then + WriteLn(stderr, #27'[31m', 'Errors: ', ExitCode, #27'[0m') + else + WriteLn(stderr, #27'[32m', 'Errors: ', ExitCode, #27'[0m'); + end; + +begin + Main; +end. diff --git a/.github/workflows/make.ps1 b/.github/workflows/make.ps1 deleted file mode 100644 index 0f8c2d91..00000000 --- a/.github/workflows/make.ps1 +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env pwsh -############################################################################################################## - -Function Show-Usage { - " -Usage: pwsh -File $($PSCommandPath) [OPTIONS] -Options: - build Build program -" | Out-Host -} - -Function Build-Project { - New-Variable -Name VAR -Option Constant -Value @{ - Src = 'lazpaint' - Use = '.' - Pkg = 'use\components.txt' - } - If (! (Test-Path -Path $Var.Src)) { - 'Source do not find!' | Out-Host - Exit 1 - } - If (Test-Path -Path '.gitmodules') { - & git submodule update --init --recursive --force --remote | Out-Host - ".... [[$($LastExitCode)]] git submodule update" | Out-Host - } - @( - @{ - Cmd = 'lazbuild' - Url = 'https://fossies.org/windows/misc/lazarus-3.6-fpc-3.2.2-win64.exe' - Path = "C:\Lazarus" - } - ) | Where-Object { ! (Test-Path -Path $_.Path) } | - ForEach-Object { - $_.Url | Request-File | Install-Program - $Env:PATH+=";$($_.Path)" - (Get-Command $_.Cmd).Source | Out-Host - } - If (Test-Path -Path $VAR.Use) { - If (Test-Path -Path $VAR.Pkg) { - Get-Content -Path $VAR.Pkg | - Where-Object { - ! (Test-Path -Path "$($VAR.Use)\$($_)") && - ! (& lazbuild --verbose-pkgsearch $_ ) && - ! (& lazbuild --add-package $_) - } | ForEach-Object { - Return @{ - Uri = "https://packages.lazarus-ide.org/$($_).zip" - Path = "$($VAR.Use)\$($_)" - OutFile = (New-TemporaryFile).FullName - } - } | ForEach-Object -Parallel { - Invoke-WebRequest -OutFile $_.OutFile -Uri $_.Uri - Expand-Archive -Path $_.OutFile -DestinationPath $_.Path - Remove-Item $_.OutFile - Return ".... download $($_.Uri)" - } | Out-Host - } - (Get-ChildItem -Filter '*.lpk' -Recurse -File –Path $VAR.Use).FullName | - ForEach-Object { - & lazbuild --add-package-link $_ | Out-Null - Return ".... [$($LastExitCode)] add package link $($_)" - } | Out-Host - } - Exit ( - (Get-ChildItem -Filter '*.lpi' -Recurse -File –Path $Var.Src).FullName | - Sort-Object | - ForEach-Object { - $Output = (& lazbuild --build-all --recursive --no-write-project --build-mode='release' $_) - $Result = @(".... [$($LastExitCode)] build project $($_)") - $exitCode = Switch ($LastExitCode) { - 0 { - $Result += $Output | Select-String -Pattern 'Linking' - 0 - } - Default { - $Result += $Output | Select-String -Pattern 'Error:', 'Fatal:' - 1 - } - } - $Result | Out-Host - Return $exitCode - } | Measure-Object -Sum - ).Sum -} - -Function Request-File { - While ($Input.MoveNext()) { - New-Variable -Name VAR -Option Constant -Value @{ - Uri = $Input.Current - OutFile = (Split-Path -Path $Input.Current -Leaf).Split('?')[0] - } - Invoke-WebRequest @VAR - Return $VAR.OutFile - } -} - -Function Install-Program { - While ($Input.MoveNext()) { - Switch ((Split-Path -Path $Input.Current -Leaf).Split('.')[-1]) { - 'msi' { - & msiexec /passive /package $Input.Current | Out-Null - } - Default { - & ".\$($Input.Current)" /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Null - } - } - Remove-Item $Input.Current - } -} - -Function Switch-Action { - $ErrorActionPreference = 'stop' - Set-PSDebug -Strict #-Trace 1 - Invoke-ScriptAnalyzer -EnableExit -Path $PSCommandPath - If ($args.count -gt 0) { - Switch ($args[0]) { - 'build' { - Build-Project - } - Default { - Show-Usage - } - } - } Else { - Show-Usage - } -} - -############################################################################################################## -Switch-Action @args diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index 006d55cd..04f9bdba 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -34,16 +34,23 @@ jobs: - name: Build on Linux if: runner.os == 'Linux' shell: bash - run: bash .github/workflows/make.sh build + 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: pwsh -File .github/workflows/make.ps1 build - - - name: Archive - if: runner.os == 'Windows' - uses: actions/upload-artifact@v4 - with: - retention-days: 1 - path: src\bin\*.exe + run: | + New-Variable -Option Constant -Name VAR -Value @{ + Uri = 'https://fossies.org/windows/misc/lazarus-3.6-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 diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index fe8b2cba..00000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "use/bgracontrols"] - path = use/bgracontrols - url = git@github.com:bgrabitmap/bgracontrols.git -[submodule "use/bgrabitmap"] - path = use/bgrabitmap - url = git@github.com:bgrabitmap/bgrabitmap.git diff --git a/use/bgrabitmap b/use/bgrabitmap deleted file mode 160000 index 311fa8d5..00000000 --- a/use/bgrabitmap +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 311fa8d5f9b2baabdb3490ded5f721e68ea67ae2 diff --git a/use/bgracontrols b/use/bgracontrols deleted file mode 160000 index 555c0df8..00000000 --- a/use/bgracontrols +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 555c0df8e2c52c60a9099d1bfd7b14c19852d5a4 From 1b7269a28d2209ad284b067bf526c6129416d295 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Wed, 15 Jan 2025 21:41:39 +0200 Subject: [PATCH 17/23] Rewrote CI to Pascal --- .github/workflows/make.sh | 119 -------------------------------------- 1 file changed, 119 deletions(-) delete mode 100644 .github/workflows/make.sh diff --git a/.github/workflows/make.sh b/.github/workflows/make.sh deleted file mode 100644 index f696624e..00000000 --- a/.github/workflows/make.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env bash - -function priv_clippit -( - cat <&2 - fi - declare -i errors=0 - while read -r; do - declare -A TMP=( - [out]=$(mktemp) - ) - if (lazbuild --build-all --recursive --no-write-project --build-mode='release' --widgetset='qt5' "${REPLY}" > "${TMP[out]}"); then - printf '\x1b[32m\t[%s]\t%s\x1b[0m\n' "${?}" "${REPLY}" - grep --color='always' 'Linking' "${TMP[out]}" - else - printf '\x1b[31m\t[%s]\t%s\x1b[0m\n' "${?}" "${REPLY}" - grep --color='always' --extended-regexp '(Error|Fatal):' "${TMP[out]}" - ((errors+=1)) - fi 1>&2 - rm "${TMP[out]}" - done < <(find "${VAR[src]}" -type 'f' -name '*.lpi' | sort) - - # Python linting - find 'resources' -type 'f' -name '*.py' | while read -r file; do - printf '\033[32m\tLinting Python file: %s\033[0m\n' "$file" - if ! python3 -m pylint "$file" 1>&2; then - printf '\033[31m\tError in Python linting: %s\033[0m\n' "$file" - ((errors+=1)) - fi - done - - # C linting - find "${VAR[src]}" -type 'f' -name '*.c' | while read -r file; do - printf '\033[32m\tLinting C file: %s\033[0m\n' "$file" - if ! cppcheck --language=c --enable=warning,style --template=gcc "$file" 1>&2; then - printf '\033[31m\tError in C linting: %s\033[0m\n' "$file" - ((errors+=1)) - fi - done - - # Shell script linting - find "${PWD}" -type 'f' -name '*.sh' | while read -r file; do - printf '\033[32m\tLinting Shell script: %s\033[0m\n' "$file" - if ! shellcheck --external-sources "$file" 1>&2; then - printf '\033[31m\tError in Shell linting: %s\033[0m\n' "$file" - ((errors+=1)) - fi - done - - exit "${errors}" -) - -function priv_main -( - set -uo pipefail - if ((${#})); then - case ${1} in - build) priv_lazbuild ;; - *) priv_clippit ;; - esac - else - priv_clippit - fi -) - -priv_main "${@}" >/dev/null From 5f40b9620507340000bcded1234fc8582dc4eb40 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Wed, 15 Jan 2025 21:48:21 +0200 Subject: [PATCH 18/23] Rewrote CI to Pascal --- .github/workflows/make.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/make.pas b/.github/workflows/make.pas index 4c875216..e398d715 100644 --- a/.github/workflows/make.pas +++ b/.github/workflows/make.pas @@ -171,7 +171,7 @@ Output = record end end; - function LintPython(Path: string): Output; + function LintShell(Path: string): Output; begin WriteLn(stderr, #27'[33m', 'Linting Shell file: ', Path, #27'[0m'); if not RunCommand('shellcheck', ['--external-sources', Path], Result.Output) then From 906b69bd5097e165b195ec5e0b18166c28988528 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Wed, 15 Jan 2025 21:53:27 +0200 Subject: [PATCH 19/23] fix github-actions --- .github/workflows/make.pas | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/make.pas b/.github/workflows/make.pas index e398d715..4c5f7edb 100644 --- a/.github/workflows/make.pas +++ b/.github/workflows/make.pas @@ -181,17 +181,6 @@ Output = record end end; - function LintShell(Path: string): Output; - begin - if RunCommand('python3', ['-m', 'pylint', Path], Result.Output) then - Writeln(stderr, #27'[33m', Result.Output, #27'[0m') - else - begin - Writeln(stderr, #27'[31m', Result.Output, #27'[0m'); - ExitCode += 1; - end - end; - procedure Main; var Each, Item: string; From 4d684fd4d6ea746704d85e499a3c7d82b55a4110 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Wed, 15 Jan 2025 21:58:45 +0200 Subject: [PATCH 20/23] fix github-actions --- .github/workflows/make.pas | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/make.pas b/.github/workflows/make.pas index 4c5f7edb..68c36d06 100644 --- a/.github/workflows/make.pas +++ b/.github/workflows/make.pas @@ -216,6 +216,7 @@ Output = record finally List.Free; end; + {$IFDEF LINUX} List := FindAllFiles(GetCurrentDir, '*.py', True); try for Each in List do @@ -237,6 +238,7 @@ Output = record finally List.Free; end; + {$ENDIF} WriteLn(stderr); if ExitCode <> 0 then WriteLn(stderr, #27'[31m', 'Errors: ', ExitCode, #27'[0m') From f16955acec58dfebfeabfbbc562b5ba6965db1e5 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Thu, 16 Jan 2025 13:30:18 +0200 Subject: [PATCH 21/23] fix github-actions --- .github/workflows/make.pas | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/make.pas b/.github/workflows/make.pas index 68c36d06..d5aa443d 100644 --- a/.github/workflows/make.pas +++ b/.github/workflows/make.pas @@ -97,8 +97,10 @@ Output = record if Result.Code then try if not RunCommand(Temp, ['--all', '--format=plain', '--progress'], Result.Output) then - ExitCode += 1; - WriteLn(stderr, Result.Output); + begin + ExitCode += 1; + WriteLn(stderr, Result.Output); + end; except on E: Exception do WriteLn(stderr, 'Error: ' + E.ClassName + #13#10 + E.Message); @@ -157,7 +159,7 @@ Output = record if not RunCommand('python3', ['-m', 'pylint', Path], Result.Output) then begin Writeln(stderr, #27'[31m', Result.Output, #27'[0m'); - ExitCode += 1; + //ExitCode += 1; end end; @@ -167,7 +169,7 @@ Output = record if not RunCommand('cppcheck', ['--language=c', '--enable=warning,style', '--template=gcc', Path], Result.Output) then begin Writeln(stderr, #27'[31m', Result.Output, #27'[0m'); - ExitCode += 1; + //ExitCode += 1; end end; @@ -177,7 +179,7 @@ Output = record if not RunCommand('shellcheck', ['--external-sources', Path], Result.Output) then begin Writeln(stderr, #27'[31m', Result.Output, #27'[0m'); - ExitCode += 1; + //ExitCode += 1; end end; From cbfde42522667abf5940fd8a2f1c687cd73d15c7 Mon Sep 17 00:00:00 2001 From: "Artem V. Ageev" Date: Thu, 16 Jan 2025 22:18:25 +0200 Subject: [PATCH 22/23] return use/bgrabitmap and use/bgracontrols --- .github/workflows/make.pas | 138 ++++++++++++++++--------------------- .gitmodules | 6 ++ use/bgrabitmap | 1 + use/bgracontrols | 1 + 4 files changed, 69 insertions(+), 77 deletions(-) create mode 100644 .gitmodules create mode 160000 use/bgrabitmap create mode 160000 use/bgracontrols diff --git a/.github/workflows/make.pas b/.github/workflows/make.pas index d5aa443d..843b63e9 100644 --- a/.github/workflows/make.pas +++ b/.github/workflows/make.pas @@ -15,12 +15,22 @@ const Target: string = 'lazpaint'; - Dependencies: array of string = ('BGRAControls', 'BGRABitmap'); + Dependencies: array of string = (); type + TLog = (audit, info, error); Output = record - Code: boolean; - Output: ansistring; + 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; @@ -28,7 +38,7 @@ Output = record if FileExists('.gitmodules') then if RunCommand('git', ['submodule', 'update', '--init', '--recursive', '--force', '--remote'], Result.Output) then - Writeln(stderr, #27'[33m', Result.Output, #27'[0m'); + OutLog(info, Result.Output); end; function AddPackage(Path: string): Output; @@ -37,14 +47,14 @@ Output = record begin Expression := {$IFDEF MSWINDOWS} - '(cocoa|x11|_template)' - {$ELSE} - '(cocoa|gdi|_template)' - {$ENDIF} + '(cocoa|x11|_template)' + {$ELSE} + '(cocoa|gdi|_template)' + {$ENDIF} ; if not Exec(Path) and RunCommand('lazbuild', ['--add-package-link', Path], Result.Output) then - Writeln(stderr, #27'[33m', 'added ', Path, #27'[0m'); + OutLog(audit, 'added ' + Path); Free; end; end; @@ -53,17 +63,17 @@ Output = record var Line: string; begin - Write(stderr, #27'[33m', 'build from ', Path, #27'[0m'); + OutLog(audit, 'build from ' + Path); try - Result.Code := RunCommand('lazbuild', ['--build-all', '--recursive', + Result.Success := RunCommand('lazbuild', ['--build-all', '--recursive', '--no-write-project', Path], Result.Output); - if Result.Code then + if Result.Success then for Line in SplitString(Result.Output, LineEnding) do begin if ContainsStr(Line, 'Linking') then begin Result.Output := SplitString(Line, ' ')[2]; - Writeln(stderr, #27'[32m', ' to ', Result.Output, #27'[0m'); + OutLog(info, ' to ' + Result.Output); break; end; end @@ -75,16 +85,13 @@ Output = record begin Expression := '(Fatal|Error):'; if Exec(Line) then - begin - WriteLn(stderr); - Writeln(stderr, #27'[31m', Line, #27'[0m'); - end; + OutLog(error, #10 + Line); Free; end; end; except on E: Exception do - WriteLn(stderr, 'Error: ' + E.ClassName + #13#10 + E.Message); + OutLog(error, E.ClassName + #13#10 + E.Message); end; end; @@ -94,22 +101,22 @@ Output = record begin Result := BuildProject(Path); Temp:= Result.Output; - if Result.Code then + if Result.Success then try if not RunCommand(Temp, ['--all', '--format=plain', '--progress'], Result.Output) then - begin - ExitCode += 1; - WriteLn(stderr, Result.Output); - end; + begin + ExitCode += 1; + OutLog(error, Result.Output); + end; except on E: Exception do - WriteLn(stderr, 'Error: ' + E.ClassName + #13#10 + E.Message); + OutLog(error, E.ClassName + #13#10 + E.Message); end; end; - function AddOPM(Each: string): string; + function InstallOPM(Each: string): string; var - TempFile, Url: string; + OutFile, Uri: string; Zip: TStream; begin Result := @@ -119,18 +126,18 @@ Output = record GetEnvironmentVariable('HOME') + '/.lazarus/onlinepackagemanager/packages/' {$ENDIF} + Each; - TempFile := GetTempFileName; - Url := 'https://packages.lazarus-ide.org/' + Each + '.zip'; + OutFile := GetTempFileName; + Uri := 'https://packages.lazarus-ide.org/' + Each + '.zip'; if not DirectoryExists(Result) then begin - Zip := TFileStream.Create(TempFile, fmCreate or fmOpenWrite); + 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(Url, Zip); - WriteLn(stderr, 'Download from ', Url, ' to ', TempFile); + Get(Uri, Zip); + OutLog(audit, 'Download from ' + Uri + ' to ' + OutFile); finally Free; end; @@ -140,62 +147,62 @@ Output = record with TUnZipper.Create do begin try - FileName := TempFile; + FileName := OutFile; OutputPath := Result; Examine; UnZipAllFiles; - WriteLn(stderr, 'Unzip from ', TempFile, ' to ', Result); + OutLog(audit, 'Unzip from ' + OutFile + ' to ' + Result); finally Free; end; end; - DeleteFile(TempFile); + DeleteFile(OutFile); end; end; function LintPython(Path: string): Output; begin - WriteLn(stderr, #27'[33m', 'Linting Python file: ', Path, #27'[0m'); + OutLog(audit, 'Linting Python file: ' + Path); if not RunCommand('python3', ['-m', 'pylint', Path], Result.Output) then begin - Writeln(stderr, #27'[31m', Result.Output, #27'[0m'); + OutLog(error, Result.Output); //ExitCode += 1; end end; function LintC(Path: string): Output; begin - WriteLn(stderr, #27'[33m', 'Linting C file: ', Path, #27'[0m'); + OutLog(audit, 'Linting C file: ' + Path); if not RunCommand('cppcheck', ['--language=c', '--enable=warning,style', '--template=gcc', Path], Result.Output) then begin - Writeln(stderr, #27'[31m', Result.Output, #27'[0m'); + OutLog(error, Result.Output); //ExitCode += 1; end end; function LintShell(Path: string): Output; begin - WriteLn(stderr, #27'[33m', 'Linting Shell file: ', Path, #27'[0m'); + OutLog(audit, 'Linting Shell file: ' + Path); if not RunCommand('shellcheck', ['--external-sources', Path], Result.Output) then begin - Writeln(stderr, #27'[31m', Result.Output, #27'[0m'); + OutLog(error, Result.Output); //ExitCode += 1; end end; - procedure Main; + procedure BuildAll; var Each, Item: string; List: TStringList; begin CheckModules; InitSSLInterface; - for Each in Dependencies do + for Item in Dependencies do begin - List := FindAllFiles(AddOPM(Each), '*.lpk', True); + List := FindAllFiles(InstallOPM(Item), '*.lpk', True); try - for Item in List do - AddPackage(Item); + for Each in List do + AddPackage(Each); finally List.Free; end; @@ -210,44 +217,21 @@ Output = record List := FindAllFiles(Target, '*.lpi', True); try for Each in List do - if ContainsStr(ReadFileToString(ReplaceStr(Each, '.lpi', '.lpr')), - 'consoletestrunner') then - RunTest(Each) - else - BuildProject(Each); - finally - List.Free; - end; - {$IFDEF LINUX} - List := FindAllFiles(GetCurrentDir, '*.py', True); - try - for Each in List do - LintPython(Each); - finally - List.Free; - end; - List := FindAllFiles(GetCurrentDir, '*.c', True); - try - for Each in List do - LintC(Each); - finally - List.Free; - end; - List := FindAllFiles(GetCurrentDir, '*.sh', True); - try - for Each in List do - LintShell(Each); + if not ContainsStr(Each, 'zengl') then + if ContainsStr(ReadFileToString(ReplaceStr(Each, '.lpi', '.lpr')), + 'consoletestrunner') then + RunTest(Each) + else + BuildProject(Each); finally List.Free; end; - {$ENDIF} - WriteLn(stderr); if ExitCode <> 0 then - WriteLn(stderr, #27'[31m', 'Errors: ', ExitCode, #27'[0m') + OutLog(error, #10 + 'Errors: ' + IntToStr(ExitCode)) else - WriteLn(stderr, #27'[32m', 'Errors: ', ExitCode, #27'[0m'); + OutLog(info, #10 + 'Errors: ' + IntToStr(ExitCode)); end; begin - Main; + BuildAll; end. diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..b0432302 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "use/bgrabitmap"] + path = use/bgrabitmap + url = git@github.com:bgrabitmap/bgrabitmap.git +[submodule "use/bgracontrols"] + path = use/bgracontrols + url = git@github.com:bgrabitmap/bgracontrols.git diff --git a/use/bgrabitmap b/use/bgrabitmap new file mode 160000 index 00000000..311fa8d5 --- /dev/null +++ b/use/bgrabitmap @@ -0,0 +1 @@ +Subproject commit 311fa8d5f9b2baabdb3490ded5f721e68ea67ae2 diff --git a/use/bgracontrols b/use/bgracontrols new file mode 160000 index 00000000..555c0df8 --- /dev/null +++ b/use/bgracontrols @@ -0,0 +1 @@ +Subproject commit 555c0df8e2c52c60a9099d1bfd7b14c19852d5a4 From 87aa62ae49731ee2ba6dfcabd5af4545605abbe0 Mon Sep 17 00:00:00 2001 From: circular17 Date: Sat, 22 Feb 2025 14:24:37 +0100 Subject: [PATCH 23/23] Update lazarus version --- .github/workflows/make.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml index 04f9bdba..0198eb7d 100644 --- a/.github/workflows/make.yml +++ b/.github/workflows/make.yml @@ -44,7 +44,7 @@ jobs: shell: powershell run: | New-Variable -Option Constant -Name VAR -Value @{ - Uri = 'https://fossies.org/windows/misc/lazarus-3.6-fpc-3.2.2-win64.exe' + Uri = 'https://fossies.org/windows/misc/lazarus-3.8-fpc-3.2.2-win64.exe' OutFile = (New-TemporaryFile).FullName + '.exe' } Invoke-WebRequest @VAR