Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazarus #1159

Open
benjamimgois opened this issue Nov 26, 2024 · 19 comments
Open

Lazarus #1159

benjamimgois opened this issue Nov 26, 2024 · 19 comments

Comments

@benjamimgois
Copy link

  1. lazarus
  2. https://gitlab.com/freepascal.org/lazarus/lazarus
  3. https://sourceforge.net/projects/lazarus/files/Lazarus%20Linux%20amd64%20DEB/Lazarus%203.6/
  4. Lazarus is a Delphi compatible cross-platform IDE for Rapid Application Development.
  5. URL to the application icon
    lazarus
  6. the .desktop*
    [Desktop Entry]
    Name=Lazarus
    Comment=Lazarus IDE
    Exec=startlazarus %f
    Terminal=false
    Type=Application
    Icon=lazarus
    Categories=IDE;Development;GTK;GUIDesigner;
    StartupWMClass=Lazarus
    MimeType=text/x-pascal;text/lazarus-project-source;text/lazarus-project-information;text/lazarus-form;text/lazarus-resource;text/lazarus-package;text/lazarus-package-link;text/lazarus-code-inlay;
    Keywords=editor;Pascal;IDE;FreePascal;fpc;Design;Designer;
@Samueru-sama
Copy link
Contributor

Hey, it's my man from goverlay 👀 Glad to see you are using AM.

Note: If you need help with the goverlay appimage just let me know.

Sorry for the off topic comments btw.

@ivan-hc
Copy link
Owner

ivan-hc commented Nov 26, 2024

hi @benjamimgois , sorry if I ask... I only see .deb packages, while the .zip in that page is for Mac OS x86_64 (darwin). Its there no portable version of Lazarus for Linux? Is the app inside the .deb package portable as well and without dependences if I extract it (I have just one like this in AM, windows95)?

@benjamimgois
Copy link
Author

Hey, it's my man from goverlay 👀 Glad to see you are using AM.

Note: If you need help with the goverlay appimage just let me know.

Sorry for the off topic comments btw.

Hi @Samueru-sama , yeah i'm making some tests with "am" on Kinoite and it's working pretty nice ! This project is really cool ! I still couldn't solve the issue with qt6pas on goverlay appimage, but will give it a new try soon. Thanks for the reception man !

@benjamimgois
Copy link
Author

hi @benjamimgois , sorry if I ask... I only see .deb packages, while the .zip in that page is for Mac OS x86_64 (darwin). Its there no portable version of Lazarus for Linux? Is the app inside the .deb package portable as well and without dependences if I extract it (I have just one like this in AM, windows95)?

Hi @ivan-hc , there's a .tar.gz package for it here. Sorry, my mistake.

https://sourceforge.net/projects/lazarus/files/Lazarus%20Zip%20_%20GZip/Lazarus%203.6/

Lazarus is a aplication that really need some portable way of using it. Since the developpers have no interest in flatpak, i thought that maybe "am" could be as solution. I'm still very noob in making appimages if there's any other needed info.

@Samueru-sama
Copy link
Contributor

Samueru-sama commented Nov 26, 2024

Lazarus is a aplication that really need some portable way of using it. Since the developpers have no interest in flatpak, i thought that maybe "am" could be as solution. I'm still very noob in making appimages if there's any other needed info.

If it is an IDE that depends on GTK2 it should be easy to make an AppImage of.

The only issue is that I normally set a ton of env variables when making appimages, which isn't ideal for an IDE because they would carry to the IDE as well and what gets run by it.

If you want an AppImage just let me know, I maintain this repo of truly portable appimages or the tar.gz is good enough?

@ivan-hc
Copy link
Owner

ivan-hc commented Nov 26, 2024

After found the command to detect the URL...

version=$(curl -Ls "https://sourceforge.net/projects/lazarus/files/Lazarus%20Zip%20_%20GZip/$(curl -Ls "https://sourceforge.net/projects/lazarus/files/Lazarus%20Zip%20_%20GZip/" | tr '"></ ' '\n' | grep "^Lazarus.*[0-9]$" | grep -v RC | head -1)" | tr '"></ ' '\n' | grep tar.gz | head -1)
wget "https://sourceforge.net/projects/lazarus/files/Lazarus%20Zip%20_%20GZip/$(curl -Ls "https://sourceforge.net/projects/lazarus/files/Lazarus%20Zip%20_%20GZip/" | tr '"></ ' '\n' | grep "^Lazarus.*[0-9]$" | grep -v RC | head -1)/$version/download" -O Lazarus.tar.gz || exit 1

...and after I tested the script... just realized that the tar.gz archive have no binary or script... and it is just an archive containing the sources to be compiled. Dammit.

@ivan-hc
Copy link
Owner

ivan-hc commented Nov 26, 2024

@Samueru-sama I have seen that Lazarus is in the "extra" repo on Arch Linux... are you able to test if it is possible to use it as a base for an AppImage?

EDIT: maybe using the Conty method?

@Samueru-sama
Copy link
Contributor

@Samueru-sama I have seen that Lazarus is in the "extra" repo on Arch Linux... are you able to test if it is possible to use it as a base for an AppImage?

EDIT: maybe using the Conty method?

sure thing, tomorrow I should have something ready.

@benjamimgois
Copy link
Author

Hey guys, thanks for the help. I'm sure the lazarus community will love to have it in appimage format if possible.

@Samueru-sama
Copy link
Contributor

Samueru-sama commented Nov 27, 2024

The lazarus package is 1.8 GiB? https://archlinux.org/packages/extra/x86_64/lazarus/ I also needed to install lazarus-gtk3 to have a .desktop entry to launch.

when I launch the app this is all I get:

image

The gtk2 version ""works"" but wtf is going on haha:

untitled.mp4

@benjamimgois
Copy link
Author

The lazarus package is 1.8 GiB? https://archlinux.org/packages/extra/x86_64/lazarus/ I also needed to install lazarus-gtk3 to have a .desktop entry to launch.

The 'lazarus-qt6' is a much better supported toolkit (that's one of the reasons i switched goverlay to qt). If possible, that would be a preferable version

@ivan-hc
Copy link
Owner

ivan-hc commented Nov 27, 2024

The lazarus package is 1.8 GiB?

ok I think, once compressed into an AppImage it should be even smaller... much much smaller

@Samueru-sama
Copy link
Contributor

Okay will give another shot with the qt6 version, hopefully lazarus has means to relocate the /usr/lib/lazarus directory via an env variable.

@Samueru-sama
Copy link
Contributor

Alright I have good and bad news.

The good news is that an appimage is very likely possible.

The bad news is that it seems lazarus only works with full paths to find stuff lie its own /usr/lib/lazarus directory, so every time I launch the appimage I have to do stuff like manually type the path to the lazarus dir:

image

The appimage is a squashfs image that gets mounted with a random name on ${TMPDRI:-/tmp} so the ideal solution is for lazarus to provide an env variable like LAZARUS_DIR that I can set in the AppRun and that way everything goes smoothly.

The other method is preloading some library that overwrites /usr/lib/lazarus like this one, but I'm not sure it is a good idea to preload libraries on an IDE hehe.

And this issue also happens to some other stuff, for example this:

image

lazarus can find the fpc binary because I symlinked it to the ,/bin dir of the AppImage, which gets added to PATH by sharun, but it complains that there is no fpc.cfg, this is because that file is located on /etc and once again this would need an env variable to fix.

same with FPC Sources I had to type the path manually:

image

WIth that said it seems lazarus tries to find its directory in the location where the binary is locared, because by default the search path is the bin directory where the binaries are located, so I don't know if it needs to have a specific name for it to be found.

WIll continue later, but if lazarus provides means to have portable installation that doesn't rely on full paths this should be easy, the thing is that I can't find such info.


If all of this fails then the next step would be using something like conty and spin a container, the appimage when made with dwarfs goes down to just 218 MiB, which is a 10x reduction of the original size and launches very quickly as well.

@benjamimgois
Copy link
Author

I ask for help in the lazarus gitlab and link this thread. Maybe some developer might be able to help.

https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/41262

@User4martin
Copy link

Maybe you should start the IDE with --pcp= to set the primary config path. That is where the config will be saved. By default that is ~/.lazarus

You can set that option inside a file called lazarus.cfg next to the lazarus executable.

I am not sure / needs to be tested: If that can be given relative to the current dir, or the lazarus executable dir.

The config can contain values for most of the directories. And they can be set using "ide macros" like $(LazarusDir)

You can also have templates for the config files (at least environmentoptions.xml, maybe others in the same directory as the lazarus executable. They will be used if no config exists yet. They will then be saved in the primary config path.
=> once you did the configuration, copy the environmentoptions.xml (and strip it down if needed)

A full list of IDE macros can be seen under menu: View > Ide internals > About IDE => then the tab IDE macros.

@Samueru-sama
Copy link
Contributor

Maybe you should start the IDE with --pcp= to set the primary config path. That is where the config will be saved. By default that is ~/.lazarus

Aren't those files user configurable and normally get written during the operation of the application? if that's the case then it would not work, the appimage is read only.

I am not sure / needs to be tested: If that can be given relative to the current dir, or the lazarus executable dir.

The config can contain values for most of the directories. And they can be set using "ide macros" like $(LazarusDir)

You can also have templates for the config files (at least environmentoptions.xml, maybe others in the same directory as the >lazarus executable. They will be used if no config exists yet. They will then be saved in the primary config path.
=> once you did the configuration, copy the environmentoptions.xml (and strip it down if needed)

A full list of IDE macros can be seen under menu: View > Ide internals > About IDE => then the tab IDE macros.

Looks like namespaces it is, but I will give it another shot and share the result tomorrow.

@User4martin
Copy link

I'm writing most of this from memory. And with a Windows background, but it should work the same on Linux (mostly).

Aren't those files user configurable and normally get written during the operation of the application?

In the "primary config path" (e.g. ~/.lazarus or in the %APPDATA% on windows) => yes, Lazarus will write to them.

In the install folder (where the lazarus executable is) can be templates. They will be copied once, if there is no pre existing config yet. They are only used as template.


About specifying a different config folder with --pcp=

You don't need to do that, but if the user had an old install, the folder has the old paths.

However, if indeed all pathes that are relative to the "install dir" are using $(LazarusDir) then they will all be correct. (There will still be a prompt that something changed if the install dir was changed.


Then of course the FPC dir, if not a default install must be found too. That depends on how FPC was installed.


If the install folder is write protected, the Lazarus must be started with startlazarus (and if you have a --pcp= then that must be given to startlazarus too, so better put it into lazarus.cfg if indeed you need it).

The reason is, that when the user installs a package, the IDE needs to be recompiled. The new lazarus executable can not be written to the write protected folder, so it is written to the config directory (somewhere within, I don't recall). startlazarus will check for that and start the updated IDE.

@Samueru-sama
Copy link
Contributor

Alright this is what I got so far: https://mega.nz/file/ZRQnjDwA#k2s0tayRQYbrRGUH3n4RcONmJz80l4UlML-ibYybIfk

You can pass the flag --appimage-extract to inspect the contents and see if anything can be fixed on the existing appimage.

The appimage bundles everything and even starts on alpine linux (no glibc) but of couse I need to set the path to some files manually each time I start it.

Here is the build script:
lazarus-qt6-appimage.sh.txt

There is no AppRun script as sharun is doing that automatically, if extra env variables need to be set those can be passed by creating a .env file next to AppRun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants