Build Instructions
Required source packages

    * A recent GCC 3.3.x release or 3.4 snapshot.  The C++ and Java packages are
      required.
    * The gdc package from the main page.
      

Required software

    * The usual GCC requirements (http://gcc.gnu.org/install/prerequisites.html)
    * An already-installed C++ compiler (bootstrapping is not supported yet).
      G++ 3.x is known to work.  G++ 2.x is known to not work.

Directories

    * <srcdir> -- Location of the GCC sources
    * <builddir> -- Build directory for GCC
    * <prefix> -- Install directory for GCC

Building the Compiler

   1. Unpack the GCC archive.  This creates <srcdir>.
   2. Change the the <srcdir>/gcc directory.
   3. Unpack the DMD-GCC glue archive.  This will create a subdirectory named "d".
   4. In the "d" subdirectory, find the GCC patch closest to your version of
      GCC.  These are all named patch-gcc-....
   5. From <srcdir>/gcc, apply the patch. Example:

      patch -p1 < d/patch-gcc-3.4.x

   6. Build GCC using the normal install instructions.  The only difference is
      that "d" is added to the --enable-languages option.  Unless you will not
      be using the recls package, you also need to enable the C++ compiler.

      If you need to specify a compiler to build GCC other than the system's
      default, use the "CC" and "CXX" environment variables. Example:

      CC=gcc3 CXX=g++3 <srcdir>/configure --prefix=/usr/local/gcc-3.4 --enable-languages=c,d,c++

      Remember to always use "gmake" if GNU Make is not the system's default.

      IMPORTANT: If you are updating from an earlier version of GDC without
      doing a fresh build, delete all object files in <builddir>/gcc/d before
      building.

   7. Install normally with "make install". 

Runtime Library
Phobos does not build automatically nor is it integrated with the GCC target library system.

   1. (For Cygwin only)  Change to <srcdir>/gcc/d/phobos/ and run prepcygwin.sh.
   2. Choose a build directory for Phobos (e.g., <builddir>/phobos), create it,
      and change to it.  If you are updating from an earlier version of GDC,
      completely remove the old Phobos build directory.
   3. Make sure the newly-installed compiler is in your path.  Add to the front
      of the path so that the gcc and g++ that were just built will be used.
   4. Run <srcdir>/gcc/d/phobos/configure.  Use the same --prefix argument that
      you passed to the GCC configure.  You can set the environment variable
      "DFLAGS".  Example:

      DFLAGS="-O2 -g -frelease" <srcdr>/gcc/d/phobos/configure --prefix=/usr/local/gcc-3.4

      Use --enable-thread-lib=<arg> to specify the linker arguments needed to
      enable threads.  The configure script can usually determine this
      automatically.
   5. Run make and then make install.

Notes

    * To run the unit tests, rebuild phobos with "-funittest" in the DFLAGS and
      then "make unittest".  The following failures should be expected:
          o On Darwin and FreeBSD, std.math tests will fail because there is no
            80-bit real (or library support for it.)            
          o On FreeBSD and Linux, the test of the "%A" format will
            fail due to a library bug.
    * If you use recls, you need to add -lstdc++ to the link flags (or run g++
      and add -lphobos and -lpthread.)  Also add <prefix>/lib to LD_LIBRARY_PATH
      or whatever is necessary for your system to find shared libraries. OR you
      try building GCC and your programs with a static libstdc++.
