Rev 2578 | Rev 3424 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2578 | Rev 2787 | ||
---|---|---|---|
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.18" |
18 | BINUTILS_VERSION="2.18" |
19 | GCC_VERSION="4.2.2" |
19 | GCC_VERSION="4.2.2" |
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_CORE="gcc-core-${GCC_VERSION}.tar.bz2" |
23 | GCC_CORE="gcc-core-${GCC_VERSION}.tar.bz2" |
24 | GCC_OBJC="gcc-objc-${GCC_VERSION}.tar.bz2" |
24 | GCC_OBJC="gcc-objc-${GCC_VERSION}.tar.bz2" |
25 | GCC_CPP="gcc-g++-${GCC_VERSION}.tar.bz2" |
25 | GCC_CPP="gcc-g++-${GCC_VERSION}.tar.bz2" |
26 | 26 | ||
27 | INCLUDES_SOURCE="http://download.decky.cz/" |
27 | INCLUDES_SOURCE="http://download.decky.cz/" |
28 | BINUTILS_SOURCE="ftp://ftp.gnu.org/gnu/binutils/" |
28 | BINUTILS_SOURCE="ftp://ftp.gnu.org/gnu/binutils/" |
29 | GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/" |
29 | GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/" |
30 | 30 | ||
31 | PLATFORM="ia64" |
31 | PLATFORM="ia64" |
32 | WORKDIR=`pwd` |
32 | WORKDIR=`pwd` |
33 | TARGET="${PLATFORM}-pc-linux-gnu" |
33 | TARGET="${PLATFORM}-pc-linux-gnu" |
34 | PREFIX="/usr/local/${PLATFORM}" |
34 | PREFIX="/usr/local/${PLATFORM}" |
35 | INCLUDESDIR="${WORKDIR}/include" |
35 | INCLUDESDIR="${WORKDIR}/include" |
36 | BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}" |
36 | BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}" |
37 | GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}" |
37 | GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}" |
38 | OBJDIR="${WORKDIR}/gcc-obj" |
38 | OBJDIR="${WORKDIR}/gcc-obj" |
39 | 39 | ||
40 | echo ">>> Downloading tarballs" |
40 | echo ">>> Downloading tarballs" |
41 | 41 | ||
42 | if [ ! -f "${INCLUDES}" ]; then |
42 | if [ ! -f "${INCLUDES}" ]; then |
43 | wget -c "${INCLUDES_SOURCE}${INCLUDES}" |
43 | wget -c "${INCLUDES_SOURCE}${INCLUDES}" |
44 | check_error $? "Error downloading includes." |
44 | check_error $? "Error downloading includes." |
45 | fi |
45 | fi |
46 | if [ ! -f "${BINUTILS}" ]; then |
46 | if [ ! -f "${BINUTILS}" ]; then |
47 | wget -c "${BINUTILS_SOURCE}${BINUTILS}" |
47 | wget -c "${BINUTILS_SOURCE}${BINUTILS}" |
48 | check_error $? "Error downloading binutils." |
48 | check_error $? "Error downloading binutils." |
49 | fi |
49 | fi |
50 | if [ ! -f "${GCC_CORE}" ]; then |
50 | if [ ! -f "${GCC_CORE}" ]; then |
51 | wget -c "${GCC_SOURCE}${GCC_CORE}" |
51 | wget -c "${GCC_SOURCE}${GCC_CORE}" |
52 | check_error $? "Error downloading GCC Core." |
52 | check_error $? "Error downloading GCC Core." |
53 | fi |
53 | fi |
54 | if [ ! -f "${GCC_OBJC}" ]; then |
54 | if [ ! -f "${GCC_OBJC}" ]; then |
55 | wget -c "${GCC_SOURCE}${GCC_OBJC}" |
55 | wget -c "${GCC_SOURCE}${GCC_OBJC}" |
56 | check_error $? "Error downloading GCC Objective C." |
56 | check_error $? "Error downloading GCC Objective C." |
57 | fi |
57 | fi |
58 | if [ ! -f "${GCC_CPP}" ]; then |
58 | if [ ! -f "${GCC_CPP}" ]; then |
59 | wget -c "${GCC_SOURCE}${GCC_CPP}" |
59 | wget -c "${GCC_SOURCE}${GCC_CPP}" |
60 | check_error $? "Error downloading GCC C++." |
60 | check_error $? "Error downloading GCC C++." |
61 | fi |
61 | fi |
62 | 62 | ||
63 | echo ">>> Creating destionation directory" |
63 | echo ">>> Creating destionation directory" |
64 | if [ ! -d "${PREFIX}" ]; then |
64 | if [ ! -d "${PREFIX}" ]; then |
65 | mkdir -p "${PREFIX}" |
65 | mkdir -p "${PREFIX}" |
66 | test -d "${PREFIX}" |
66 | test -d "${PREFIX}" |
67 | check_error $? "Unable to create ${PREFIX}." |
67 | check_error $? "Unable to create ${PREFIX}." |
68 | fi |
68 | fi |
69 | 69 | ||
70 | echo ">>> Creating GCC work directory" |
70 | echo ">>> Creating GCC work directory" |
71 | if [ ! -d "${OBJDIR}" ]; then |
71 | if [ ! -d "${OBJDIR}" ]; then |
72 | mkdir -p "${OBJDIR}" |
72 | mkdir -p "${OBJDIR}" |
73 | test -d "${OBJDIR}" |
73 | test -d "${OBJDIR}" |
74 | check_error $? "Unable to create ${OBJDIR}." |
74 | check_error $? "Unable to create ${OBJDIR}." |
75 | fi |
75 | fi |
76 | 76 | ||
77 | echo ">>> Unpacking tarballs" |
77 | echo ">>> Unpacking tarballs" |
78 | tar -xvjf "${INCLUDES}" |
78 | tar -xvjf "${INCLUDES}" |
79 | check_error $? "Error unpacking includes." |
79 | check_error $? "Error unpacking includes." |
80 | tar -xvzf "${BINUTILS}" |
80 | tar -xvzf "${BINUTILS}" |
81 | check_error $? "Error unpacking binutils." |
81 | check_error $? "Error unpacking binutils." |
82 | tar -xvjf "${GCC_CORE}" |
82 | tar -xvjf "${GCC_CORE}" |
83 | check_error $? "Error unpacking GCC Core." |
83 | check_error $? "Error unpacking GCC Core." |
84 | tar -xvjf "${GCC_OBJC}" |
84 | tar -xvjf "${GCC_OBJC}" |
85 | check_error $? "Error unpacking GCC Objective C." |
85 | check_error $? "Error unpacking GCC Objective C." |
86 | tar -xvjf "${GCC_CPP}" |
86 | tar -xvjf "${GCC_CPP}" |
87 | check_error $? "Error unpacking GCC C++." |
87 | check_error $? "Error unpacking GCC C++." |
88 | 88 | ||
89 | echo ">>> Compiling and installing binutils" |
89 | echo ">>> Compiling and installing binutils" |
90 | cd "${BINUTILSDIR}" |
90 | cd "${BINUTILSDIR}" |
91 | check_error $? "Change directory failed." |
91 | check_error $? "Change directory failed." |
92 | ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" "--disable-nls" |
92 | ./configure "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" "--disable-nls" |
93 | check_error $? "Error configuring binutils." |
93 | check_error $? "Error configuring binutils." |
94 | make all install |
94 | make all install |
95 | check_error $? "Error compiling/installing binutils." |
95 | check_error $? "Error compiling/installing binutils." |
96 | 96 | ||
97 | echo ">>> Compiling and installing GCC" |
97 | echo ">>> Compiling and installing GCC" |
98 | cd "${OBJDIR}" |
98 | cd "${OBJDIR}" |
99 | check_error $? "Change directory failed." |
99 | check_error $? "Change directory failed." |
100 | "${GCCDIR}/configure" "--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 |
100 | "${GCCDIR}/configure" "--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 |
101 | check_error $? "Error configuring GCC." |
101 | check_error $? "Error configuring GCC." |
102 | PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc |
102 | PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc |
103 | check_error $? "Error compiling/installing GCC." |
103 | check_error $? "Error compiling/installing GCC." |
104 | 104 | ||
105 | echo |
105 | echo |
106 | echo ">>> Cross-compiler for ${TARGET} installed." |
106 | echo ">>> Cross-compiler for ${TARGET} installed." |
107 | 107 |