<?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-tools-perl" role="wrap">
  <?dbhtml filename="perl.html"?>

  <title>Perl-&perl-version;</title>

  <indexterm zone="ch-temp-tools-perl">
    <primary sortas="a-Perl">Perl</primary>
    <secondary>temporary tools</secondary>
  </indexterm>

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

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

    <para os="a">First adapt some hard-wired paths to the C library by applying
    the following patch:</para>

<screen os="b"><userinput>patch -Np1 -i ../&perl-libc-patch;</userinput></screen>

   <para os="c">Now make a change to allow the creation of a cross-compiled version of
   perl. This change will rename miniperl to miniperl-cross. The files that need to be modified also need their permissions changed:</para>

<screen os="d"><userinput>chmod 755 ext/util/make_ext
cp ext/util/make_ext{,.orig}
sed -e 's/miniperl/miniperl-cross/g' ext/util/make_ext.orig > ext/util/make_ext 
chmod 755 x2p/Makefile.SH
cp x2p/Makefile.SH{,.orig}
sed -e 's/miniperl/miniperl-cross/g' x2p/Makefile.SH.orig > x2p/Makefile.SH
chmod 755 utils/Makefile
cp utils/Makefile{,.orig}
sed -e 's/miniperl/miniperl-cross/g' utils/Makefile.orig > utils/Makefile</userinput></screen>

    <para os="e">Prepare Perl for compilation (make sure to get the 'Data/Dumper
    IO Fcntl POSIX' part of the command correct&mdash;they are all letters):</para>

<screen os="f"><userinput>CC="gcc" ./configure.gnu --prefix=/tools -Dstatic_ext='Data/Dumper IO Fcntl POSIX'</userinput></screen>

    <variablelist os="g">
      <title>The meaning of the configure option:</title>

      <varlistentry>
        <term><parameter>-Dstatic_ext='Data/Dumper IO Fcntl POSIX'</parameter></term>
        <listitem>
          <para>This tells Perl to build the minimum set of static
          extensions needed for installing and testing the Coreutils
          package in the next chapter.</para>
        </listitem>
      </varlistentry>

    </variablelist>

    <para os="h">We will now make a host miniperl and rename it to miniperl-cross:</para>

<screen os="i"><userinput>make miniperl
mv miniperl miniperl-cross
make clean</userinput></screen>

   <para os="j">We will now make perl cross-compile friendly by forcing it to use our
   cross-tools we have created:</para>

<screen os="k"><userinput>cp config.sh{,.orig}
sed -e "s@\(^ar=\).*@\1'${AR}'@g" \
    -e "s@\(^ranlib=\).*@\1'${RANLIB}'@g" \
    -e "s@\(^cc=\).*@\1'${CC}'@g" \
    -e "s@\(^ld=\).*@\1'${CC}'@g" config.sh.orig > config.sh</userinput></screen>

<para os="l">Now we will make miniperl for our architecture:</para>

<screen os="m"><userinput>make miniperl</userinput></screen>

    <para os="n">We will now edit the main Makefile to use our newly created miniperl-cross:</para>

<screen os="o"><userinput>cp Makefile{,.orig}
sed -e 's|(LDLIBPTH) ./miniperl|(LDLIBPTH) ./miniperl-cross|g' Makefile.orig > Makefile</userinput></screen>

  <para os="p">Now we are ready to make our cross-compiled perl:</para>

<screen os="q"><userinput>make miniperl
make perl utilities</userinput></screen>

    <para os="r">Install these tools and their libraries:</para>

<screen os="s"><userinput>cp perl pod/pod2man /tools/bin
install -d /tools/lib/perl5/&perl-version;
cp -R lib/* /tools/lib/perl5/&perl-version;</userinput></screen>

  </sect2>

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

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

  </sect2>

</sect1>
