#4479: chap5: startfile location in gcc
--------------------+-----------------------
Reporter: thomas | Owner: lfs-book
Type: task | Status: new
Priority: normal | Milestone: 8.5
Component: Book | Version: SVN
Severity: normal | Keywords: gcc eudev
--------------------+-----------------------
In chapter 5 we are currently changing a hand full of c,h sources by
adding #undef and #define statements to al of them. The #define is to
specify the location of the start files in /tools/lib/.
The only file where STANDARD_STARTFILE_PREFIX_1/2 is defined is in
gcc/gcc.c. As far as i can see, patching this file has the same effect of
setting the location correct but makes it unneccessary to manipulate some
other files to do that.
Following patch changes the location where it is initially defined. Not
much reduction of the size of instructions but i think its more straight
forward to patch one file instead of several others:
{{{
Index: chapter05/gcc-pass1.xml
===================================================================
--- chapter05/gcc-pass1.xml (revision 11613)
+++ chapter05/gcc-pass1.xml (working copy)
@@ -73,13 +73,11 @@
cp -uv $file{,.orig}
sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
-e 's@/usr@/tools@g' $file.orig > $file
- echo '
-#undef STANDARD_STARTFILE_PREFIX_1
-#undef STANDARD_STARTFILE_PREFIX_2
-#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
-#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
touch $file.orig
-done</userinput></screen>
+done
+sed -e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_1/
s;\".*\";\"/tools/lib/\";" \
+ -e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_2/ s;\".*\";\"\";"
\
+ -i gcc/gcc.c</userinput></screen>
<para>In case the above seems hard to follow, let's break it down a
bit.
First we copy the files <filename>gcc/config/linux.h</filename>,
Index: chapter05/gcc-pass2.xml
===================================================================
--- chapter05/gcc-pass2.xml (revision 11613)
+++ chapter05/gcc-pass2.xml (working copy)
@@ -75,13 +75,11 @@
cp -uv $file{,.orig}
sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
-e 's@/usr@/tools@g' $file.orig > $file
- echo '
-#undef STANDARD_STARTFILE_PREFIX_1
-#undef STANDARD_STARTFILE_PREFIX_2
-#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
-#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
touch $file.orig
-done</userinput></screen>
+done
+sed -e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_1/
s;\".*\";\"/tools/lib/\";" \
+ -e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_2/ s;\".*\";\"\";"
\
+ -i gcc/gcc.c</userinput></screen>
<para>If building on x86_64, change the default directory name for
64-bit
libraries to <quote>lib</quote>:</para>
}}}
A complete LFS build went fine using the new instructions but of course,
there might still something i've not been aware of, so comments welcome!
--
Ticket URL: <http://wiki.linuxfromscratch.org/lfs/ticket/4479>
LFS Trac <http://wiki.linuxfromscratch.org/lfs/>
Linux From Scratch: Your Distro, Your Rules.
--
http://lists.linuxfromscratch.org/listinfo/lfs-book
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page