Done!
It wasn't easy, so I'm sharing here my experience
You can do everything in a remote session; on linux you can use
$ ssh -X <username>:<IP>
-- How to install Lazarus 1.0.10 (or newer) on a Raspberry Pi (Raspbian) --
First, get a sudo shell
$ sudo -s
If you want to install the latest version and you have already installed another version, you have to remove it
If not, skip this step
WARNING: THIS WILL NUKE ALSO EVERY CONFIGURATION RELATED TO THESE PACKAGES! CHECK THAT ONLY UNNEEDED PACKAGES ARE GOING TO BE REMOVED
# apt-get purge lazarus-* fpc-* fp-compiler* fp-units-* fp-ide-* fp-utils-*
Now you need to add jessie's repo to sources.list
# echo 'deb
http://archive.raspbian.org/raspbian jessie main rpi' >> /etc/apt/sources.list
# echo 'deb-src
http://archive.raspbian.org/raspbian jessie main rpi' >> /etc/apt/sources.list
# apt-get update
And now you can install lazarus and fpc from jessie's repo (check that it's installing the right version, at the time of writing it is the 1.0.10)
This will likely update lots of packages, including libc; read carefully what you're updating!
# apt-get -t jessie install fpc lazarus
You haven't finished yet! The 1.0.10 package is broken, you have to fix it manually (change the path if your version isn't the 1.0.10)
Note: with the revision 44182 it works, if you want you can try newer revisions
# apt-get install subversion
# svn export
http://svn.freepascal.org/svn/lazarus/trunk/components/leakview/leakview.lpk --revision 44182
# mv leakview.lpk /usr/lib/lazarus/1.0.10/components/leakview/
# svn export
http://svn.freepascal.org/svn/lazarus/trunk/components/leakview/dbginforeader.pas --revision 44182
# mv dbginforeader.pas /usr/lib/lazarus/1.0.10/components/leakview/
Now Lazarus should work, but the IDE may complain about a broken ide/version.inc
In this case, just look at the title bar and edit /usr/lib/lazarus/1.0.10/ide/version.inc (I edited mine from '1.0.10+dfsg-1' to '1.0.10+dfsg-1+b1')
Restart Lazarus and everything should work!
-- How to install a package on a Raspberry Pi (Raspbian) --
Download the package, extract it and copy it in the components folder (/usr/lib/lazarus/1.0.10/components/)
Edit owner, group and permissions
$ sudo chown root /usr/lib/lazarus/1.0.10/components/<package>
$ sudo chgrp root /usr/lib/lazarus/1.0.10/components/<package>
$ sudo chmod +r /usr/lib/lazarus/1.0.10/components/<package>
$ sudo chmod +x /usr/lib/lazarus/1.0.10/components/<package>
The Raspberry Pi doesn't have enough memory to recompile the whole IDE, so you need to add a swap
Take an empty USB memory (at least 1GB) and insert it in the Raspberry Pi
$ df
Find which /dev it is (for me it was /dev/sda1)
WARNING: THIS WILL DELETE EVERY FILE ON YOUR USB MEMORY
$ sudo mkswap /dev/sda1
$ sudo swapon /dev/sda1
Now you have a good amount of swap memory; you can check it with
$ cat /proc/swaps
Now start the IDE with root permissions
$ gksudo lazarus-ide
Packages -> Install/Uninstall packages -> select your package on the right -> install selection -> Save and rebuild IDE
After a (long) wait your package will be compiled and installed!
-- Additional steps for LazSerial --
LazSerial's installation may fail with this error
/usr/lib/lazarus/1.0.10/components/LazSerial/synaser.pas(252,22) Error: Identifier not found "B500000"
If you don't need highest baudrates you can remove them: comment/remove these lines
,(500000, B500000),
(576000, B576000),
(921600, B921600),
(1000000, B1000000),
(1152000, B1152000),
(1500000, B1500000),
(2000000, B2000000),
(2500000, B2500000),
(3000000, B3000000),
(3500000, B3500000),
(4000000, B4000000)
and change this
MaxRates = 30; //UNIX
to this
MaxRates = 19; //UNIX
If you need them, I don't know...
Now the installation should work
Note that now you can use only baudrates up to 460800
I hope this can help someone!