All these instructions are described from the view on a Debian-based Linux system.
- Get the lastest binutils sources, and build these with:
- Put a repository, which contains a current FreePascal build, for your Debian-based Distribution in your /etc/apt/sources.list
- Run: "apt-get install fpc subversion" (Subversion to checkout the FPC svn)
- Go in the directory, where you want to checkout the FPC sources from the FPC svn
- Run: "svn co http://svn.freepascal.org/svn/fpc/trunk fpc"
- Create a directory for the .so Libs from your N900 device, and copy these from your N900 into this directory incl. symlinks as full "non-symlink!!!" copies
- Create script "doit" in the from N900 "copied" lib directory with follow content:
#!/bin/bash
for FILE in *.so* ; do
if [ -L "$FILE" ] ; then
rm -f $FILE
fi
done
for FILE in *.so* ; do
G=`echo "${FILE}" | grep ".so."`
if [ -n "${G}" ] ; then
A="${FILE%.so*}.so"
if [ "${A}" != "{$FILE}" ] ; then
if [ "${A}" != "{$FILE}.so" ] ; then
ln -s $FILE $A
fi
fi
fi
G=`echo "${FILE}" | grep "-"`
if [ -n "${G}" ] ; then
A="${FILE%-*}.so"
if [ "${A}" != "{$FILE}" ] ; then
if [ "${A}" != "{$FILE}.so" ] ; then
ln -s $FILE $A
fi
fi
fi
done
ln -s ld.so ld-linux.so.2 >/dev/null
- Chmod 0755 the script and execute it in a terminal
- Add follow text to /etc/fpc.cfg:
#IFDEF CPUARM
-Fu/usr/lib/fpc/2.5.1/units/$fpctarget/*
-Fl/usr/lib/fpc/2.5.1/units/$fpctarget/rtl/
-a
-Sd
-Xd
-Xs
-O-
-CpARMV6
-CfVFPV3
-XP/opt/armbinutils/
-Xr/usr/lib/fpc/2.5.1/units/arm-linux/rtl/
-Xr/YOURDIRECTORYWITHTHEN900LIBS
-XR/YOURDIRECTORYWITHTHEN900LIBS
-darm
-Tlinux
#ENDIF
- Create a bash script file "doit" with follow context in the FPC trunk directory:
#!/bin/sh
sudo make clean
sudo make crossinstall CPU_TARGET=arm OS_TARGET=linux CROSSBINDIR=/opt/armbinutils OPT=-dFPC_ARMEL INSTALL_PREFIX=/usr CROSSOPT="-CpARMV6 -CfVFPV3"
- Set chmod 0755 for this script file and execute it in a terminal and wait :-)
Now use per project follow make script code:
#!/bin/sh
cp -s /YOURDIRECTORYWITHTHEN900LIBS/*.so* .
ppcarm -s -a -CpARMV6 -CfVFPV3 -Sd -B -dSDL -Xd -Xs -darm -Tlinux -TParm -O3 \
-XP/opt/armbinutils/ -Xr/usr/lib/fpc/2.5.1/units/arm-linux/rtl/ -Xr/YOURDIRECTORYWITHTHEN900LIBS \
-XR/YOURDIRECTORYWITHTHEN900LIBS -Fl/YOURDIRECTORYWITHTHEN900LIBS yourmainsourcefile.pas
./ppas.sh
rm -f ppas.sh
rm -f *.so*
The cp of the all N900 libs to the current project directory is a temp. workaround hack in the moment to force that the linker ld finds always the "right" .so files from our N900, until LD interprets the -rpath parameter correctly.
Have fun with it! :-)