INDEX ===== 1. What is this? 2. Required knowledges 3. What is and how to build a cross compiler for AROS? 4. What is and how to build a native compiler for AROS? 5. Contact ------------------------------------------------------------------------ 1. What is this? This directory contains patches against the gcc source tree. Patches follow the same naming convention as the gcc releases, plus a trailing "-aros.diff" (without quotes). 2. Required knowledges This README is not for everyone. You need to know a few things before you attempt to build a native or cross compiler, and this documentation does not attempt to explain to you those things. You need to know the following things: 1) What is a "patch" and how to "apply" it. Refer to the "patch" and "diff" commands man pages to know more about it. 2) What is gcc and, more importantly, how to build it from sources. You can find documentation about these issues both on gcc's web pages and in every gcc archive. The web page can be found at http://gcc.gnu.org/, and the documentation for how to build and install it is at http://gcc.gnu.org/install/. 3) If you want to build a native compiler, you also need to know how to use a compiler and, more specifically, a crosscompiler for AROS. Failure to meet any of the above requirements will most likely result in anger and frustration, you've been warned! :-) 3. What is and how to build a cross compiler for AROS? A cross compiler is a compiler able to produce binaries usable by a "target" system, which however runs on a different system than the target's one. This is useful to speed up development, in case the "host" system is faster than the "target" one, or if the "host" system has any other advantages over the "target" one. In our case the target system is AROS, and to produce a crosscompiler for AROS you need to go trough the following steps: 1) Decide which patch you want to apply 2) Download the archive to which the patch you chose applies. You can find such archives at one of the sites listed at http://www.gnu.org/software/gcc/releases.html 3) Apply the patch 4) Assuming the patched gcc sources are in the "gcc-aros" directory, make a new directory named "gcc-aros-x-bin" and cd onto it. 5) Now issue the following command (all on one line): ../gcc/configure --target=<cpu>-aros --enable-sjlj-exceptions --enable-long-long --with-headers=<path/to/AROS/headers> --with-libs=<path/to/AROS/libs> replace the various <...> with the proper values. 6) Type "make" and then "make install", - IMPORTANT: to be able to build the compiler you need to have built the linker and related utilities first. Such tools are part of the "binutils" package, which is compilable for AROS out of the box (no need for patches). Get the latest version from http://www.gnu.org/software/binutils/ - IMPORTANT2: to be able to produce working AROS executables, you also need a tool named collect-aros, which is part of the AROS build system, and thus can be found, once AROS is compiled, under bin/<host>-<cpu>/tools/ OR in the AROS-SDK package downloadable from http://www.aros.org/download.php. Make sure that collect-aros is in the PATH, so that the compiler can access it. 4. What is and how to build a native compiler for AROS? As opposed to a crosscompiler, a native compiler runs on the same system the compiler is targetted for, that is "host" and "target" are the same. Currently there's no way to build a native compiler from inside AROS itself, thus you need to use another operating system as the "build" system, and for this purpose you need to build a crosscompiler and the cross-binutils before trying to build the native compiler. For this, refer to section 2. Assuming you've got the crosscompiler and related utilities built already, follow the below procedure in order to build a native compiler: 1) Assuming the patched gcc sources are in the "gcc-aros" directory, make a new directory named "gcc-aros-bin" and cd onto it. 2) Now issue the following command (all on one line): CC='i386-aros-gcc -nix' ../gcc/configure --target=<cpu>-aros --host=<cpu>-aros --build=local --enable-sjlj-exceptions --prefix=<prefix for the gcc installation, from the AROS point of view> --enable-long-long Replace the various <...> with the proper values. <prefix for...> refers to the prefix, from the AROS point of view, which will be put before the names of all the directories the build system will install files and executables into. For instance, the gcc executable will be installed in <prefix>/bin, thus if you set the prefix to "GCC:" (or /GCC), for instance, then the gcc executable will be installed in GCC:/bin (or /GCC/bin), which actually is the same as GCC:bin (from gcc's point of view, which uses some unix path conversion routines built in the AROS libc). Feel free to set that prefix to whatever you want. 3) Type "make", without quotes. 4) Type "make install prefix=<XXX> exec_prefix=<XXX>", without quotes. <XXX> refers to the prefix, from the BUILD SYSTEM point of view, which will be put before the names of all directories the build system will install files and executables in. This *must* be the same prefix that you specified at configuration time, except that this time it must be specified as seen by the build system. However, If at configuration time you used a volume name as prefix, then at this stage you can specify whatever prefix you want, as long as you take care of mounting the previously specified volume in AROS, or assigning it to the directory where gcc's stuff really is. IMPORTANT: You still need the native binutils if you want to do anything with the native compiler. The steps you need to go trough to build the native binutils are pretty much the same as the ones for gcc, except you needn't apply any patches, as the AROS support for the binutils is already in the main archive. All that was said about the "prefix" stuff still applies for the binutils as well. IMPORTANT2: You need to build also collect-aros, natively for AROS. In order to do this, you will have to use the crosscompiler and build it by yourself. It's not hard, really, but at the moment there are no instructions on how to do so. You basically need to use the "bfd" backend, and the "spawn" version of docommand, and then link with libiberty.a and libbfd.a. 5. Contact If you need to blame someone for how crappy this gcc port is, then by any means blame Fabio Alemagna <falemagn@studenti.unina.it>. Feel free to also ask normal questions, though :-)