[r142]: do-gcc.sh  Maximize  Restore  History

Download this file

176 lines (141 with data), 4.6 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/bin/sh
# This work is partially financed by the European Commission under the
# Framework 6 Information Society Technologies Project
# "Wirelessly Accessible Sensor Populations (WASP)".
#The following versions of GCC have been tested:
#3.2.3 (patch directory gcc-3.3)
#3.3.6 (patch directory gcc-3.4, additional configure.in patch involved)
#4.2.4
#4.3.4 (GMP 4.3.1; MPFR 2.4.1)
# source helper functions:
. ./buildgcc.subr
set -eu
VERSION_TAG=$(cat _version_tag.txt)
GCC_VERSION="4.3.4"
GCC_PATCH_FOLDER="gcc-4.x"
GMP_VERSION="4.3.1"
MPFR_VERSION="2.4.1"
GNU_MIRROR="http://ftp.uni-kl.de"
BUILD_DIR="build"
INITIAL_DIR="$(pwd)"
FETCH_ONLY=0
NO_FETCH=0
case "$(uname -s)" in
MINGW*) MINGW=1 ;;
*) MINGW=0 ;;
esac
WIN32_OPTS=
if [ $MINGW = 1 ]; then
WIN32_OPTS=--enable-win32-registry=MSP430-GCC-$VERSION_TAG
fi
if [ $# = 0 ]; then
echo "Usage: do-gcc.sh <toolchain target dir> [<gcc_version>] [<GNU mirror site>] [<build dir>] [<GCC patch folder>] [<GMP version>] [<MPFR version>] [--fetch-only/--no-fetch]"
echo "Example: do-gcc.sh /opt/msp430-gcc-latest $GCC_VERSION $GNU_MIRROR build $GCC_PATCH_FOLDER $GMP_VERSION $MPFR_VERSION"
echo "Specify '-' instead of GMP/MPFR version to skip downloading it"
exit 1
fi
TARGET_LOCATION="$1" ; shift
if [ $# -ge 1 ] ; then GCC_VERSION="$1" ; shift ; fi
if [ $# -ge 1 ] ; then GNU_MIRROR="$1" ; shift ; fi
if [ $# -ge 1 ] ; then BUILD_DIR="$1" ; shift ; fi
if [ $# -ge 1 ] ; then GCC_PATCH_FOLDER="$1" ; shift ; fi
if [ $# -ge 1 ] ; then GMP_VERSION="$1" ; shift ; fi
if [ $# -ge 1 ] ; then MPFR_VERSION="$1" ; shift ; fi
while [ $# -ge 1 ] ; do
case "$1" in
--fetch-only) FETCH_ONLY=1 ;;
--no-fetch) NO_FETCH=1 ;;
*) echo "Unknown options $@. Abort." ; exit 1 ;;
esac
shift
done
INSTALL_LAUNCHER="$(sh do-detect-sudo.sh "$TARGET_LOCATION")"
GNUMAKE=$(find_gnumake)
if [ -z "$GNUMAKE" ] ; then
echo >&2 "GNU make not found, aborting!"
exit 1
fi
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
export PATH="$PATH:$TARGET_LOCATION/bin"
TARGET_LOCATION_SED="$(echo $TARGET_LOCATION | sed -e "s,/,\\\\,g")"
if [ $NO_FETCH != 1 ]; then
rm -rf mspgcc
mkdir -p mspgcc
cd mspgcc
if [ $GCC_PATCH_FOLDER != gcc-4.x ]; then
cvs -z3 -d:pserver:anonymous@mspgcc.cvs.sourceforge.net:/cvsroot/mspgcc co -P gcc
else
mkdir gcc
fi
if [ -e "$INITIAL_DIR/ports/gcc-4.x" ]
then
echo "Copying gcc-4.x port"
cp -r "$INITIAL_DIR/ports/gcc-4.x" gcc
fi
if [ -e "$INITIAL_DIR/msp$GCC_PATCH_FOLDER.patch" ]
then
cd "gcc/$GCC_PATCH_FOLDER"
patch -p1 < "$INITIAL_DIR/msp$GCC_PATCH_FOLDER.patch"
cd ../..
fi
cd ..
wget -c \
"$GNU_MIRROR/pub/gnu/gcc/gcc-$GCC_VERSION/gcc-core-$GCC_VERSION.tar.bz2" \
"$GNU_MIRROR/pub/gnu/gcc/gcc-$GCC_VERSION/gcc-g++-$GCC_VERSION.tar.bz2"\
"$GNU_MIRROR/pub/gnu/gmp/gmp-$GMP_VERSION.tar.bz2"
if [ x"$MPFR_VERSION" != x"-" ]; then
# server doesn't support continuing (-c), but timestamping.
# Let's use -N to avoid pointless re-downloading.
wget -N "http://www.mpfr.org/mpfr-$MPFR_VERSION/mpfr-$MPFR_VERSION.tar.bz2"
fi
fi
if [ $FETCH_ONLY = 1 ]; then
echo "GCC $GCC_VERSION downloaded successfully"
exit 0
fi
echo "Unpacking GCC..."
tar xjf "gcc-core-$GCC_VERSION.tar.bz2"
tar xjf "gcc-g++-$GCC_VERSION.tar.bz2"
cd "gcc-$GCC_VERSION"
if [ -e "$INITIAL_DIR/gcc-$GCC_VERSION.patch" ]
then
patch -p1 < "$INITIAL_DIR/gcc-$GCC_VERSION.patch"
fi
if [ x"$GMP_VERSION" != x"-" ]; then
tar xjf "../gmp-$GMP_VERSION.tar.bz2"
rm -rf gmp
mv "gmp-$GMP_VERSION" gmp
fi
if [ x"$MPFR_VERSION" != x"-" ]; then
echo "Unpacking MPFR..."
tar xjf "../mpfr-$MPFR_VERSION.tar.bz2"
rm -rf mpfr
mv "mpfr-$MPFR_VERSION" mpfr
if [ $MINGW = 1 ]; then
echo "echo \"#!/bin/sh\" > libtool" >> mpfr/configure
echo "echo \"/bin/libtool \\\"\\\$@\\\"\" >> libtool" >> mpfr/configure
fi
fi
cp -rf ../mspgcc/gcc/"$GCC_PATCH_FOLDER"/* .
cd ..
mkdir -p "gcc-$GCC_VERSION-build"
cd "gcc-$GCC_VERSION-build"
if [ $MINGW = 1 ]; then
"$(pwd -W)/../gcc-$GCC_VERSION/configure" --prefix="$TARGET_LOCATION" --target=msp430 --enable-languages=c,c++ $WIN32_OPTS --disable-nls --with-pkgversion="MSPGCC4_$VERSION_TAG"
GNUMAKE=mingw32-make
else
"$(pwd)/../gcc-$GCC_VERSION/configure" --prefix="$TARGET_LOCATION" --target=msp430 --enable-languages=c,c++ $WIN32_OPTS --with-pkgversion="MSPGCC4_$VERSION_TAG"
fi
if [ $MINGW = 1 ]; then
../../mingw32-gccwa.pl $TARGET_LOCATION
else
$GNUMAKE -j$(num_cpus)
fi
$INSTALL_LAUNCHER $GNUMAKE install
if [ -z "${SUPPRESS_CLEAN+""}" ] ; then
cd ..
rm -rf "gcc-$GCC_VERSION-build"
rm -rf "gcc-$GCC_VERSION"
fi
cd "$INITIAL_DIR"

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks