Recent

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

circular

  • Hero Member
  • *****
  • Posts: 4196
    • 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: 2786
    • 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 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

circular

  • Hero Member
  • *****
  • Posts: 4196
    • 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: 831
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

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • 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 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

circular

  • Hero Member
  • *****
  • Posts: 4196
    • 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

  • Hero Member
  • *****
  • Posts: 623
  • Ecology is everything.
    • GitHub
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
Delphi 7.0 Personal Edition
Lazarus 2.0.12 - FPC 3.2.0 on GNU/Linux Mint 19.1, Lubuntu 18.04, Windows XP SP3, Windows 7 Professional, Windows 10 Home

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • 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 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

circular

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

maurobio

  • Hero Member
  • *****
  • Posts: 623
  • Ecology is everything.
    • GitHub
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
Delphi 7.0 Personal Edition
Lazarus 2.0.12 - FPC 3.2.0 on GNU/Linux Mint 19.1, Lubuntu 18.04, Windows XP SP3, Windows 7 Professional, Windows 10 Home

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • 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 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: Creating .deb packages for Lazarus applications?
« Reply #26 on: November 01, 2020, 04:04:20 pm »
Here is a guide on how to make an upstream source for Debian:
https://wiki.freepascal.org/Debian_upstream

In principle, it is possible just to supply the source with the Makefile and request that someone would make the packaging for Debian distributions.
Conscience is the debugger of the mind

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Creating .deb packages for Lazarus applications?
« Reply #27 on: November 02, 2020, 07:47:44 am »
Here is a guide on how to make an upstream source for Debian:
https://wiki.freepascal.org/Debian_upstream
Really useful pair of pages Circular, I inteneded to do something similar for some time but, well, you know ! I have added a small section to Debian Package Structure to define the difference between Source and Binary packages. Hope you don't mind.

In principle, it is possible just to supply the source with the Makefile and request that someone would make the packaging for Debian distributions.

Indeed. But as there are far to many people wanting packages added and far too few people willing to do the packaging, I would suggest that what you say is true in principle but not practice.

As someone who has been negotiating with the Debian people for some months now, my advice is firstly, the copyright file is absolutely critical. Makes sure every scrap of your code is your own or carefully attributed to someone else who has stamped it with an acceptable license.  Its no use saying "'someone' posted a bit of code on the forum and they said I could use it".

Secondly, be prepared for some pushback about the way we do things here in the FreePascal world, what we consider perfectly sensible is not the way a C programmer does it and it makes them feel uncomfortable. While they are all very helpful, they have rules and processes that are not the way we think.

But keep at it ! The more FreePascal code in the Debian archives, the more they will take us seriously.

Davo

Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

circular

  • Hero Member
  • *****
  • Posts: 4196
    • Personal webpage
Re: Creating .deb packages for Lazarus applications?
« Reply #28 on: November 02, 2020, 03:53:56 pm »
Thanks for your input.

I have moved some of your text, because I have already created a Debian package source:
article:
https://wiki.freepascal.org/Debian_package_source

I have added that in practice one has to do its own source package.

What remains to write I suppose is how to use debuild or pbuilder with it.
« Last Edit: November 02, 2020, 04:11:46 pm by circular »
Conscience is the debugger of the mind

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Creating .deb packages for Lazarus applications?
« Reply #29 on: November 02, 2020, 11:24:39 pm »
I use debuild, with that I can make a src package acceptable to Ubuntu in a PPA, https://launchpad.net/~d-bannon/+archive/ubuntu/ppa-tomboy-ng

 I am working on the legal aspects of Debian, if we can get over that, I hope to use the same model to make Debian SRC packages although I have seen hints they they might prefer pbuilder.

At present my model is that I have a script (prepare.bash) that takes a zip file downloaded from GitHub containg all my source and it builds the directory structure of a debian src package.   Inside that scr package the make file does much of the usual build and install things but to actually compile the Pascal source, it calls another script (buildit.bash) that uses both lazbuild (to build a dependency) and fpc to build the actual app.

Not a simple process !

The  Debian process is quite well documented in very many pages on the Debian website, I suggest that not be duplicated on our wiki. But how that official process needs to be fiddled to work with FPC/Lazarus would be useful indeed. Its a steep learning curve.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018