Using GCCSDK
From RISC OS
Contents |
Using GCCSDK to cross-compile for RISC OS
This is a quick outline of how to use GCCSDK and its autobuilder. We hope to expand this section soon..
Cross-compiling for RISC OS is done by using GCCSDK on Unix-alike host system, such as GNU/Linux, FreeBSD, Solaris, MacOS X or even Windows (under Cygwin). To get started, ensure you have a Subversion client installed for your system, and fetch the GCCSDK source to the current directory (which needs about 280MB disc space):
mkdir gccsdk svn co svn://svn.riscos.info/gccsdk/branches/release_3_4_6/gcc gccsdk/gcc svn co svn://svn.riscos.info/gccsdk/trunk/autobuilder gccsdk/autobuilder
Detailed instructions are given in the file gccsdk/gcc/README (or the WebSVN copy), however they are essentially as follows. Refer to the README where assumptions are noted.
You'll need at least the following programs (or later versions) installed on your Unix-alike machine:
gcc version 3 recommended svn (subversion) bash for this example autoconf version 2.50 autoheader bison version 1.27 flex version 2.5.4 gperf version 2.7.2 sed version 2.05 GNU make version 3.80 makeinfo version 4.2 (see README for Debian notes)
We also need to be able to write to a directory named /home/riscos (this can be changed, see the README). First we set the GCCSDK_SRC variable so this tutorial can refer to the position of the sources.
bash export GCCSDK_SRC=$PWD/gccsdk
Then we build GCCSDK (this may take many minutes, depending on the speed of your computer):
cd gccsdk/gcc autoconf ; autoheader ./do-configure make setup make build-cross make porting-scripts
You now have a complete GCC cross compiler environment. If you wanted to go on and build GCC for RISC OS also, you can just type 'make' at this point.
GCCSDK Autobuilder Usage
The autobuilder contains a number of programs with quite complex build systems, and has some additional requirements itself which need to be present on the build system. They are the following:
wget rman cvs realpath pkg-config automake glib-1.2 libpopt-dev liborbit-dev
Now use the autobuilder to build a package:
mkdir ~/build cd ~/build $GCCSDK_SRC/autobuilder/build -v wget
This will attempt to build in the ~/build/wget directory (that is, in build/wget in your home directory). If the build is successful this will be deleted and the results placed in $GCCSDK_SRC/autobuilder/autobuilder_packages. This is a Zip file which can be copied to RISC OS to be unpacked and run. If not successful the ~/build/wget directory will remain for you to inspect. The output from the build process is also saved in $GCCSDK_SRC/autobuilder/network/wget as either a file last-success or last-failure depending on what happened.
The cross-build process is controlled by files in the $GCCSDK_SRC/autobuilder/network/wget directory, mostly the 'setvars' file which is executed by $GCCSDK_SRC/autobuilder/build via fetch-program and build-program - look at these three scripts to see what's going on. Sources are fetched automatically from the Debian project's source repository unless otherwise stated, then local patches (if any) are applied before configuring and building.
Porting a new package involves creating a new directory in a suitable place in $GCCSDK_SRC/autobuilder tree and producing a setvars file. You may provide patch files in that directory with names ending in .p will be automatically applied. Look at some of other packages' directories for examples.
See autobuilder documentation gccsdk/autobuilder/AutoBuilder.html (or see HTML source from WebSVN) for more detailed instructions.
Other Package, Dependencies and Usages
There are many more packages and libraries in the autobuilder, too many to list here. Many of the programs in the Unix Porting Project are represented here. Many of these contain dependencies, which means they will instruct other packages to be built first before they can be built.
The method for building them is precisely the same. For example:
$GCCSDK_SRC/autobuilder/build -v firefox
This will build the version of Mozilla Firefox for RISC OS. This version is approximately equivalent to the Beta 4 version. Note that this has many dependencies and could take some hours depending upon your hardware and network connection.
If you want to retain the source to a package (e.g. for debugging or development), simply use the -d flag alongside the -v flag.
Using ChoX11 with the Autobuilder
Any program in the autobuilder which has dependencies upon the X libraries will also require ChoX11 and DeskLib (which ChoX11 uses) to be built. The autobuilder will instruct the linker to automatically replace library references to the X11 library with ChoX11 and DeskLib.