From da8fccc69fe1d04649ced6b6f8afc176f6c0bec5 Mon Sep 17 00:00:00 2001 From: Marek Mauder Date: Wed, 5 Aug 2026 00:12:41 +0200 Subject: [PATCH 1/2] Fix build with FPC trunk in release mode With -O3 you got "Asm: [lea reg64,reg64,mem64] invalid combination of opcode and operands". Looks like an optimization bug in the compiler. --- Source/ImagingGif.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/ImagingGif.pas b/Source/ImagingGif.pas index 9563ca8..d29fdf3 100644 --- a/Source/ImagingGif.pas +++ b/Source/ImagingGif.pas @@ -1106,8 +1106,8 @@ function TGIFFileFormat.SaveData(Handle: TImagingHandle; for I := FFirstIdx + 1 to FLastIdx do begin - MaxWidth := Iff(Images[I].Width > MaxWidth, Images[I].Width, MaxWidth); - MaxHeight := Iff(Images[I].Height > MaxWidth, Images[I].Height, MaxHeight); + MaxWidth := Max(MaxWidth, Images[I].Width); + MaxHeight := Max(MaxHeight, Images[I].Height); end; end; From 3c1be351e3fb55ab8f1fde48416b6db11080e385 Mon Sep 17 00:00:00 2001 From: Marek Mauder Date: Tue, 4 Aug 2026 18:42:23 +0200 Subject: [PATCH 2/2] CI: add build job to test with FPC+Lazarus trunk builds - also check exec flag for shell scripts (commits on Windows can screw it) - artifact uploads have whole Demos folder, easy to copy over to Src release - moved more work from workflow steps to Scripts/CI.*.sh scripts --- .github/workflows/ci.yml | 108 +++++++++++++++++++++----------- Scripts/BuildDemosFPC.sh | 1 + Scripts/BuildExtDemosFPC.sh | 1 + Scripts/CI.BuildDemosFPC.sh | 2 +- Scripts/CI.BuildDemosLazarus.sh | 2 +- Scripts/CI.Common.sh | 2 +- Scripts/CI.PrintInfo.sh | 12 ++++ Scripts/CI.RunDemos.sh | 2 +- Scripts/CI.SetupLinux.sh | 30 +++++++++ Scripts/Clean.sh | 2 +- Scripts/DemosCommonFPC.sh | 10 +-- 11 files changed, 125 insertions(+), 47 deletions(-) mode change 100644 => 100755 Scripts/CI.BuildDemosFPC.sh mode change 100644 => 100755 Scripts/CI.BuildDemosLazarus.sh mode change 100644 => 100755 Scripts/CI.Common.sh create mode 100755 Scripts/CI.PrintInfo.sh mode change 100644 => 100755 Scripts/CI.RunDemos.sh create mode 100755 Scripts/CI.SetupLinux.sh mode change 100644 => 100755 Scripts/DemosCommonFPC.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 785a448..f225797 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,13 +62,27 @@ jobs: laz-url: ${{ matrix.laz-url }} fpc-url: ${{ matrix.fpc-url }} + - name: Verify script executable bits (Git tree) + shell: bash + run: | + # Check that CI and other scripts are executable. Git on Windows can break the exec flag if you edit the file there and commit. + FAIL=0 + for FILE in Scripts/*.sh; do + MODE="$(git ls-files -s "$FILE" | awk '{print $1}')" + if [ "$MODE" != "100755" ]; then + echo "::error file=$FILE::Missing executable bit in Git tree (mode $MODE)" + FAIL=1 + fi + done + exit $FAIL + - name: Setup Windows if: runner.os == 'Windows' shell: bash run: | # Add FPC to PATH LAZ_DIR="$RUNNER_TEMP/lazarus" - FPC_BIN=$(find "$LAZ_DIR/" -name "fpc.exe" | head -1) + FPC_BIN=$(find "$LAZ_DIR/" -type f -executable -name "fpc.exe" | head -1) FPC_DIR=$(dirname "$FPC_BIN") echo "Found FPC: $FPC_BIN" echo "$FPC_DIR" >> $GITHUB_PATH @@ -83,30 +97,7 @@ jobs: - name: Setup Linux if: runner.os == 'Linux' shell: bash - run: | - # Needed for SDL and GL demos - sudo apt install libsdl1.2-dev -y - - # To build LCL demos with GTK3 backend. - sudo apt install libgtk-3-dev - - # To build LCL demos with Qt5 backend. If you see any linking problems, rather - # install the latest libqt5pas release from https://github.com/davidbannon/libqt5pas/releases - sudo apt install libqt5pas-dev -y - - # With current Lazarus + Ubuntu versions we need to get newer libqt6pas release - BASE_URL=https://github.com/davidbannon/libqt6pas/releases/download/v6.2.10 - if [[ "$RUNNER_ARCH" == "X64" ]]; then - wget $BASE_URL/libqt6pas6_6.2.10-1_amd64.deb - sudo apt install ./libqt6pas6_6.2.10-1_amd64.deb -y - wget $BASE_URL/libqt6pas6-dev_6.2.10-1_amd64.deb - sudo apt install ./libqt6pas6-dev_6.2.10-1_amd64.deb -y - else - wget $BASE_URL/libqt6pas6_6.2.10-1_arm64.deb - sudo apt install ./libqt6pas6_6.2.10-1_arm64.deb -y - wget $BASE_URL/libqt6pas6-dev_6.2.10-1_arm64.deb - sudo apt install ./libqt6pas6-dev_6.2.10-1_arm64.deb -y - fi + run: ./Scripts/CI.SetupLinux.sh - name: Setup macOS if: runner.os == 'macOS' @@ -118,21 +109,15 @@ jobs: - name: Print info shell: bash - run: | - echo "Lazarus:" $(lazbuild --version) - echo "FPC:" $(fpc -iWTPTO) - echo "OS: "$RUNNER_OS", ARCH:" $RUNNER_ARCH - if [ "$RUNNER_OS" == "Linux" ]; then - echo " "$(lsb_release -d) - fi + run: ./Scripts/CI.PrintInfo.sh - name: Build demos with FPC shell: bash - run: bash -e ./Scripts/CI.BuildDemosFPC.sh + run: ./Scripts/CI.BuildDemosFPC.sh - name: Build demos with Lazarus shell: bash - run: bash -e ./Scripts/CI.BuildDemosLazarus.sh + run: ./Scripts/CI.BuildDemosLazarus.sh - name: Build Lazarus packages shell: bash @@ -142,7 +127,7 @@ jobs: - name: Run demos shell: bash - run: bash -e ./Scripts/CI.RunDemos.sh + run: ./Scripts/CI.RunDemos.sh - name: List Demos Bin directory shell: bash @@ -152,8 +137,57 @@ jobs: with: name: ci-artifacts-${{ runner.os }}-${{ runner.arch }} path: | - Demos/Bin - Demos/Data + Demos + !Demos/ObjectPascal !Demos/Bin/Dcu if-no-files-found: error + # Extra non-critical job: test FPC trunk compiler via fpclazup on Ubuntu + build-fpc-trunk: + runs-on: ubuntu-latest + continue-on-error: true + timeout-minutes: 30 + steps: + - uses: actions/checkout@v7 + + - name: Install Lazarus + FPC trunk (fpclazup) + uses: ollydev/setup-lazarus@v4.1 + with: + fpclazup-url: https://github.com/LongDirtyAnimAlf/Reiniero-fpcup/releases/download/v2.4.0i/fpclazup-x86_64-linux + fpclazup-lazcommit: a3e4c43c3d # Lazarus 4.99-5622 2026-07-16 + fpclazup-fpccommit: ad4da509ba # FPC trunk 3.3.1-20578 2026-07-16 + + - name: Setup Linux + if: runner.os == 'Linux' + shell: bash + run: ./Scripts/CI.SetupLinux.sh + + - name: Print info + shell: bash + run: ./Scripts/CI.PrintInfo.sh + + - name: Build demos with Lazarus + shell: bash + run: ./Scripts/CI.BuildDemosLazarus.sh + + - name: Run demos + shell: bash + run: ./Scripts/CI.RunDemos.sh + + - name: Report trunk build outcome + if: always() + run: | + if [ "${{ job.status }}" = "failure" ]; then + echo "::warning::Build with FPC + Lazarus trunk failed." + fi + + - uses: actions/upload-artifact@v7 + with: + name: ci-artifacts-trunk-build-${{ runner.os }}-${{ runner.arch }} + path: | + Demos + !Demos/ObjectPascal + !Demos/Bin/Dcu + if-no-files-found: error + + diff --git a/Scripts/BuildDemosFPC.sh b/Scripts/BuildDemosFPC.sh index 4d80fd3..2dc2ee6 100755 --- a/Scripts/BuildDemosFPC.sh +++ b/Scripts/BuildDemosFPC.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -eo pipefail echo "Building Demos using Free Pascal" echo diff --git a/Scripts/BuildExtDemosFPC.sh b/Scripts/BuildExtDemosFPC.sh index 07eabf1..c8b28c9 100755 --- a/Scripts/BuildExtDemosFPC.sh +++ b/Scripts/BuildExtDemosFPC.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -eo pipefail # Ext. demos have some build and/or runtime dependencies like SDL or GL. # libsdl1.2-dev package should take care of both. diff --git a/Scripts/CI.BuildDemosFPC.sh b/Scripts/CI.BuildDemosFPC.sh old mode 100644 new mode 100755 index ed1acf7..260fc9f --- a/Scripts/CI.BuildDemosFPC.sh +++ b/Scripts/CI.BuildDemosFPC.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -e +set -eo pipefail SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" source "$SCRIPT_DIR/CI.Common.sh" diff --git a/Scripts/CI.BuildDemosLazarus.sh b/Scripts/CI.BuildDemosLazarus.sh old mode 100644 new mode 100755 index 104fab7..efaf4f6 --- a/Scripts/CI.BuildDemosLazarus.sh +++ b/Scripts/CI.BuildDemosLazarus.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -e +set -eo pipefail SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" source "$SCRIPT_DIR/CI.Common.sh" diff --git a/Scripts/CI.Common.sh b/Scripts/CI.Common.sh old mode 100644 new mode 100755 index 87d96a4..9917801 --- a/Scripts/CI.Common.sh +++ b/Scripts/CI.Common.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -e +set -eo pipefail # Directory containing CI.Common.sh, normally /Scripts SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" diff --git a/Scripts/CI.PrintInfo.sh b/Scripts/CI.PrintInfo.sh new file mode 100755 index 0000000..e1187b0 --- /dev/null +++ b/Scripts/CI.PrintInfo.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -eo pipefail + +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" +source "$SCRIPT_DIR/CI.Common.sh" + +echo "Lazarus:" $(lazbuild --version) +echo "FPC:" $(fpc -iWTPTO) +echo "OS: "$RUNNER_OS", ARCH:" $RUNNER_ARCH +if [ "$RUNNER_OS" == "Linux" ]; then +echo " "$(lsb_release -d) +fi diff --git a/Scripts/CI.RunDemos.sh b/Scripts/CI.RunDemos.sh old mode 100644 new mode 100755 index 56a5f38..d1541fc --- a/Scripts/CI.RunDemos.sh +++ b/Scripts/CI.RunDemos.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -e +set -eo pipefail SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" source "$SCRIPT_DIR/CI.Common.sh" diff --git a/Scripts/CI.SetupLinux.sh b/Scripts/CI.SetupLinux.sh new file mode 100755 index 0000000..37fe628 --- /dev/null +++ b/Scripts/CI.SetupLinux.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +set -eo pipefail + +# Setup for GitHub Actions Ubuntu runners. +# 2026-08-04: ubuntu-latest is Ubuntu 24.04 + +# Needed for SDL and GL demos +sudo apt install libsdl1.2-dev -y + +# To build LCL demos with GTK3 backend. +sudo apt install libgtk-3-dev + +# To build LCL demos with Qt5 backend. If you see any linking problems, rather +# install the latest libqt5pas release from https://github.com/davidbannon/libqt5pas/releases +sudo apt install libqt5pas-dev -y + +# With current Lazarus + Ubuntu versions we need to get newer libqt6pas release +BASE_URL=https://github.com/davidbannon/libqt6pas/releases/download/v6.2.10 + +if [[ "$RUNNER_ARCH" == "X64" ]]; then + wget $BASE_URL/libqt6pas6_6.2.10-1_amd64.deb + sudo apt install ./libqt6pas6_6.2.10-1_amd64.deb -y + wget $BASE_URL/libqt6pas6-dev_6.2.10-1_amd64.deb + sudo apt install ./libqt6pas6-dev_6.2.10-1_amd64.deb -y +else + wget $BASE_URL/libqt6pas6_6.2.10-1_arm64.deb + sudo apt install ./libqt6pas6_6.2.10-1_arm64.deb -y + wget $BASE_URL/libqt6pas6-dev_6.2.10-1_arm64.deb + sudo apt install ./libqt6pas6-dev_6.2.10-1_arm64.deb -y +fi diff --git a/Scripts/Clean.sh b/Scripts/Clean.sh index 9fbbd57..dd7e068 100755 --- a/Scripts/Clean.sh +++ b/Scripts/Clean.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Mark with /usr/bin/env so new bash version (Homebrew etc.) is picked up for this script in macOS -set -e +set -eo pipefail # enable /** globbing, needs Bash 4.0 or later (macOS has Bash 3.2 by default) shopt -s globstar diff --git a/Scripts/DemosCommonFPC.sh b/Scripts/DemosCommonFPC.sh old mode 100644 new mode 100755 index 92c1f74..37c24a7 --- a/Scripts/DemosCommonFPC.sh +++ b/Scripts/DemosCommonFPC.sh @@ -16,7 +16,7 @@ FPCOS=$($FPC -iTO | tr -d '\r') FPCTARGET=$FPCCPU-$FPCOS ROOTDIR=".." -DEMOPATH="$ROOTDIR/Demos/ObjectPascal" +DEMOPATH="$ROOTDIR/Demos/ObjectPascal" BINPATH="$ROOTDIR/Demos/Bin" UNITPATH="$ROOTDIR/Demos/Bin/Dcu/$FPCTARGET" # FPC does not like creating any new directories passed by -FE -FU @@ -28,18 +28,18 @@ OUTPUT="-FE$BINPATH -FU$UNITPATH" # This is how you suppress -vn set in fpc.cfg OPTIONS="-B -O3 -Xs -vn-" INCLUDE="-Fi$ROOTDIR/Source" -LIBS="-Fl$ROOTDIR/Extensions/J2KObjects -Fl$ROOTDIR/Extensions/LibTiff/Compiled" +LIBS="-Fl$ROOTDIR/Extensions/J2KObjects -Fl$ROOTDIR/Extensions/LibTiff/Compiled" DEMOSBUILD=0 DEMOCOUNT=0 function buildDemo { $FPC $OPTIONS $OUTPUT $TARGET $DEFINES $UNITS $INCLUDE $LIBS $DEMOPATH/$1 - if [ $? = 0 ]; then + if [ $? = 0 ]; then ((DEMOSBUILD++)) - fi + fi echo -} +} function printResult { SWITCH="\033["