blob: 228cb60fceee5dd85e32d7ac22c72d881b61d3ff [file] [log] [blame]
APPLE LOCAL file documentation
NOTE: This file contains a description of the non-llvm GCC that llvm-gcc is
based on. For information on building llvm-gcc for any platform (including
Apple), please follow the directions in README.LLVM.
This file describes Apple's version of GCC 4.x modified for Darwin /
Mac OS X. Although Apple's stated policy is to contribute all of its
GCC work to the FSF GCC mainstream, at any given moment there will be
changes that are permanently unacceptable for FSF GCC, in need of
rework before acceptance, or that we simply aren't ready to send in.
This version of GCC contains all those changes.
In keeping with provision 2a of the GPL, each Apple change is marked
with a comment saying "APPLE LOCAL", followed by optional words "begin",
"end", or "file", followed by a short phrase describing the change
generally ("AltiVec" for instance, if the change is related to AltiVec
To build things the Apple way, just say (in the source directory)
mkdir -p build/obj build/dst build/sym
gnumake install RC_OS=macos RC_ARCHS=ppc TARGETS=ppc \
SRCROOT=`pwd` OBJROOT=`pwd`/build/obj \
DSTROOT=`pwd`/build/dst SYMROOT=`pwd`/build/sym
This will configure and then do a full bootstrap build, with all the
results going into the subdirectory build/ that you created. The
final results will be in the "dest root" directory build/dst, in the
form of an image of the installed directory structure. The drivers
and other user-visible tools have a "-4.0" suffixed, so for instance the
driver is /usr/bin/gcc-4.0
To install the results, become root and do
ditto build/dst /
Various knobs and switches are available, but even so, the Apple
makefile machinery is mainly designed for mass builds of all the
projects that make up Darwin and/or Mac OS X, and is thus not as
flexible as the standard GCC build process.
To build for i386 Darwin, set TARGETS=i386. To build universal, set
RC_ARCHS='i386 ppc' TARGETS='i386 ppc'. Note that you must have a
complete set of universal libraries and i386-targeting cctools for this
all to work.
You can set the four *ROOT variables to point anywhere, but they must
always be absolute pathnames.
This way of building may or may not work on non-Macs, and if it
doesn't, you're on your own.
In general, standard GCC procedures work for building this version.
We recommend that you build in a separate objdir; create a sibling
to the toplevel source dir, call it whatever you want, cd into it,
and say "../gcc/configure". This way you can have more than one
build using the same set of sources.
If you insist on building in the source directory using "./configure",
the GNUmakefile that supports the Apple build process (see above) will
shadow your makefile, and you will need to override this behavior by
saying "make -f Makefile" (or by moving GNUmakefile out of the way).
For instance:
mkdir darwin
cd darwin
../configure --prefix=/tmp/testplace
make bootstrap
make install
does a full build, plus two generations of self-compilation for
GCC proper, then an install.
To avoid building every language, use --enable-languages argument to
configure. For instance, '--enable-languages=objc,c++,obj-c++' skips
the Fortran and Java compilers. (The C compiler will always be
To build an x86 cross-compiler, add "--target=i386-darwin" to the
configure line. The x86 compiler works, but to make it useful you
will need libraries and such from x86 Darwin.