View Single Post
Posts: 839 | Thanked: 3,386 times | Joined on Mar 2009
#1
Free Pascal Compiler [1] version 2.4.4 [2] is now on extras-devel [3]. It contains packages:
Code:
fpc-2.4.4           - Free Pascal - SDK-2.4.4 metapackage
fp-compiler-2.4.4   - Free Pascal - Compiler
fp-units-rtl-2.4.4  - Free Pascal - Runtime Library
fp-units-2.4.4      - Free Pascal - base units
fp-utils-2.4.4      - Free Pascal - Utils
Compiler and units-rtl are needed for compiling. Units contains big set of units/packages [4] packed in one debian-package, you need it if you want do 'anything non-trivial'.

Packages are optified, if you are interested in to compile Pascal on N900-device. You need binutils installed, because it needs additionally 'as' and 'ld' [5].

--------
Usage: hello
#install (to scratchbox)
Code:
apt-get install fp-compiler-2.4.4
make file
Code:
program Hello;
  begin
  writeln ('Hello, world.')
end.
Compile it with
Code:
fpc hello.pas
(With sb2, use sb2 -e fpc hello.pas)

Copy to device and run, no additional dependencies on phone (I don't know why "rtl"="runtime library", because it is not needed on phone).

--------
Usage2: gles-2.0 test
#Install also units (~70M unpacked)
Code:
apt-get install fp-units-2.4.4
wget http://cc.oulu.fi/~rantalai/gles20demo.pp
fpc gles20demo.pp
--------
Some technical
All maemo specific is on own git [6].

As you might know the FPC compiler is written in Pascal, so getting it on Maemo repository [7] needed some tricks. There were several approaches:
* Crosscompile it. E.g. i386 fpc can produce arm-binaries. This is kinda tricky with autobuilder.
* Use older version of FPC
-Make binary-only-package (on non-free-repository) which contains fpc-binary.
-Bundle old fpc-binary with sources.

I used last option (you can try another ones). This is not big deal, because it is used only for first round of compiling, then it is compiled second time with new compiler. So at the end, resulting binary (fpc-2.4.4) is always compiled with fpc-2.4.4. Drawback is, that package can only be used with arm, i386 and x64 (it contains those pre-compiled binaries).



[1] http://www.freepascal.org/
[2] From May 22th, 2011
[3] http://maemo.org/packages/view/fpc-2.4.4/
[4] http://wiki.freepascal.org/Unit
[5] http://www.freepascal.org/faq.var#unix-asldmissing
[6] https://gitorious.org/maemo-fpc
[7] I found several talks and posts: fpc is used for long time on Maemo.
 

The Following 23 Users Say Thank You to AapoRantalainen For This Useful Post: