1 |
elmer |
1.67 |
### RPM external gcc 4.6.0
|
2 |
eulisse |
1.3 |
## INITENV +PATH LD_LIBRARY_PATH %i/lib/32
|
3 |
eulisse |
1.16 |
## INITENV +PATH LD_LIBRARY_PATH %i/lib64
|
4 |
elmer |
1.71 |
%define realversion 4.6-20110429
|
5 |
|
|
#Source0: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%realversion/%n-%realversion.tar.bz2
|
6 |
|
|
Source0: http://gcc.cybermirror.org/snapshots/%realversion/%n-%realversion.tar.bz2
|
7 |
elmer |
1.70 |
# For gcc version >= 4.0.0, a number of additional sources are needed.
|
8 |
eulisse |
1.59 |
%define gmpVersion 4.3.2
|
9 |
|
|
%define mpfrVersion 2.4.2
|
10 |
elmer |
1.56 |
%define mpcVersion 0.8.1
|
11 |
eulisse |
1.46 |
Source1: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmpVersion}.tar.bz2
|
12 |
|
|
Source2: http://www.mpfr.org/mpfr-%{mpfrVersion}/mpfr-%{mpfrVersion}.tar.bz2
|
13 |
elmer |
1.56 |
Source3: http://www.multiprecision.org/mpc/download/mpc-%{mpcVersion}.tar.gz
|
14 |
eulisse |
1.63 |
|
15 |
|
|
# For gcc 4.5+ we need the additional tools ppl and cloog.
|
16 |
|
|
%define gcc_45plus %(echo %realversion | sed -e 's|4[.][5-9].*|true|')
|
17 |
|
|
%if "%{gcc_45plus}" == "true"
|
18 |
elmer |
1.67 |
%define pplVersion 0.11
|
19 |
|
|
%define cloogVersion 0.16.1
|
20 |
|
|
Source4: http://www.cs.unipr.it/ppl/Download/ftp/releases/%{pplVersion}/ppl-%{pplVersion}.tar.bz2
|
21 |
|
|
Source5: ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-%{cloogVersion}.tar.gz
|
22 |
eulisse |
1.63 |
%endif
|
23 |
eulisse |
1.18 |
|
24 |
eulisse |
1.63 |
# On 64bit Scientific Linux build our own binutils.
|
25 |
|
|
%define use_custom_binutils %(echo %cmsos | sed -e 's|slc[0-9]*_amd64|true|')
|
26 |
|
|
%if "%use_custom_binutils" == "true"
|
27 |
|
|
%define bisonVersion 2.4
|
28 |
elmer |
1.60 |
Source6: http://ftp.gnu.org/gnu/bison/bison-%{bisonVersion}.tar.bz2
|
29 |
elmer |
1.72 |
%define binutilsv 2.21.51.0.8
|
30 |
|
|
#Source7: http://ftp.gnu.org/gnu/binutils/binutils-%binutilsv.tar.bz2
|
31 |
|
|
Source7: http://www.kernel.org/pub/linux/devel/binutils/binutils-%binutilsv.tar.bz2
|
32 |
elmer |
1.57 |
%endif
|
33 |
|
|
|
34 |
eulisse |
1.65 |
# gcc 4.5+ link time optimization support requires libelf to work. However
|
35 |
|
|
# also rpm requires it. In order to have to duplicate dependencies we
|
36 |
|
|
# build it in gcc and we pick it up from there also for rpm. Notice that
|
37 |
|
|
# libelf does not work on Macosx however this is not a problem until
|
38 |
|
|
# we use the system compiler there.
|
39 |
|
|
%define isslc %(echo %cmsos | sed -e 's|slc.*|true|')
|
40 |
|
|
%define elfutilsVersion 0.131
|
41 |
|
|
%if "%isslc" == "true"
|
42 |
|
|
Source8: ftp://sources.redhat.com/pub/systemtap/elfutils/elfutils-%{elfutilsVersion}.tar.gz
|
43 |
|
|
%endif
|
44 |
|
|
|
45 |
eulisse |
1.16 |
%prep
|
46 |
eulisse |
1.63 |
echo "use_custom_binutils: %use_custom_binutils"
|
47 |
|
|
%setup -T -b 0 -n gcc-%realversion
|
48 |
dlange |
1.15 |
|
49 |
elmer |
1.43 |
case %cmsos in
|
50 |
eulisse |
1.63 |
# Hack to always have -m32 in the 32bit compiler, even when it's built on a 64
|
51 |
|
|
# bit architecture.
|
52 |
muzaffar |
1.53 |
slc*_ia32 )
|
53 |
eulisse |
1.16 |
cat << \EOF_CONFIG_GCC >> gcc/config.gcc
|
54 |
|
|
# CMS patch to include gcc/config/i386/t-cms when building gcc
|
55 |
|
|
tm_file="$tm_file i386/cms.h"
|
56 |
|
|
tmake_file="$tmake_file i386/t-cms"
|
57 |
|
|
EOF_CONFIG_GCC
|
58 |
|
|
|
59 |
|
|
cat << \EOF_CMS_H > gcc/config/i386/cms.h
|
60 |
eulisse |
1.20 |
#undef ASM_SPEC
|
61 |
eulisse |
1.16 |
#define ASM_SPEC "%%{v:-V} %%{Qy:} %%{!Qn:-Qy} %%{n} %%{T} %%{Ym,*} %%{Yd,*} %%{Wa,*:%%*} --32"
|
62 |
eulisse |
1.20 |
#undef CC1_SPEC
|
63 |
eulisse |
1.16 |
#define CC1_SPEC "%%(cc1_cpu) %%{profile:-p} -m32"
|
64 |
eulisse |
1.20 |
#undef CC1PLUS_SPEC
|
65 |
eulisse |
1.16 |
#define CC1PLUS_SPEC "-m32"
|
66 |
eulisse |
1.20 |
#undef MULTILIB_DEFAULTS
|
67 |
eulisse |
1.16 |
#define MULTILIB_DEFAULTS { "m32" }
|
68 |
|
|
EOF_CMS_H
|
69 |
|
|
|
70 |
|
|
cat << \EOF_T_CMS > gcc/config/i386/t-cms
|
71 |
|
|
MULTILIB_OPTIONS = m32
|
72 |
|
|
MULTILIB_DIRNAMES = ../lib
|
73 |
|
|
MULTILIB_MATCHES = m32=m32
|
74 |
|
|
EOF_T_CMS
|
75 |
elmer |
1.43 |
;;
|
76 |
eulisse |
1.62 |
slc*_amd64 )
|
77 |
eulisse |
1.63 |
# Hack needed to align sections to 4096 bytes rather than 2MB on 64bit linux
|
78 |
|
|
# architectures. This is done to reduce the amount of address space wasted by
|
79 |
|
|
# relocating many libraries. This was done with a linker script before, but
|
80 |
|
|
# this approach seems to be more correct.
|
81 |
eulisse |
1.62 |
cat << \EOF_CONFIG_GCC >> gcc/config.gcc
|
82 |
|
|
# CMS patch to include gcc/config/i386/t-cms when building gcc
|
83 |
|
|
tm_file="$tm_file i386/cms.h"
|
84 |
|
|
EOF_CONFIG_GCC
|
85 |
|
|
|
86 |
|
|
cat << \EOF_CMS_H > gcc/config/i386/cms.h
|
87 |
|
|
#undef LINK_SPEC
|
88 |
|
|
#define LINK_SPEC "%{" SPEC_64 ":-m elf_x86_64} %{" SPEC_32 ":-m elf_i386} \
|
89 |
|
|
%{shared:-shared} \
|
90 |
|
|
%{!shared: \
|
91 |
|
|
%{!static: \
|
92 |
|
|
%{rdynamic:-export-dynamic} \
|
93 |
|
|
%{" SPEC_32 ":%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER32 "}} \
|
94 |
|
|
%{" SPEC_64 ":%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER64 "}}} \
|
95 |
|
|
%{static:-static}} -z common-page-size=4096 -z max-page-size=4096"
|
96 |
|
|
EOF_CMS_H
|
97 |
|
|
;;
|
98 |
elmer |
1.43 |
esac
|
99 |
dlange |
1.15 |
|
100 |
eulisse |
1.63 |
%if "%{use_custom_binutils}" == "true"
|
101 |
elmer |
1.60 |
%setup -D -T -b 6 -n bison-%{bisonVersion}
|
102 |
|
|
%setup -D -T -b 7 -n binutils-%binutilsv
|
103 |
eulisse |
1.46 |
%endif
|
104 |
|
|
|
105 |
eulisse |
1.63 |
# These are required for any gcc 4.x build.
|
106 |
eulisse |
1.46 |
%setup -D -T -b 1 -n gmp-%{gmpVersion}
|
107 |
|
|
%setup -D -T -b 2 -n mpfr-%{mpfrVersion}
|
108 |
elmer |
1.56 |
%setup -D -T -b 3 -n mpc-%{mpcVersion}
|
109 |
eulisse |
1.63 |
|
110 |
|
|
# For gcc 4.5 and later we also need the following.
|
111 |
|
|
%if "%gcc_45plus" == "true"
|
112 |
elmer |
1.57 |
%setup -D -T -b 4 -n ppl-%{pplVersion}
|
113 |
elmer |
1.67 |
%setup -D -T -b 5 -n cloog-%{cloogVersion}
|
114 |
eulisse |
1.63 |
%endif
|
115 |
eulisse |
1.65 |
|
116 |
|
|
# These are required by rpm as well, but only on linux.
|
117 |
|
|
%if "%isslc" == "true"
|
118 |
|
|
%setup -D -T -b 8 -n elfutils-%{elfutilsVersion}
|
119 |
|
|
%endif
|
120 |
|
|
|
121 |
eulisse |
1.63 |
%build
|
122 |
eulisse |
1.18 |
|
123 |
eulisse |
1.20 |
# Set special variables required to build 32-bit executables on 64-bit
|
124 |
|
|
# systems. Note that if the architecture is SLC4/IA32, we may be on a
|
125 |
|
|
# 64-bit system and need to produce a 32-bit capable compiler, which
|
126 |
|
|
# _itself_ is a 32-bit executable.
|
127 |
eulisse |
1.63 |
case %{cmsos} in
|
128 |
|
|
slc*_ia32)
|
129 |
eulisse |
1.59 |
CCOPTS="-fPIC -m32 -Wa,--32" ;;
|
130 |
eulisse |
1.63 |
*)
|
131 |
eulisse |
1.59 |
CCOPTS="-fPIC" ;;
|
132 |
eulisse |
1.20 |
esac
|
133 |
eulisse |
1.59 |
|
134 |
eulisse |
1.63 |
# Whenever we build custom binutils we also enable the new linker "gold".
|
135 |
|
|
# We do so only if we are using the new gcc 4.5+
|
136 |
|
|
if [ "X%use_custom_binutils:%gcc_45plus" = Xtrue:true ] ; then
|
137 |
elmer |
1.72 |
CONF_BINUTILS_OPTS="--enable-gold --enable-lto --enable-plugins --enable-threads"
|
138 |
eulisse |
1.63 |
fi
|
139 |
|
|
|
140 |
eulisse |
1.59 |
USER_CXX=$CCOPTS
|
141 |
|
|
|
142 |
eulisse |
1.65 |
# Build libelf.
|
143 |
|
|
if [ "X%isslc" = Xtrue ]; then
|
144 |
|
|
cd ../elfutils-%{elfutilsVersion}
|
145 |
|
|
./configure --prefix=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX"
|
146 |
|
|
make %makeprocesses
|
147 |
|
|
make install
|
148 |
|
|
fi
|
149 |
|
|
|
150 |
eulisse |
1.63 |
# If requested, build our own binutils. Currently the default is to use the
|
151 |
|
|
# system binutils on 32bit platforms and our own on 64 bit ones.
|
152 |
|
|
# FIXME: Notice that this copy is actually built using the system compiler, so
|
153 |
|
|
# we chances are we will need to rebuild it later on to make sure they get
|
154 |
|
|
# linked against our libstdc++ (required by gold).
|
155 |
|
|
if [ "X%use_custom_binutils" = Xtrue ]
|
156 |
|
|
then
|
157 |
|
|
cd ../bison-%{bisonVersion}
|
158 |
|
|
CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/bison
|
159 |
|
|
make %makeprocesses
|
160 |
|
|
make install
|
161 |
|
|
export PATH=%i/tmp/bison/bin:$PATH
|
162 |
|
|
cd ../binutils-%{binutilsv}
|
163 |
eulisse |
1.73 |
# Try to avoid dependency on makeinfo.
|
164 |
|
|
perl -p -i -e 's|SUBDIRS = .*|SUBDIRS =|' bfd/Makefile.in binutils/Makefile.in
|
165 |
|
|
perl -p -i -e 's|all: info|all:|' etc/Makefile.in
|
166 |
|
|
|
167 |
eulisse |
1.65 |
./configure --prefix=%i ${CONF_BINUTILS_OPTS} \
|
168 |
|
|
CC="gcc $CCOPTS" CFLAGS="-I%i/include" \
|
169 |
|
|
CXXFLAGS="-I%i/include" LDFLAGS="-L%i/lib"
|
170 |
eulisse |
1.63 |
make %makeprocesses
|
171 |
|
|
find . -name Makefile -exec perl -p -i -e 's|LN = ln|LN = cp -p|;s|ln ([^-])|cp -p $1|g' {} \;
|
172 |
|
|
make install
|
173 |
|
|
which ld
|
174 |
|
|
fi
|
175 |
eulisse |
1.16 |
|
176 |
eulisse |
1.63 |
# Build GMP/MPFR/MPC
|
177 |
eulisse |
1.19 |
cd ../gmp-%{gmpVersion}
|
178 |
eulisse |
1.59 |
./configure --prefix=%i --enable-shared --disable-static --enable-cxx CC="gcc $CCOPTS" CXX="c++ $USER_CXX"
|
179 |
eulisse |
1.19 |
make %makeprocesses
|
180 |
eulisse |
1.20 |
make install
|
181 |
eulisse |
1.19 |
|
182 |
|
|
cd ../mpfr-%{mpfrVersion}
|
183 |
eulisse |
1.59 |
./configure --prefix=%i --with-gmp=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX"
|
184 |
eulisse |
1.19 |
make %makeprocesses
|
185 |
eulisse |
1.31 |
make install
|
186 |
elmer |
1.56 |
|
187 |
|
|
cd ../mpc-%{mpcVersion}
|
188 |
eulisse |
1.59 |
./configure --prefix=%i --with-gmp=%i --with-mpfr=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX"
|
189 |
elmer |
1.56 |
make %makeprocesses
|
190 |
|
|
make install
|
191 |
eulisse |
1.63 |
CONF_GCC_VERSION_OPTS="--with-gmp=%i --with-mpfr=%i --with-mpc=%i"
|
192 |
elmer |
1.56 |
|
193 |
eulisse |
1.63 |
# Build additional stuff for gcc 4.5+
|
194 |
|
|
if [ "X%gcc_45plus" = Xtrue ]; then
|
195 |
|
|
cd ../ppl-%{pplVersion}
|
196 |
|
|
./configure --prefix=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX"
|
197 |
|
|
make %makeprocesses
|
198 |
|
|
make install
|
199 |
|
|
|
200 |
elmer |
1.67 |
cd ../cloog-%{cloogVersion}
|
201 |
eulisse |
1.63 |
./configure --prefix=%i --with-ppl=%i --with-gmp=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX"
|
202 |
|
|
make %makeprocesses
|
203 |
|
|
make install
|
204 |
elmer |
1.57 |
|
205 |
elmer |
1.67 |
CONF_GCC_VERSION_OPTS="$CONF_GCC_VERSION_OPTS --with-ppl=%i --with-cloog=%i --enable-cloog-backend=isl"
|
206 |
eulisse |
1.63 |
fi
|
207 |
eulisse |
1.19 |
|
208 |
eulisse |
1.20 |
# Build the compilers
|
209 |
elmer |
1.58 |
cd ../gcc-%realversion
|
210 |
eulisse |
1.18 |
mkdir -p obj
|
211 |
|
|
cd obj
|
212 |
eulisse |
1.59 |
export LD_LIBRARY_PATH=%i/lib64:%i/lib:$LD_LIBRARY_PATH
|
213 |
eulisse |
1.20 |
../configure --prefix=%i \
|
214 |
elmer |
1.72 |
--enable-gold=yes --enable-lto --with-build-config=bootstrap-lto \
|
215 |
eulisse |
1.63 |
--enable-languages=c,c++,fortran \
|
216 |
|
|
$CONF_GCC_VERSION_OPTS --enable-shared CC="gcc $CCOPTS" CXX="c++ $USER_CXX"
|
217 |
eulisse |
1.18 |
|
218 |
|
|
make %makeprocesses bootstrap
|
219 |
eulisse |
1.63 |
make install
|
220 |
eulisse |
1.16 |
|
221 |
argiro |
1.1 |
%install
|
222 |
elmer |
1.58 |
cd %_builddir/gcc-%{realversion}/obj && make install
|
223 |
eulisse |
1.51 |
|
224 |
argiro |
1.1 |
ln -s gcc %i/bin/cc
|
225 |
eulisse |
1.20 |
find %i/lib %i/lib32 %i/lib64 -name '*.la' -exec rm -f {} \; || true
|
226 |
eulisse |
1.40 |
# SCRAM ToolBox toolfile is now geneated by the gcc-toolfile.spec
|
227 |
|
|
# so that everything works even in the case "--use-system-compiler"
|
228 |
|
|
# option is specified.
|