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