Recent

Author Topic: How to edit the LCL package?  (Read 772 times)

richie765

  • Newbie
  • Posts: 5
How to edit the LCL package?
« on: November 15, 2023, 06:54:59 am »
Hi there,

I'm tryng to fix a bug in the LCL package. I've narrowed down the problem to the file carbon/customdrawnwinapi_cocoa.inc. I'm pretty new to packages and how they work, so please forgive my ignorance. :) I'm trying to edit this file but it opens as read-only from the package viewer.

Can someone please give me a quick summary of how to edit and compile the package so I can test and debug my fix?

BTW I searched with Google but I didn't find what I needed.

Thanks!!
« Last Edit: November 15, 2023, 07:00:32 am by richie765 »

cdbc

  • Hero Member
  • *****
  • Posts: 1069
    • http://www.cdbc.dk
Re: How to edit the LCL package?
« Reply #1 on: November 15, 2023, 07:32:29 am »
Hi
On my Linux-lappy, the lcl-units are located in a ReadOnly section /owned/ by 'root'. Maybe it's like that on your mac...?
Fwiw, @dbannon found a way to circumvent this, by locating the lcl-dir and 'chown' the owner to /you/, then compile and 'chown' back to root... that works, but be careful, when fiddling with the lcl... %)
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

TRon

  • Hero Member
  • *****
  • Posts: 2487
Re: How to edit the LCL package?
« Reply #2 on: November 15, 2023, 07:44:01 am »
As cdbc mentioned using a 'normal' installation of Lazarus (meaning by means of a package manager or some other form of pre-configured package) usually let the original Lazarus source-code end up in restricted directories.

If you want to fiddle with Lazarus' source-code then it is advisable to make a (free from any restriction) standalone installation, preferably created manually by compiling the sources.

This wiki page is a generic page on how to install Lazarus and if clicked f.e. on the Linux link, it'll end up here, which list instructions for building Lazarus from source (that are specific to Linux but there is much similarity regarding the described step/instructions to be able to almost do the same for/on other platforms. Some of the details, prerequisites, and some other platform specifics differ).

Once you have a standalone installation (don't forget to use the --pcp option with its separated configuration directory in case you have also other Lazarus installation(s)) you can edit the files that you wish to 'fix', and then you should be able to do a rebuild of Lazarus from within Lazarus itself or do a manual build (again) using make.

Be careful though, if you 'fixed' your issue wrongly you could end up with breaking your custom standalone installation, requiring you to take the described steps again. So make sure to backup the files that you modified to that you can easily restore things to a previous state.
« Last Edit: November 15, 2023, 07:51:04 am by TRon »

richie765

  • Newbie
  • Posts: 5
Re: How to edit the LCL package?
« Reply #3 on: November 15, 2023, 09:18:16 am »
Thanks for the fast response!  :D I see on my mac the files are created as 503:admin (503 user does not even exist). I'll try to change the user and see what happens. It's definitely interesting to recompile Lazarus as there are a few more things I'd like to change.

wp

  • Hero Member
  • *****
  • Posts: 11902
Re: How to edit the LCL package?
« Reply #4 on: November 15, 2023, 09:32:19 am »
I only rarely work under Linux, and, if I do, always with installations in the home directory. But for me the trick to debug the LCL or third-party libraries is to add a "-gw3" (without quotes) as a "Custom option" to "Additions and overrides" in the project options. This forces the IDE to rebuild all needed units with Dwarf 3 debug information.

cdbc

  • Hero Member
  • *****
  • Posts: 1069
    • http://www.cdbc.dk
Re: How to edit the LCL package?
« Reply #5 on: November 15, 2023, 11:54:39 am »
Hi
@wp: Good advice, but the problem in situ, is that the units to be compiled are readonly ...and owned by root/admin503
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

 

TinyPortal © 2005-2018