Rev 255 | Rev 501 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 255 | Rev 260 | ||
---|---|---|---|
1 | #!/bin/bash |
1 | #!/bin/bash |
2 | 2 | ||
3 | # Cross-Compiler Toolchain for ${PLATFORM} |
3 | # Cross-Compiler Toolchain for ${PLATFORM} |
4 | # by Martin Decky <martin@decky.cz> |
4 | # by Martin Decky <martin@decky.cz> |
5 | # |
5 | # |
6 | # GPL'ed, copyleft |
6 | # GPL'ed, copyleft |
7 | # |
7 | # |
8 | 8 | ||
9 | 9 | ||
10 | check_error() { |
10 | check_error() { |
11 | if [ "$1" -ne "0" ]; then |
11 | if [ "$1" -ne "0" ]; then |
12 | echo |
12 | echo |
13 | echo "Script failed: $2" |
13 | echo "Script failed: $2" |
14 | exit |
14 | exit |
15 | fi |
15 | fi |
16 | } |
16 | } |
17 | 17 | ||
18 | BINUTILS_VERSION="2.16" |
18 | BINUTILS_VERSION="2.16" |
19 | GCC_VERSION="4.0.1" |
19 | GCC_VERSION="4.0.1" |
20 | 20 | ||
21 | INCLUDES="ia64-pc-gnu-linux_includes.tar.bz2" |
21 | INCLUDES="ia64-pc-gnu-linux_includes.tar.bz2" |
22 | BINUTILS="binutils-${BINUTILS_VERSION}.tar.gz" |
22 | BINUTILS="binutils-${BINUTILS_VERSION}.tar.gz" |
23 | GCC="gcc-core-${GCC_VERSION}.tar.bz2" |
23 | GCC="gcc-core-${GCC_VERSION}.tar.bz2" |
24 | 24 | ||
25 | INCLUDES_SOURCE="http://download.decky.cz/" |
25 | INCLUDES_SOURCE="http://download.decky.cz/" |
26 | BINUTILS_SOURCE="ftp://ftp.gnu.org/gnu/binutils/" |
26 | BINUTILS_SOURCE="ftp://ftp.gnu.org/gnu/binutils/" |
27 | GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/" |
27 | GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/" |
28 | 28 | ||
29 | PLATFORM="ia64" |
29 | PLATFORM="ia64" |
30 | WORKDIR=`pwd` |
30 | WORKDIR=`pwd` |
31 | TARGET="${PLATFORM}-pc-linux-gnu" |
31 | TARGET="${PLATFORM}-pc-linux-gnu" |
32 | HOST="i686-pc-linux-gnu" |
32 | HOST="i686-pc-linux-gnu" |
33 | PREFIX="/usr/local/${PLATFORM}" |
33 | PREFIX="/usr/local/${PLATFORM}" |
34 | INCLUDESDIR="${WORKDIR}/include" |
34 | INCLUDESDIR="${WORKDIR}/include" |
35 | BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}" |
35 | BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}" |
36 | GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}" |
36 | GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}" |
37 | OBJDIR="${WORKDIR}/gcc-obj" |
37 | OBJDIR="${WORKDIR}/gcc-obj" |
38 | 38 | ||
39 | echo ">>> Downloading tarballs" |
39 | echo ">>> Downloading tarballs" |
40 | 40 | ||
41 | if [ ! -f "${INCLUDES}" ]; then |
41 | if [ ! -f "${INCLUDES}" ]; then |
42 | wget -c "${INCLUDES_SOURCE}${INCLUDES}" |
42 | wget -c "${INCLUDES_SOURCE}${INCLUDES}" |
43 | check_error $? "Error downloading includes." |
43 | check_error $? "Error downloading includes." |
44 | fi |
44 | fi |
45 | if [ ! -f "${BINUTILS}" ]; then |
45 | if [ ! -f "${BINUTILS}" ]; then |
46 | wget -c "${BINUTILS_SOURCE}${BINUTILS}" |
46 | wget -c "${BINUTILS_SOURCE}${BINUTILS}" |
47 | check_error $? "Error downloading binutils." |
47 | check_error $? "Error downloading binutils." |
48 | fi |
48 | fi |
49 | if [ ! -f "${GCC}" ]; then |
49 | if [ ! -f "${GCC}" ]; then |
50 | wget -c "${GCC_SOURCE}${GCC}" |
50 | wget -c "${GCC_SOURCE}${GCC}" |
51 | check_error $? "Error downloading GCC." |
51 | check_error $? "Error downloading GCC." |
52 | fi |
52 | fi |
53 | 53 | ||
54 | echo ">>> Creating destionation directory" |
54 | echo ">>> Creating destionation directory" |
55 | if [ ! -d "${PREFIX}" ]; then |
55 | if [ ! -d "${PREFIX}" ]; then |
56 | mkdir -p "${PREFIX}" |
56 | mkdir -p "${PREFIX}" |
57 | test -d "${PREFIX}" |
57 | test -d "${PREFIX}" |
58 | check_error $? "Unable to create ${PREFIX}." |
58 | check_error $? "Unable to create ${PREFIX}." |
59 | fi |
59 | fi |
60 | 60 | ||
61 | echo ">>> Creating GCC work directory" |
61 | echo ">>> Creating GCC work directory" |
62 | if [ ! -d "${OBJDIR}" ]; then |
62 | if [ ! -d "${OBJDIR}" ]; then |
63 | mkdir -p "${OBJDIR}" |
63 | mkdir -p "${OBJDIR}" |
64 | test -d "${OBJDIR}" |
64 | test -d "${OBJDIR}" |
65 | check_error $? "Unable to create ${OBJDIR}." |
65 | check_error $? "Unable to create ${OBJDIR}." |
66 | fi |
66 | fi |
67 | 67 | ||
68 | echo ">>> Unpacking tarballs" |
68 | echo ">>> Unpacking tarballs" |
69 | tar -xvjf "${INCLUDES}" |
69 | tar -xvjf "${INCLUDES}" |
70 | check_error $? "Error unpacking includes." |
70 | check_error $? "Error unpacking includes." |
71 | tar -xvzf "${BINUTILS}" |
71 | tar -xvzf "${BINUTILS}" |
72 | check_error $? "Error unpacking binutils." |
72 | check_error $? "Error unpacking binutils." |
73 | tar -xvjf "${GCC}" |
73 | tar -xvjf "${GCC}" |
74 | check_error $? "Error unpacking GCC." |
74 | check_error $? "Error unpacking GCC." |
75 | 75 | ||
76 | echo ">>> Compiling and installing binutils" |
76 | echo ">>> Compiling and installing binutils" |
77 | cd "${BINUTILSDIR}" |
77 | cd "${BINUTILSDIR}" |
78 | check_error $? "Change directory failed." |
78 | check_error $? "Change directory failed." |
79 | ./configure "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--disable-nls" |
79 | ./configure "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" "--disable-nls" |
80 | check_error $? "Error configuring binutils." |
80 | check_error $? "Error configuring binutils." |
81 | make all install |
81 | make all install |
82 | check_error $? "Error compiling/installing binutils." |
82 | check_error $? "Error compiling/installing binutils." |
83 | 83 | ||
84 | echo ">>> Compiling and installing GCC" |
84 | echo ">>> Compiling and installing GCC" |
85 | cd "${OBJDIR}" |
85 | cd "${OBJDIR}" |
86 | check_error $? "Change directory failed." |
86 | check_error $? "Change directory failed." |
87 | "${GCCDIR}/configure" "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c --disable-multilib --disable-libgcj "--with-headers=${INCLUDESDIR}" --disable-shared |
87 | "${GCCDIR}/configure" "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c --disable-multilib --disable-libgcj "--with-headers=${INCLUDESDIR}" --disable-shared |
88 | check_error $? "Error configuring GCC." |
88 | check_error $? "Error configuring GCC." |
89 | PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc |
89 | PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc |
90 | check_error $? "Error compiling/installing GCC." |
90 | check_error $? "Error compiling/installing GCC." |
91 | 91 | ||
92 | echo |
92 | echo |
93 | echo ">>> Cross-compiler for ${TARGET} installed." |
93 | echo ">>> Cross-compiler for ${TARGET} installed." |
94 | 94 |