<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
  "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../../general.ent">
  %general-entities;
]>

<sect1 id="ch-temp-system-gcc" role="wrap">
  <?dbhtml filename="gcc.html"?>

  <title>GCC-&gcc-version;</title>

  <indexterm zone="ch-temp-system-gcc">
    <primary sortas="a-GCC">GCC</primary>
    <secondary>temporary system</secondary>
  </indexterm>

  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
  href="../../final-system/common/gcc.xml"
  xpointer="xpointer(//*[@role='package'])"/>

  <sect2 role="installation">
    <title>Installation of GCC</title>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../../final-system/common/gcc.xml"
    xpointer="xpointer(//*[@os='p1'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../../final-system/common/gcc.xml"
    xpointer="xpointer(//*[@os='p2'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../../cross-tools/x86/gcc-static.xml"
    xpointer="xpointer(//*[@os='aa'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../../cross-tools/x86/gcc-static.xml"
    xpointer="xpointer(//*[@os='ab'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../../cross-tools/x86/gcc-static.xml"
    xpointer="xpointer(//*[@os='ac'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../../cross-tools/x86/gcc-static.xml"
    xpointer="xpointer(//*[@os='ad'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../../cross-tools/x86/gcc-static.xml"
    xpointer="xpointer(//*[@os='ae'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../../cross-tools/x86/gcc-static.xml"
    xpointer="xpointer(//*[@os='af'])"/>

    <para os="cd">Now we will change <command>cpp</command>'s search path not to look in
    <filename class="directory">/usr/include</filename>:</para>

<screen os="ce"><userinput>cp -v gcc/cppdefault.c{,.orig}
sed -e '/#define STANDARD_INCLUDE_DIR/s@"/usr/include"@0@g' \
    gcc/cppdefault.c.orig > gcc/cppdefault.c</userinput></screen>

    <para os="cf">Also, we need to set the directory searched by the fixincludes
    process for system headers, so it won't look at the host's headers:</para>

<screen os="cg"><userinput>cp -v gcc/Makefile.in{,.orig}
sed -e 's@\(^NATIVE_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g' \
    gcc/Makefile.in.orig > gcc/Makefile.in</userinput></screen>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../../cross-tools/x86/gcc-static.xml"
    xpointer="xpointer(//*[@os='ak'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../../final-system/common/gcc.xml"
    xpointer="xpointer(//*[@os='f'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../../final-system/common/gcc.xml"
    xpointer="xpointer(//*[@os='g'])"/>

    <para os="cj">Before starting to build GCC, remember to unset any environment
    variables that override the default optimization flags.</para>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../../final-system/common/gcc.xml"
    xpointer="xpointer(//*[@os='h'])"/>

<screen os="ck"><userinput>../gcc-&gcc-version;/configure --prefix=/tools \
    --build=${CLFS_HOST} --host=${CLFS_TARGET} --target=${CLFS_TARGET} \
    --with-local-prefix=/tools --enable-long-long --enable-c99 \
    --enable-shared --enable-threads=posix --enable-__cxa_atexit \
    --disable-nls --enable-languages=c,c++ --disable-libstdcxx-pch</userinput></screen>

    <variablelist os="cl">
      <title>The meaning of the new configure options:</title>

      <varlistentry os="cl1">
        <term><parameter>--disable-libstdcxx-pch</parameter></term>
        <listitem>
          <para>Do not build the pre-compiled header (PCH) for
          <filename class="libraryfile">libstdc++</filename>. It takes
          up a lot of space, and we have no use for it.</para>
        </listitem>
      </varlistentry>

    </variablelist>

    <para os="cm">Compile the package:</para>

<screen os="cn"><userinput>make AS_FOR_TARGET="${AS}" \
    LD_FOR_TARGET="${LD}"</userinput></screen>

    <para os="co">Install the package:</para>

<screen os="cp"><userinput>make install</userinput></screen>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../../final-system/common/gcc.xml"
    xpointer="xpointer(//*[@os='w'])"/>

<screen os="cq"><userinput>ln -sv gcc /tools/bin/cc</userinput></screen>

  </sect2>

  <sect2 role="content">
    <title/>

    <para>Details on this package are located in <xref
    linkend="contents-gcc" role="."/></para>

  </sect2>

</sect1>
