Recent

Author Topic: Creating .deb packages for Lazarus applications?  (Read 15718 times)

circular

  • Hero Member
  • *****
  • Posts: 3329
    • Personal webpage
Re: Creating .deb packages for Lazarus applications?
« Reply #15 on: May 20, 2020, 12:07:46 pm »
You're welcome.  :)

As I have spent sometime struggling with those, I would prefer others not to have to go through that.
Conscience is the debugger of the mind

dbannon

  • Hero Member
  • *****
  • Posts: 1070
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Creating .deb packages for Lazarus applications?
« Reply #16 on: May 20, 2020, 02:43:36 pm »
You might like to look through this script, its very specific for my project, I build 32bit and 64bit linux and windows binaries and then make debs (and a few other packages as well).

https://github.com/tomboy-notes/tomboy-ng/blob/master/package/package.bash

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

circular

  • Hero Member
  • *****
  • Posts: 3329
    • Personal webpage
Re: Creating .deb packages for Lazarus applications?
« Reply #17 on: May 20, 2020, 09:36:42 pm »
Interesting.

I learnt about the icon folders  :)
/usr/share/icons/hicolor/*/apps

If I understand correctly you add the files:
/usr/share/locale/*/LC_MESSAGES/lclstrconsts.mo
Wouldn't that may cause an interference with another program doing the same? When removing the other program, wouldn't that remove this file as well?

The Installed-Size seems to be fixed to 4096. Instead, you could compute it when all files are ready to be archived:
Code: [Select]
SIZE_IN_KB="$(du -s ${STAGING_DIR} | awk '{print $1;}')"
echo "Installed-Size: ${SIZE_IN_KB}" >> "${STAGING_DIR}/DEBIAN/control"
Conscience is the debugger of the mind

Gizmo

  • Hero Member
  • *****
  • Posts: 701
Re: Creating .deb packages for Lazarus applications?
« Reply #18 on: May 20, 2020, 11:00:56 pm »
Also this (it used to deb package one of my tools)

https://github.com/darealshinji/debian-packaging
Lazarus 2.0.4 and fpc 3.0.4 - Linux Mint 19 LTS, Windows 10 64 and Mac OSX Catlina
Useful Page to remember : http://wiki.freepascal.org/Cross_compiling#From_Linux_x64_to_Linux_i386

dbannon

  • Hero Member
  • *****
  • Posts: 1070
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Creating .deb packages for Lazarus applications?
« Reply #19 on: May 21, 2020, 01:39:38 am »
If I understand correctly you add the files:
/usr/share/locale/*/LC_MESSAGES/lclstrconsts.mo
Wouldn't that may cause an interference with another program doing the same? When removing the other program, wouldn't that remove this file as well?
Possibly, but the lclstrconsts.mo does not change with your application, its the same file for every application you make on one version of Lazarus, it may change in small ways between versions. I have not yet come across an end user with more than one Lazarus app installed - thats sad !
The Installed-Size seems to be fixed to 4096. Instead, you could compute it when all files are ready to be archived:
Code: [Select]
SIZE_IN_KB="$(du -s ${STAGING_DIR} | awk '{print $1;}')"
echo "Installed-Size: ${SIZE_IN_KB}" >> "${STAGING_DIR}/DEBIAN/control"
Indeed you are right. I put 4096 in because, when I started, my app was less than this, it has grown since then so its certainly wrong now !

Good hint !

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

circular

  • Hero Member
  • *****
  • Posts: 3329
    • Personal webpage
Re: Creating .deb packages for Lazarus applications?
« Reply #20 on: May 21, 2020, 10:23:42 am »
Indeed there are not many installed Lazarus applications. To be fair, just making the Deb is a challenge.

You're welcome for the tip. Long live to peer review.
Conscience is the debugger of the mind

maurobio

  • Full Member
  • ***
  • Posts: 142
Re: Creating .deb packages for Lazarus applications?
« Reply #21 on: May 27, 2020, 09:54:33 pm »
Dear ALL,

I have been struggling with this for months now (https://forum.lazarus.freepascal.org/index.php?topic=48398.new;topicseen), without much progress so far.

But this does not lead me to conclude that there is no way to achieve the goal of creating a fully working Debian package for a Lazarus application which can be installed in any Linux distribution (or at least on those based on the Debian system). There are indeed some excellent programs written in Lazarus (all of which I heavily use under both Linux and Windows) that are distributed in binary form as Debian packages, for example:

SkyChart: https://www.ap-i.net/skychart//pt/start
DoubleCommander: https://doublecmd.sourceforge.io
GreenFish Icon Editor: http://greenfishsoftware.org/gfie.php

It seems that at the heart of the matter is the question of finding all the correct dependencies of the binary, but unfortunately the output of either ldd or elf is not entirely helpful because is not obvious how to relate the names of the .so libraries to the real names of the packages which should be provided when creating the package. So, for example, this wiki page (https://wiki.freepascal.org/Deploying_Your_Application#Linux_Deployment) lists the "packages required for an very basic GUI Application in GTK+", but does not explain how to correlate those names with the names listed in the ldd output.

Once the dependencies are correctly found, a nice program like Debreate (https://antumdeluge.github.io/debreate-web/) could be used to create a Debian package under Linux as easily as Inno Setup (http://www.jrsoftware.org/isinfo.php) is used to create binary installation packages for Windows.

As has already been mentioned, LazPackager (https://github.com/prof7bit/LazPackager) can offer a good alternative for creating Debian packages for Lazarus applications - but do someone here has any experience using it? I have not been able to even install it, because it is a "Lazarus plugin (a package that you can install in your IDE)" and I could not found how to install such plugins (which do not seem to be installed in the same way as usual LCL packages).

Comments and suggestions are welcome!

With best wishes,
UCSD Pascal / Burroughs 6700 / Master Control Program
Lazarus 1.9.3/2.0.4 - FPC 3.0.4 on GNU/Linux Mint 19 ("Tessa"), Windows XP SP3, Windows 7 Professional, Windows 10 Home

dbannon

  • Hero Member
  • *****
  • Posts: 1070
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Creating .deb packages for Lazarus applications?
« Reply #22 on: May 28, 2020, 02:44:25 am »
Maurobio, I release a new version of tomboy-ng every one to two months. Each release builds a 32bit and 64bit deb file and I subsequently make rpm files from them.  Once setup, its trivial. Scripts in my git repo.

Getting dependencies right is certainly necessary but not really that hard, you definitely need either the GTK2 or Qt5 libraries but there is a 'catch all' for both. Almost always works.  (I say 'almost' because in Ubuntu19.04 there was, apparently ?? a module left out that was necessary for a GTK2 app to communicate via the dbus approach that GtK3 likes  :( )

* QT5 - libqt5pas1, libc6 (>= 2.14), wmctrl
* Gtk2 - libgtk2.0-0 (>= 2.6), libc6 (>= 2.14), libcanberra-gtk-module, wmctrl

Note I add in wmctrl because I use it to bring forms to the active workspace and, with Gtk2, I include libcanberra-gtk-module because having it there suppresses otherwise harmless Gtk assertions. And, lib6 is pretty obvious.

If your app uses other, specialized libraries, I guess you would be aware of them when using them so should be easy to add them to the list.  If you are still missing libraries, and that would be surprising, run your binary on a newly installed VM and note the error messages !

Davo

Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

circular

  • Hero Member
  • *****
  • Posts: 3329
    • Personal webpage
Conscience is the debugger of the mind

maurobio

  • Full Member
  • ***
  • Posts: 142
Re: Creating .deb packages for Lazarus applications?
« Reply #24 on: May 28, 2020, 01:11:28 pm »
Hi, @dbannon, @circular!

Thanks for your suggestions.

I had already found @dbannon script, but I still prefer a more user-friendly tool like Debreate (in which case my real need is getting the correct list of dependencies).

The method provided by @circular for finding the dependencies is new to me (it looks like everyone just keep suggesting the use of either ldd or elf, which are not that helpful). I'll try it!

With best wishes,
UCSD Pascal / Burroughs 6700 / Master Control Program
Lazarus 1.9.3/2.0.4 - FPC 3.0.4 on GNU/Linux Mint 19 ("Tessa"), Windows XP SP3, Windows 7 Professional, Windows 10 Home

dbannon

  • Hero Member
  • *****
  • Posts: 1070
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Creating .deb packages for Lazarus applications?
« Reply #25 on: May 28, 2020, 01:52:15 pm »
.....
The method provided by @circular for finding the dependencies is new to me (it looks like everyone just keep suggesting the use of either ldd or elf, which are not that helpful). I'll try it!

And the method described by circular is the official debian model, and a good one. But you must keep in mind that, for example, when it recommends we need -
Code: [Select]
shlibs:Depends=libatk1.0-0 (>= 1.12.4), libc6 (>= 2.2.5), libcairo2 (>= 1.2.4), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.12.0), libgtk2.0-0 (>= 2.24.0), libpango-1.0-0 (>= 1.18.0), libx11-6
all the packages listed (except libgtk2.0-0) are, themselves dependencies of libgtk2.0-0.  And, given that gtk2 is pretty stable and has been so for some years, the version is quite unlikely to be an issue.  That rosie picture does not apply to Qt5, most, but not all systems around now have a suitable version of Qt5. See https://github.com/davidbannon/libqt5pas

Davo

Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

 

TinyPortal © 2005-2018