Building for Debian

From Ultibo.org
Revision as of 01:00, 7 September 2016 by Ultibo (Talk | contribs)

Jump to: navigation, search

Introduction


Ultibo core is currently made available as a Windows installer download as well as various Windows tools, however there is nothing specific about the source code or modifications to Free Pascal that are dependent on Windows and some may choose to use it on other platforms such as Linux or Mac. While we are currently unable to provide prepackaged installations for Linux in the form of DEB or RPM files we have created a set of instructions for building the necessary items from source in order to provide similar functionality to the Windows platform.

Please note that because these instructions require you to build all of the components from source and possibly install additional packages onto your Linux installation you should be familiar with using the command line and confident with the tools available. These instructions are fully tested and proven to work, however we cannot provide support for individual cases if you experience issues in completing the steps below.

Prerequisites


The instructions below detail the process of building the modified Free Pascal compiler, the Free Pascal ARM cross compiler and the Ultibo RTL in order to create a working configuration that allows developing Ultibo applications.

This process was tested and developed using Debian Wheezy 7.6 for i386 with Linux kernel version 3.2.0 however the requirements for FreePascal are relatively simple so these instructions should work without much change on later versions of Debian (eg Jessie) and should also be able to be translated easily to many other distributions.

In order to avoid any conflict with official FPC releases these instructions install all components into a folder within your home directory, if you follow these instructions the Ultibo version of Free Pascal as well as the RTL and sources will be located in the $HOME/ultibo/core folder so if your username is john then the installation will be at /home/john/ultibo/core.

Compiling the Ultibo edition of Free Pascal requires using the official 3.0.0 release version as the starting point, these instructions will NOT work if you start with version 2.6.4 or any other version. Fortunately the FPC team provide a precompiled download of FPC 3.0.0 which can be obtained from the download page and installed using the provided instructions.

If you prefer not to install the official 3.0.0 release (you may have other projects that depend on an earlier version for example) then you can get a fully working installation of Free Pascal 3.0.0 by following the instructions at GetLazarus.org which will by default install a working copy in the folder $HOME/Development/FreePascal that can be deleted later if you choose.

Building Free Pascal (Ultibo Edition)


Assuming you have a working FPC 3.0.0 installation as discussed above, you can now proceed with the first stage of the process which is to build a Debian native version of the Ultibo edition of FPC.

These instructions assume that FPC 3.0.0 from the official download was installed to:

/usr/local/bin/fpc

If you are using the GetLazarus.org version instead then you will need to temporarily add it to the path so it is used in preference to any official version, by default you can do something like this to add the appropriate folder to the path temporarily:

export PATH=$HOME/Development/FreePascal/fpc/bin:$PATH


You should now download the sources of the FPC Ultibo edition from GitHub and unzip the contents to the folder:

$HOME/ultibo/core

After extracting the files rename the folder FPC-master to fpc so the contents of the zip will be in $HOME/ultibo/core/fpc


Now download the source of Ultibo core from GitHub and extract the ultibo folder to the location:

$HOME/ultibo/core/fpc/source/rtl

Once this is done, open a terminal window and change to the folder containing the Ultibo sources:

cd $HOME/ultibo/core/fpc/source

Do the following steps in order, checking that each was completed successfully before continuing:

make distclean
make all OS_TARGET=linux CPU_TARGET=i386
make install OS_TARGET=linux CPU_TARGET=i386 INSTALL_PREFIX=$HOME/ultibo/core/fpc

Once those steps have completed you should now have a Debian native version of the FPC Ultibo edition. Copy it to the bin directory as follows so we can find it later:

cp $HOME/ultibo/core/fpc/source/compiler/ppc386 $HOME/ultibo/core/fpc/bin/ppc386

Run the following to check that it shows as version 3.1.1 and lists ultibo under the supported targets.

$HOME/ultibo/core/fpc/bin/fpc -i 

Use fpcmkcfg to create our default configuration file like this:

$HOME/ultibo/core/fpc/bin/fpcmkcfg -d basepath=$HOME/ultibo/core/fpc/lib/fpc/3.1.1 -o $HOME/ultibo/core/fpc/bin/fpc.cfg

Installing the arm-none-eabi Toolchain



Building the FPC Cross Compiler



Building the Ultibo RTL



Creating the Configuration files



Compiling an Application