Author: jhuntwork
Date: 2007-08-07 22:07:12 -0600 (Tue, 07 Aug 2007)
New Revision: 8288
Modified:
branches/jh/BOOK/chapter01/changelog.xml
branches/jh/BOOK/chapter03/patches.xml
branches/jh/BOOK/chapter05/gcc-pass2.xml
branches/jh/BOOK/patches.ent
Log:
Use a loop, find and sed instead of the gcc specs patch
Modified: branches/jh/BOOK/chapter01/changelog.xml
===================================================================
--- branches/jh/BOOK/chapter01/changelog.xml 2007-08-08 02:13:08 UTC (rev
8287)
+++ branches/jh/BOOK/chapter01/changelog.xml 2007-08-08 04:07:12 UTC (rev
8288)
@@ -40,6 +40,9 @@
<para>2007-08-07</para>
<itemizedlist>
<listitem>
+ <para>[jhuntwork] - Use a loop, find and sed instead of the gcc specs
patch</para>
+ </listitem>
+ <listitem>
<para>[jhuntwork] - Upgraded to Glibc 2.6.1</para>
</listitem>
<listitem>
Modified: branches/jh/BOOK/chapter03/patches.xml
===================================================================
--- branches/jh/BOOK/chapter03/patches.xml 2007-08-08 02:13:08 UTC (rev
8287)
+++ branches/jh/BOOK/chapter03/patches.xml 2007-08-08 04:07:12 UTC (rev
8288)
@@ -91,14 +91,6 @@
</varlistentry>
<varlistentry>
- <term>GCC Specs Patch - <token>&gcc-specs-patch-size;</token>:</term>
- <listitem>
- <para>Download: <ulink url="&patches-root;&gcc-specs-patch;"/></para>
- <para>MD5 sum: <literal>&gcc-specs-patch-md5;</literal></para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
<term>Grep RedHat Fixes Patch -
<token>&grep-fixes-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&grep-fixes-patch;"/></para>
Modified: branches/jh/BOOK/chapter05/gcc-pass2.xml
===================================================================
--- branches/jh/BOOK/chapter05/gcc-pass2.xml 2007-08-08 02:13:08 UTC (rev
8287)
+++ branches/jh/BOOK/chapter05/gcc-pass2.xml 2007-08-08 04:07:12 UTC (rev
8288)
@@ -84,30 +84,47 @@
sed 's/^XCFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in.tmp \
> gcc/Makefile.in</userinput></screen>
- <para>Apply the following patch to change the location of GCC's default
- dynamic linker (typically <filename
- class="libraryfile">ld-linux-x86-64.so.2</filename>):</para>
-
-<screen><userinput>patch -Np1 -i ../&gcc-specs-patch;</userinput></screen>
-
- <para>The above patch also removes <filename
+ <para>The following command will change the location of GCC's default
+ dynamic linker to use the one we installed in
+ <filename class="directory">/tools</filename>. It also removes <filename
class="directory">/usr/include</filename> from GCC's include search path.
- Patching now rather than adjusting the specs file after installation
+ Doing this now rather than adjusting the specs file after installation
ensures that the new dynamic linker is used during the actual build of
GCC. That is, all of the binaries created during the build will link
- against the new Glibc.</para>
+ against the new Glibc. Issue:</para>
- <important>
- <para>The above patch is critical in ensuring a successful overall
- build. Do not forget to apply it.</para>
- </important>
+<screen><userinput>for file in $(find gcc/config -name linux64.h -o -name
linux.h)
+do
+ cp -uv $file{,.orig}
+ sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
+ -e 's@/usr@/[EMAIL PROTECTED]' $file.orig > $file
+ echo "
+#undef STANDARD_INCLUDE_DIR
+#define STANDARD_INCLUDE_DIR 0" >> $file
+ touch $file.orig
+done</userinput></screen>
+ <para>In case the above seems hard to follow, let's break it down a bit.
+ First we find all the files under the gcc/config directory that are named
+ either <filename>linux.h</filename> or <filename>linux64.h</filename>.
+ For each file found, we copy it to a file of the same name but with an
added
+ suffix of <quote>.orig</quote>. Then the first sed expression prepends
+ <quote>/tools</quote> to every instance of <quote>/lib/ld</quote>,
+ <quote>/lib64/ld</quote> or <quote>/lib32/ld</quote>, while the second one
+ replaces hard-coded instances of <quote>/usr</quote>. Then we add our
define
+ statments altering the include search path to the end of the file. Finally,
+ we use <command>touch</command> to update the timestamp on the copied
files.
+ When used in conjunction with <command>cp -u</command>, this prevents
unexpected
+ changes to the original files in case the command is inadvertently run
twice.
+ </para>
+
<para>Unsetting the multlib spec for GCC ensures that it
won't attempt to link against libraries on the host:</para>
-<screen><userinput>cp gcc/config/i386/t-linux64{,.tmp}
-sed '/MULTILIB_OSDIRNAMES/d' gcc/config/i386/t-linux64.tmp \
- > gcc/config/i386/t-linux64</userinput></screen>
+<screen><userinput>for file in $(find gcc/config -name t-linux64) ; do \
+ cp -v $file{,.orig}
+ sed '/MULTILIB_OSDIRNAMES/d' $file.orig > $file
+done</userinput></screen>
<para>Create a separate build directory again:</para>
Modified: branches/jh/BOOK/patches.ent
===================================================================
--- branches/jh/BOOK/patches.ent 2007-08-08 02:13:08 UTC (rev 8287)
+++ branches/jh/BOOK/patches.ent 2007-08-08 04:07:12 UTC (rev 8288)
@@ -43,12 +43,7 @@
<!ENTITY gawk-segfault-patch-md5 "7679530d88bf3eb56c42eb6aba342ddb">
<!ENTITY gawk-segfault-patch-size "1.3 KB">
-<!ENTITY gcc-specs-patch "gcc-&gcc-version;-specs-1.patch">
-<!ENTITY gcc-specs-patch-md5 "a17be8ccfb978e73f382be5093dd8abd">
-<!ENTITY gcc-specs-patch-size "14.8 KB">
-
-
<!ENTITY grep-fixes-patch "grep-&grep-version;-redhat_fixes-2.patch">
<!ENTITY grep-fixes-patch-md5 "2c67910be2d0a54714f63ce350e6d8a6">
<!ENTITY grep-fixes-patch-size "55 KB">
--
http://linuxfromscratch.org/mailman/listinfo/lfs-book
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page