[Lazarus] How to change default editor font *before* primary config ~/.lazarus is created?

Bernd prof7bit at gmail.com
Tue Oct 16 12:39:10 CEST 2012

2012/10/16 Mattias Gaertner <nc-gaertnma at netcologne.de>:
> Are you reinventing the wheel or do you use the deb scripts that are used for sf
> packages?

I studied these scripts for some inspiration but I cannot use them as
they are for the ubuntu build servers. They are constructing a package
from the outside (they are putting the files together and calling the
dpkg tools explicitly) but the way it should work is to have the
package build *itself* with its rules file. debuild will first look
for the debian folder, changelog, control and rules already in place
and then call the targets in debian/rules that will perform the build
and installation process.

Ideally (in a perfect world where make install does a correct and
complete intallation) the rues file (which itself is a makefile too)
would just look like this:

    make clean

    make bigide

    make install PREFIX=$(CURDIR)/debian/lazarus/usr

  dh $@

This (along with the metadata in the other debian files) would
normally be all that is needed to debianize any piece of software.
When uploaded to the build servers they will unzip, look for the
debian folder and call the targets in debian/rules.

currently my rules file looks like this (its still quite simple, 70%
of it are comments with my rants about shortcomings of make install):

#!/usr/bin/make -f

OPT="-g- -Xs"
ROOT = $(CURDIR)/debian/lazarus

	$(MAKE) -C $(ORIG) cleanbigide distclean
	find $(ORIG) -name "*.a" -exec rm {} \;
	$(RM) $(ORIG)/lazarus
	$(RM) $(ORIG)/startlazarus
	$(RM) $(ORIG)/lazbuild
	$(RM) -r /tmp/lazarus

	$(MAKE) -C $(ORIG) bigide OPT=$(OPT)

	# we do not need to install any of the compiled units because
	# they are never used, they would be a waste of disk space.
	# everything will be compiled on demand into ~/.lazarus/lib/
	find $(ORIG) -name "*.ppu" -exec rm {} \;
	find $(ORIG) -name "*.o" -exec rm {} \;
	find $(ORIG) -name "*.a" -exec rm {} \;
	# we cannot directly install into $(ROOT)/usr
	# because lazarus make install is broken (copy into itself)
	# so we install into a temp dir outside of this tree
	# please fix this in lazarus makefile
	$(MAKE) -C $(ORIG) install PREFIX=/tmp/lazarus/usr

	# because of the above now need to move it where it belongs
	mkdir -p $(ROOT)
	mv /tmp/lazarus/usr $(ROOT)/
	$(RM) -r /tmp/lazarus

	# install forgot to install desktop start menu item
	# please fix this in lazarus makefile
	mkdir -p $(ROOT)/usr/share/applications
	mkdir -p $(ROOT)/usr/share/pixmaps
	cp $(ORIG)/install/lazarus.desktop $(ROOT)/usr/share/applications/
	convert $(ORIG)/images/icons/aqua.ico[0] $(ROOT)/usr/share/pixmaps/lazarus.png

	# install forgot to install mime-types file and icons
	# please fix this in lazarus makefile
	mkdir -p $(ROOT)/usr/share/mime/packages
	mkdir -p $(ROOT)/usr/share/icons/hicolor/48x48/mimetypes
	cp $(ORIG)/install/lazarus-mime.xml $(ROOT)/usr/share/mime/packages/lazarus.xml
	cp debian_other/mime_icons/* $(ROOT)/usr/share/icons/hicolor/48x48/mimetypes/

	# install default config files
	# please fix this in lazarus makefile
	mkdir -p $(ROOT)/etc/lazarus
	cp debian_other/etc/* $(ROOT)/etc/lazarus/
	# remove all symlinks (entire /usr/bin), we let them create
	# automatically through the debian/links file
	$(RM) -r $(ROOT)/usr/bin
	# unneeded stuff left over in the install directory
	$(RM) -r $(ROOT)/usr/share/lazarus/install
	$(RM) -r $(ROOT)/usr/share/lazarus/debian
	$(RM) -r $(ROOT)/usr/share/lazarus/debian_other

	# the following is INCOMPLETE and its only a dirty workaround!
	# create most probably needed unit directories for rebuilding ide
	# the ide - when building itself - will try to mkdir -p them
	# which would fail because of permissions but it will never actually
	# write anything into them (it will use ~/.lazarus/units/ instead)
	# we are perfectly happy if these directories exist and are empty.
	# Launchpad has only two architectures and Lazarus only two stable
	# widgetsets for Linux, so I am creating only those directories.
	# please fix this in lazarus makefile
	mkdir -p $(ROOT)/usr/share/lazarus/units/i386-linux/gtk2
	mkdir -p $(ROOT)/usr/share/lazarus/units/i386-linux/qt
	mkdir -p $(ROOT)/usr/share/lazarus/units/i386-linux/nogui
	mkdir -p $(ROOT)/usr/share/lazarus/units/x86_64-linux/gtk2
	mkdir -p $(ROOT)/usr/share/lazarus/units/x86_64-linux/qt
	mkdir -p $(ROOT)/usr/share/lazarus/units/x86_64-linux/nogui

	# probably a lot more stuff needs to be fixed,
	# must care about it when I have more time...

	dh_builddeb -- -Zxz -z7

	dh $@

The main difference to other installers is that it will not install
the compiled units at all, it will install only source code into
/usr/share/lazarus, compiled units are not installed because they are
automatically compiled on demand when the user compiles the first

This also brings us in perfect compliance with debian policy because
/usr/share now only contains platform independent source code (I will
also further modify it to install binaries directly into /usr/bin, no
symlinks, not having any binary file in /usr/share/ at all and also no
need for /usr/lib/.

The package could further be split into two:

* lazbuild binary and all source code (no dependencies on anything
other than fpc)
* lazarus-ide (only the binary, dependency on gtk2)


> The /etc/lazarus/editoroptions.xml is only copied if there is no
> ~/.lazarus/editoroptions.xml.

Yes it is copied, one can see this when halting execution in the
constructor of TEditorOptions but when continuing to run some
milliseconds later it is overwritten with an almost empty default
file. Tested with 1.0.2 and 1.0.3 from yesterday. Either something
else is accessing this file bypassing TEditorOptions or something even
more obscure is going on inside TEditorOptions itself. See my bug

More information about the Lazarus mailing list