1 |
< |
### RPM external gcc 4.6.0 |
1 |
> |
### RPM external gcc 4.6.1 |
2 |
|
## INITENV +PATH LD_LIBRARY_PATH %i/lib/32 |
3 |
|
## INITENV +PATH LD_LIBRARY_PATH %i/lib64 |
4 |
< |
%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 |
4 |
> |
Source0: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%realversion/%n-%realversion.tar.bz2 |
5 |
|
# For gcc version >= 4.0.0, a number of additional sources are needed. |
6 |
< |
%define gmpVersion 4.3.2 |
7 |
< |
%define mpfrVersion 2.4.2 |
8 |
< |
%define mpcVersion 0.8.1 |
6 |
> |
%define gmpVersion 5.0.2 |
7 |
> |
%define mpfrVersion 3.0.1 |
8 |
> |
%define mpcVersion 0.9 |
9 |
|
Source1: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmpVersion}.tar.bz2 |
10 |
|
Source2: http://www.mpfr.org/mpfr-%{mpfrVersion}/mpfr-%{mpfrVersion}.tar.bz2 |
11 |
|
Source3: http://www.multiprecision.org/mpc/download/mpc-%{mpcVersion}.tar.gz |
13 |
|
# For gcc 4.5+ we need the additional tools ppl and cloog. |
14 |
|
%define gcc_45plus %(echo %realversion | sed -e 's|4[.][5-9].*|true|') |
15 |
|
%if "%{gcc_45plus}" == "true" |
16 |
< |
%define pplVersion 0.11 |
17 |
< |
%define cloogVersion 0.16.1 |
16 |
> |
%define pplVersion 0.11.2 |
17 |
> |
%define cloogVersion 0.16.2 |
18 |
|
Source4: http://www.cs.unipr.it/ppl/Download/ftp/releases/%{pplVersion}/ppl-%{pplVersion}.tar.bz2 |
19 |
|
Source5: ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-%{cloogVersion}.tar.gz |
20 |
|
%endif |
24 |
|
%if "%use_custom_binutils" == "true" |
25 |
|
%define bisonVersion 2.4 |
26 |
|
Source6: http://ftp.gnu.org/gnu/bison/bison-%{bisonVersion}.tar.bz2 |
27 |
< |
%define binutilsv 2.21.51.0.8 |
27 |
> |
%define binutilsv 2.21.53.0.2 |
28 |
|
#Source7: http://ftp.gnu.org/gnu/binutils/binutils-%binutilsv.tar.bz2 |
29 |
|
Source7: http://www.kernel.org/pub/linux/devel/binutils/binutils-%binutilsv.tar.bz2 |
30 |
|
%endif |
39 |
|
%if "%isslc" == "true" |
40 |
|
Source8: ftp://sources.redhat.com/pub/systemtap/elfutils/elfutils-%{elfutilsVersion}.tar.gz |
41 |
|
%endif |
42 |
+ |
Patch0: gcc-4.6.1-ignore-arch-flags-macosx |
43 |
+ |
# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49540 |
44 |
+ |
Patch1: gcc-4.6.1-fix-gfortran-regression |
45 |
|
|
46 |
|
%prep |
47 |
|
echo "use_custom_binutils: %use_custom_binutils" |
48 |
|
%setup -T -b 0 -n gcc-%realversion |
49 |
< |
|
49 |
> |
# Get the macosx build to accept -arch, -F options like the official Apple one. |
50 |
> |
# Notice that patch command have to stay on a single line. |
51 |
|
case %cmsos in |
52 |
< |
# Hack to always have -m32 in the 32bit compiler, even when it's built on a 64 |
53 |
< |
# bit architecture. |
52 |
< |
slc*_ia32 ) |
53 |
< |
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 |
< |
#undef ASM_SPEC |
61 |
< |
#define ASM_SPEC "%%{v:-V} %%{Qy:} %%{!Qn:-Qy} %%{n} %%{T} %%{Ym,*} %%{Yd,*} %%{Wa,*:%%*} --32" |
62 |
< |
#undef CC1_SPEC |
63 |
< |
#define CC1_SPEC "%%(cc1_cpu) %%{profile:-p} -m32" |
64 |
< |
#undef CC1PLUS_SPEC |
65 |
< |
#define CC1PLUS_SPEC "-m32" |
66 |
< |
#undef MULTILIB_DEFAULTS |
67 |
< |
#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 |
52 |
> |
osx*) |
53 |
> |
%patch0 -p1 |
54 |
|
;; |
55 |
+ |
esac |
56 |
+ |
%patch1 -p0 |
57 |
+ |
|
58 |
+ |
case %cmsos in |
59 |
|
slc*_amd64 ) |
60 |
|
# Hack needed to align sections to 4096 bytes rather than 2MB on 64bit linux |
61 |
|
# architectures. This is done to reduce the amount of address space wasted by |
102 |
|
%endif |
103 |
|
|
104 |
|
%build |
105 |
< |
|
123 |
< |
# 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. |
105 |
> |
# On mac we need to use gcc-proper, not gcc-llvm |
106 |
|
case %{cmsos} in |
107 |
< |
slc*_ia32) |
108 |
< |
CCOPTS="-fPIC -m32 -Wa,--32" ;; |
107 |
> |
osx*) |
108 |
> |
CC=/usr/bin/gcc-4.2 |
109 |
> |
CXX=/usr/bin/c++-4.2 |
110 |
> |
CPP=/usr/bin/cpp-4.2 |
111 |
> |
ADDITIONAL_LANGUAGES=,objc,obj-c++ |
112 |
> |
;; |
113 |
|
*) |
114 |
< |
CCOPTS="-fPIC" ;; |
114 |
> |
CC=gcc |
115 |
> |
CXX=c++ |
116 |
> |
CPP=cpp |
117 |
> |
;; |
118 |
|
esac |
119 |
|
|
120 |
+ |
CC="$CC -fPIC" |
121 |
+ |
CXX="$CXX -fPIC" |
122 |
+ |
|
123 |
|
# Whenever we build custom binutils we also enable the new linker "gold". |
124 |
|
# We do so only if we are using the new gcc 4.5+ |
125 |
|
if [ "X%use_custom_binutils:%gcc_45plus" = Xtrue:true ] ; then |
126 |
< |
CONF_BINUTILS_OPTS="--enable-gold --enable-lto --enable-plugins --enable-threads" |
126 |
> |
CONF_BINUTILS_OPTS="--enable-gold=default --enable-lto --enable-plugins --enable-threads" |
127 |
|
fi |
128 |
|
|
140 |
– |
USER_CXX=$CCOPTS |
141 |
– |
|
129 |
|
# Build libelf. |
130 |
|
if [ "X%isslc" = Xtrue ]; then |
131 |
|
cd ../elfutils-%{elfutilsVersion} |
132 |
< |
./configure --prefix=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
132 |
> |
./configure --prefix=%i CC="$CC" CXX="$CXX" CPP="$CPP" |
133 |
|
make %makeprocesses |
134 |
|
make install |
135 |
|
fi |
142 |
|
if [ "X%use_custom_binutils" = Xtrue ] |
143 |
|
then |
144 |
|
cd ../bison-%{bisonVersion} |
145 |
< |
CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/bison |
145 |
> |
CC="$CC" ./configure --prefix=%i/tmp/bison |
146 |
|
make %makeprocesses |
147 |
|
make install |
148 |
|
export PATH=%i/tmp/bison/bin:$PATH |
149 |
|
cd ../binutils-%{binutilsv} |
150 |
< |
# Try to avoid dependency on makeinfo. |
151 |
< |
perl -p -i -e 's|SUBDIRS = .*|SUBDIRS =|' bfd/Makefile.in binutils/Makefile.in |
150 |
> |
# Try to avoid dependency on makeinfo by forcing make not |
151 |
> |
# to build the documentation. |
152 |
> |
perl -p -i -e 's|SUBDIRS = .*|SUBDIRS =|' bfd/Makefile.in binutils/Makefile.in gas/Makefile.in |
153 |
|
perl -p -i -e 's|all: info|all:|' etc/Makefile.in |
154 |
+ |
perl -p -i -e 's|TEXINFOS =.*|TEXINFOS =|;s|INFO_DEPS =.*|INFO_DEPS =|' gprof/Makefile.in |
155 |
+ |
perl -p -i -e 's|man_MANS =.*|man_MANS =|' gprof/Makefile.in |
156 |
+ |
perl -p -i -e 's|INFO_DEPS =.*|INFO_DEPS =|' ld/Makefile.in |
157 |
+ |
perl -p -i -e 's|INFOFILES =.*|INFOFILES =|' etc/Makefile.in |
158 |
+ |
perl -p -i -e 's|DVIFILES =.*|DVIFILES =|' etc/Makefile.in |
159 |
+ |
perl -p -i -e 's|PDFFILES =.*|PDFFILES =|' etc/Makefile.in |
160 |
+ |
perl -p -i -e 's|HTMLFILES =.*|HTMLFILES =|' etc/Makefile.in |
161 |
|
|
162 |
< |
./configure --prefix=%i ${CONF_BINUTILS_OPTS} \ |
163 |
< |
CC="gcc $CCOPTS" CFLAGS="-I%i/include" \ |
162 |
> |
./configure --prefix=%i ${CONF_BINUTILS_OPTS} --disable-werror \ |
163 |
> |
CC="$CC" CXX="$CXX" CPP="$CPP" CFLAGS="-I%i/include" \ |
164 |
|
CXXFLAGS="-I%i/include" LDFLAGS="-L%i/lib" |
165 |
|
make %makeprocesses |
166 |
|
find . -name Makefile -exec perl -p -i -e 's|LN = ln|LN = cp -p|;s|ln ([^-])|cp -p $1|g' {} \; |
170 |
|
|
171 |
|
# Build GMP/MPFR/MPC |
172 |
|
cd ../gmp-%{gmpVersion} |
173 |
< |
./configure --prefix=%i --enable-shared --disable-static --enable-cxx CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
173 |
> |
./configure --prefix=%i --enable-shared --disable-static --enable-cxx CC="$CC" CXX="$CXX" CPP="$CPP" |
174 |
|
make %makeprocesses |
175 |
|
make install |
176 |
|
|
177 |
|
cd ../mpfr-%{mpfrVersion} |
178 |
< |
./configure --prefix=%i --with-gmp=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
178 |
> |
./configure --prefix=%i --with-gmp=%i CC="$CC" CXX="$CXX" CPP="$CPP" |
179 |
|
make %makeprocesses |
180 |
|
make install |
181 |
|
|
182 |
|
cd ../mpc-%{mpcVersion} |
183 |
< |
./configure --prefix=%i --with-gmp=%i --with-mpfr=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
183 |
> |
./configure --prefix=%i --with-gmp=%i --with-mpfr=%i CC="$CC" CXX="$CXX" CPP="$CPP" |
184 |
|
make %makeprocesses |
185 |
|
make install |
186 |
|
CONF_GCC_VERSION_OPTS="--with-gmp=%i --with-mpfr=%i --with-mpc=%i" |
188 |
|
# Build additional stuff for gcc 4.5+ |
189 |
|
if [ "X%gcc_45plus" = Xtrue ]; then |
190 |
|
cd ../ppl-%{pplVersion} |
191 |
< |
./configure --prefix=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
191 |
> |
./configure --prefix=%i CC="$CC" CXX="$CXX" CPP="$CPP" |
192 |
|
make %makeprocesses |
193 |
|
make install |
194 |
|
|
195 |
|
cd ../cloog-%{cloogVersion} |
196 |
< |
./configure --prefix=%i --with-ppl=%i --with-gmp=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
196 |
> |
./configure --prefix=%i --with-ppl=%i --with-gmp-prefix=%i CC="$CC" CXX="$CXX" CPP="$CPP" |
197 |
|
make %makeprocesses |
198 |
|
make install |
199 |
|
|
207 |
|
export LD_LIBRARY_PATH=%i/lib64:%i/lib:$LD_LIBRARY_PATH |
208 |
|
../configure --prefix=%i \ |
209 |
|
--enable-gold=yes --enable-lto --with-build-config=bootstrap-lto \ |
210 |
< |
--enable-languages=c,c++,fortran \ |
211 |
< |
$CONF_GCC_VERSION_OPTS --enable-shared CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
210 |
> |
--enable-languages=c,c++,fortran$ADDITIONAL_LANGUAGES \ |
211 |
> |
$CONF_GCC_VERSION_OPTS --enable-shared CC="$CC" CXX="$CXX" CPP="$CPP" |
212 |
|
|
213 |
|
make %makeprocesses bootstrap |
214 |
|
make install |
217 |
|
cd %_builddir/gcc-%{realversion}/obj && make install |
218 |
|
|
219 |
|
ln -s gcc %i/bin/cc |
220 |
< |
find %i/lib %i/lib32 %i/lib64 -name '*.la' -exec rm -f {} \; || true |
220 |
> |
find %i/lib %i/lib64 -name '*.la' -exec rm -f {} \; || true |
221 |
|
# SCRAM ToolBox toolfile is now geneated by the gcc-toolfile.spec |
222 |
|
# so that everything works even in the case "--use-system-compiler" |
223 |
|
# option is specified. |