1 #Makefile to create cross-compiler
6 #ref: http://cross-lfs.org/view/svn/x86/cross-tools/gcc-static.html
8 sudo chown
${USER} /mnt
/clfs
/ -R
12 install -dv
${CLFS}/tools
13 sudo ln
-sv
${CLFS}/tools
/
14 install -dv
${CLFS}/cross-tools
15 sudo ln
-sv
${CLFS}/cross-tools
/
16 sudo chown
${USER} /mnt
/clfs
/ -R
17 sudo chown
${USER} /tools
-R
18 sudo chown
${USER} /cross-tools
-R
20 cat
>> ~
/.bashrc
<< "EOF"
25 PATH
=/cross-tools
/bin
:/bin
:/usr
/bin
26 export CLFS LC_ALL PATH
28 source ~
/.bash_profile
32 export CLFS_HOST
="$(echo $MACHTYPE | \
33 sed "s
/$(echo
$MACHTYPE | cut
-d-
-f2
)/cross
/")"
36 install -dv
/tools
/include
37 make ARCH
=i386 headers_check
38 make ARCH
=i386 INSTALL_HDR_PATH
=dest headers_install
39 cp
-rv dest
/include/* /tools
/include
42 .
/configure
--prefix=/cross-tools
47 patch
-Np1
-i ..
/binutils-2.18
-posix-1.patch
48 patch
-Np1
-i ..
/binutils-2.18
-branch_update-3.patch
51 AR
=ar AS
=as ..
/configure
--prefix=/cross-tools \
52 --host
=${CLFS_HOST} --target
=${CLFS_TARGET} --with-lib-path
=/tools
/lib \
53 --disable-nls
--enable-shared
--disable-multilib
57 cp
-v ..
/include/libiberty.h
/tools
/include
59 #Cross GCC-4.3.2 - Static
60 patch
-Np1
-i ..
/..
/gcc-4.3
.2-specs-1.static.patch
61 patch
-Np1
-i ..
/..
/gcc-4.3
.2-posix-1.patch
63 #undef STARTFILE_PREFIX_SPEC
64 #define STARTFILE_PREFIX_SPEC \"/tools/lib/\"" >> gcc
/config
/linux.h
65 cp
-v gcc
/Makefile.in
{,.orig
}
66 sed
-e
"s@\(^CROSS_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g" \
67 gcc
/Makefile.in.orig
> gcc
/Makefile.in
70 AR
=ar ..
/configure
--prefix=/cross-tools \
71 --build
=${CLFS_HOST} --host
=${CLFS_HOST} --target
=${CLFS_TARGET} \
72 --disable-multilib
--with-local-prefix
=/tools
--disable-nls \
73 --without-headers
--with-newlib
--disable-decimal-float \
74 --disable-libgomp
--disable-libmudflap
--disable-libssp \
75 --disable-shared
--disable-threads
--enable-languages
=c
79 ## uClibc try (0.9.30)
81 #export ldso_dir=/tools/lib
82 #configure uClibc with UCLIBC_HAS_FENV
83 # OR:configure GCC with --disable-decimal-float
84 make CROSS
=${CLFS_TARGET}- PREFIX
=/tools RUNTIME_PREFIX
=/ menuconfig
85 make CROSS
=${CLFS_TARGET}- PREFIX
=/tools RUNTIME_PREFIX
=/ install_dev
86 make CROSS
=${CLFS_TARGET}- PREFIX
=/tools RUNTIME_PREFIX
=/ install
87 cp
-r
/tools
/usr
/i386-linux-uclibc
/usr
/include/* /tools
/include/
89 # Cross GCC-4.3.2 - Final (delete old compiled gcc dir)
90 patch
-Np1
-i ..
/..
/gcc-4.3
.2-specs-1.shared.patch
91 patch
-Np1
-i ..
/..
/gcc-4.3
.2-posix-1.patch
93 #undef STARTFILE_PREFIX_SPEC
94 #define STARTFILE_PREFIX_SPEC \"/tools/lib/\"" >> gcc
/config
/linux.h
95 cp
-v gcc
/Makefile.in
{,.orig
}
96 sed
-e
"s@\(^CROSS_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g" \
97 gcc
/Makefile.in.orig
> gcc
/Makefile.in
99 #in file: gcc/config/linux.h
100 <make sure
>: UCLIBC_DYNAMIC_LINKER
=/lib
/ld-uClibc.so
.0
101 cp
-v configure
{,.orig
}
102 sed
-e
'/FLAGS_FOR_TARGET.*\/lib\//s@-B[^ ]*/lib/@@g' configure.orig
> \
107 CFLAGS
="$CFLAGS -pthread" \
108 AR
=ar ..
/configure
--prefix=/cross-tools \
109 --build
=${CLFS_HOST} --target
=${CLFS_TARGET} --host
=${CLFS_HOST} \
110 --disable-multilib
--with-local-prefix
=/tools
--disable-nls \
111 --enable-shared
--enable-languages
=c
,c
++ --enable-__cxa_atexit \
112 --enable-c99
--enable-long-long
--enable-threads
=posix
113 #CFLAGS="$CFLAGS -pthread"
114 #need at /cross-tools/lib: ln -s libpthread.so.0 libpthread.so
115 #<maybe need>cp -dr /tools/include/* /cross-tools/include/
116 CFLAGS
="$CFLAGS -pthread" \
117 make AS_FOR_TARGET
="${CLFS_TARGET}-as" \
118 LD_FOR_TARGET
="${CLFS_TARGET}-ld"