correction - use screenwidth/screenheight
[AROS-Contrib.git] / gnu / gcc / README
blob9a84b2f7bd5f299e21ef6710292eadfd87272d39
1 INDEX
2 =====
4 1. What is this?
5 2. Required knowledges
6 3. What is and how to build a cross compiler for AROS?
7 4. What is and how to build a native compiler for AROS?
8 5. Supported version
9 6. Contact
11 ------------------------------------------------------------------------
13 1. What is this?
15   This directory contains patches against the gcc source tree. Patches
16   follow the same naming convention as the gcc releases, plus a trailing
17   "-aros.diff" (without quotes).
19 2. Required knowledges
21   This README is not for everyone. You need to know a few things before 
22   you attempt to build a native or cross compiler, and this documentation
23   does not attempt to explain to you those things.
24   
25   You need to know the following things:
26   
27     1) What is a "patch" and how to "apply" it. Refer to the "patch" 
28        and "diff" commands man pages to know more about it.
29      
30     2) What is gcc and, more importantly, how to build it from sources.
31        You can find documentation about these issues both on gcc's web 
32        pages and in every gcc archive. The web page can be found at
33        http://gcc.gnu.org/, and the documentation for how to build and
34        install it is at http://gcc.gnu.org/install/.
36     3) If you want to build a native compiler, you also need to know
37        how to use a compiler and, more specifically, a crosscompiler 
38        for AROS.
39        
40   Failure to meet any of the above requirements will most likely result 
41   in anger and frustration, you've been warned! :-) 
42   
43 3. What is and how to build a cross compiler for AROS?
45   A cross compiler is a compiler able to produce binaries usable by a
46   "target" system, which however runs on a different system than the
47   target's one. This is useful to speed up development, in case the
48   "host" system is faster than the "target" one, or if the "host"
49   system has any other advantages over the "target" one.
51   In our case the target system is AROS, and to produce a crosscompiler
52   for AROS you need to go trough the following steps:
54   1) Decide which patch you want to apply
56   2) Download the archive to which the patch you chose applies. You
57      can find such archives at one of the sites listed at
58      http://www.gnu.org/software/gcc/releases.html
60   3) Apply the patch
62   4) Assuming the patched gcc sources are in the "src/gcc-aros" directory,
63      make a new directory named "src/gcc-aros-x-bin" and cd onto it.
64     
65   5) Now issue the following command (all on one line):
66   
67      ../gcc-aros/configure --target=<cpu>-aros --with-headers=<path/to/AROS/headers> 
68      --with-libs=<path/to/AROS/libs>
70      replace the various <...> with the proper values.
72      If includes and libs are already placed in standard directories
73      (<prefix>/<cpu>-aros/sys-include and <prefix>/<cpu>-aros/lib), then
74      --with-headers and --with-libs parameters are not needed.
76   6) Type "make" and then "make install",
78 - IMPORTANT: to be able to build the compiler you need to have built the
79              linker and related utilities first. Such tools are part of the
80              "binutils" package, which is compilable for AROS out of the box
81              (no need for patches). Get the latest version from
82              http://www.gnu.org/software/binutils/
84 - IMPORTANT2: to be able to produce working AROS executables, you also
85               need a tool named collect-aros, which is part of the
86               AROS build system. The version produced during AROS build
87               have hardcoded paths to binutils, so it won't work with
88               standalone toolchain. Instructions for building a correct
89               version of collect-aros for standalone toolchain can be
90               found in its README file. Compiled collect-aros can be
91               placed into <your_install_prefix)/<cpu>-aros/bin
92               directory (there you'll also see some binutils stuff).
94 - IMPORTANT3: to be able to build a cross-toolchain under MacOS X you
95               need to specify the following additional arguments to
96               configure:
98      binutils: --disable-werror
99      gcc     : --with-libiconv-prefix=/opt/local --with-gmp=/opt/local --with-mpfr=/opt/local
101 - IMPORTANT4: (ARM-specific) Multilib in gcc v4.5.1 includes hardfloat versions
102               by default. AROS does not support this yet, so the build will fail
103               (libstdc++ will fail to configure because AROS does not have
104               hardfloat version of libc). Supply --disable-fpu to configure.
106 4. What is and how to build a native compiler for AROS?
108   As opposed to a crosscompiler, a native compiler runs on the same
109   system the compiler is targetted for, that is "host" and "target"
110   are the same.
112   Currently there's no way to build a native compiler from inside AROS
113   itself, thus you need to use another operating system as the "build"
114   system, and for this purpose you need to build a crosscompiler and
115   the cross-binutils before trying to build the native compiler.
116   For this, refer to section 2.
118   Assuming you've got the crosscompiler and related utilities built
119   already, follow the below procedure in order to build a native
120   compiler:
122     1) Assuming the patched gcc sources are in the "src/gcc-aros" directory,
123        make a new directory named "src/gcc-aros-bin" and cd onto it.
124     
125     2) Now issue the following command (all on one line):
126   
127        CC='i386-aros-gcc -nix' ../gcc-aros/configure --target=<cpu>-aros
128        --host=<cpu>-aros --build=local
129        --prefix=<prefix for the gcc installation, from the AROS point of view>
130        --enable-long-long 
132        Replace the various <...> with the proper values.
134        <prefix for...> refers to the prefix, from the AROS point of
135        view, which will be put before the names of all the directories
136        the build system will install files and executables into.
137        For instance, the gcc executable will be installed in
138        <prefix>/bin, thus if you set the prefix to "GCC:" (or /GCC), for
139        instance, then the gcc executable will be installed in GCC:/bin
140        (or /GCC/bin), which actually is the same as GCC:bin (from gcc's
141        point of view, which uses some unix path conversion routines built
142        in the AROS libc). Feel free to set that prefix to whatever you want.
144     3) Type "make", without quotes.
146     4) Type "make install prefix=<XXX> exec_prefix=<XXX>", without
147        quotes.
149        <XXX> refers to the prefix, from the BUILD SYSTEM
150        point of view, which will be put before the names of all
151        directories the build system will install files and executables
152        in. This *must* be the same prefix that you specified at
153        configuration time, except that this time it must be specified
154        as seen by the build system. However, If at configuration time
155        you used a volume name as prefix, then at this stage you can
156        specify whatever prefix you want, as long as you take care
157        of mounting the previously specified volume in AROS, or
158        assigning it to the directory where gcc's stuff really is.
160   IMPORTANT: You still need the native binutils if you want to
161              do anything with the native compiler. The steps you need
162              to go trough to build the native binutils are pretty much
163              the same as the ones for gcc, except you needn't apply
164              any patches, as the AROS support for the binutils is
165              already in the main archive. All that was said about the
166              "prefix" stuff still applies for the binutils as well.
168   IMPORTANT2: You need to build also collect-aros, natively for AROS.
169               In order to do this, you will have to use the
170               crosscompiler and build it by yourself. It's not
171               hard, really, but at the moment there are no instructions
172               on how to do so. You basically need to use the "bfd"
173               backend, and the "spawn" version of docommand, and then
174               link with libiberty.a and libbfd.a.
176 5. Supported version(s)
178 Currently only a patch for version 4.6.2 of gcc is maintained.
179 Out-of-date patches for older versions of gcc are available in the
180 history of the AROS subversion repository.
181 If one wants to patch another version of gcc it probably is better
182 to port a maintained patch than trying to bring an out-of-date patch
183 up-to-date.
185 6. Contact
187 For more information about AROS and using this compiler you can post a
188 mail on the developers maillist (aros_dev@aros.org) or on the aros-exec
189 forum (http://www.aros-exec.org).