LAZARUS FPC: INSTALLATION.

1) After downloading the three necessary packages via the Lazarus web site, use

sudo apt install ./fpc-*.deb ./laz*.deb

to install them; relative to dpkg -i, this automatically installs required additional packages, meaning apt-get --fix-broken install won't be needed. (Adding the --no-install-recommends flag is a worthwhile experiment.) Although Lazarus will complain if it isn't installed, gdb is not a required dependency and so may need separate installation:

sudo apt install gdb

(Finding out whether gdb-minimal will suffice is another worthwhile experiment.)

2) Setting up for 64-bit Windows cross-compilation. This must be done before starting Lazarus for the first time; mysterious/spurious error messages may appear otherwise...

cd /usr/share/fpcsrc/X.Y.Z/ # change X.Y.Z to the correct version numbers!

sudo make -j 4 clean all OS_TARGET=win64 CPU_TARGET=x86_64 # where 4 is the number of cores you have

sudo make -j 4 crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=/usr

sudo ln -sf /usr/lib/fpc/X.Y.Z/ppcrossx64 /usr/bin/ppcrossx64 # X.Y.Z again

3) Accounting for a bug. If the Lazarus editor misbehaves, edit the Lazarus launcher file, which in KDE Plasma 5 is listed in the Application Launcher menu under Development, and prepend

GTK_IM_MODULE=gtk-im-context-simple

to the "lazarus %f" entry. (In my present context this is not needed.)

4) Use Package|Install/Uninstall Packages to enable single-window mode for Lazarus itself by installing the AnchorDocking packages.

5) Use Package|Online Package Manager to install TRichMemo.

...

LAZARUS FPC: ACTUALLY DOING SOMETHING.

On startup, Lazarus supplies a default project as though you had clicked Project|New Project. If you build it out of the box, its Form1/Unit1 files will be saved in the folder ~/tmp.

To make it less generic:

A. use the Object Inspector to rename Form1;

B. do Project|Save Project As. This presents at least two dialogs; while going through those:

i. Use the Create Folder button to create an appropriate folder to save the project in;

ii. set the name of the project while saving its .lpi;

iii. set the name of Unit1.pas while saving that.

Example: rename Form1 as DemonstratinatorForm, save project as Demonstratinator.lpi in a folder called Demonstratinator, and then save Unit1.pas under the name DemonstrinatorFormUnit.pas (the filename will be lowercased by Lazarus, though the unit name retains its capitalization; note in passing that Pascal is not case sensitive).

At this point, or perhaps before this point, it may be desirable — as cross-compilation was enabled above — to do what's necessary to keep all the various architecture/OS/widget-set bits neatly separated.

A. Invoke Project|Project Options; select Compiler Options|Paths; change the entry for Unit Output directory, which probably reads something like

lib/$(TargetOS)

to

lib/$(TargetCPU)/$(TargetOS)/$(LCLWidgetType)

and then set Target file name similarly by prepending the same string, so that if it read

fred

it now says

lib/$(TargetCPU)/$(TargetOS)/$(LCLWidgetType)/fred

B. Add another build mode by clicking the Build modes ellipsis button at the top of the dialog and then the + button in the dialog that follows. Name it Win64.

C. Select Compiler Options|Config and Target. Define the Target OS for the Win64 build mode as Win64 but leave the "Win32 gui application" box ticked.

D. Make sure the Default mode is set to build for Linux.

At this point both modes are going to build in Debug mode. To change this, go to Compiler Options|Debugging and uncheck "Generate info for the debugger" for each mode you don't want debugging enabled for. I'm not sure whether debugging even works under WINE, so I uncheck the Win64 mode.

Examine the Lazarus main menu and you will find under Run a "Compile many Modes" option. Use that to test the modes you added. (I note that the resulting dialog does not have the OK button selected by default, but rather the checkbox for the first build mode, so if you press Enter, you'll toggle its setting and then build...)

...

THE SYSTEM TRAY ICON ON LINUX: it is important to note that support for system tray icons is part of the X Windows specification, and has been for decades. If system tray icons are not supported properly on any given Linux distribution, that distribution is either incomplete or broken; if its brokenness or incompleteness is based on use of incomplete or broken software like Wayland or GNOME, it is nonetheless incomplete or broken. If in order to use a system tray icon on Linux it is necessary to build only for Windows and run the program under WINE, then it is necessary to build only for Windows and run the program under WINE.