1 |
< |
### RPM external gcc 4.6.0 |
2 |
< |
## INITENV +PATH LD_LIBRARY_PATH %i/lib/32 |
1 |
> |
### RPM external gcc 4.6.1 |
2 |
|
## INITENV +PATH LD_LIBRARY_PATH %i/lib64 |
3 |
< |
%define realversion 4.6-20110429 |
4 |
< |
#Source0: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%realversion/%n-%realversion.tar.bz2 |
5 |
< |
Source0: http://gcc.cybermirror.org/snapshots/%realversion/%n-%realversion.tar.bz2 |
3 |
> |
Source0: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%realversion/%n-%realversion.tar.bz2 |
4 |
> |
|
5 |
> |
%define keep_archives true |
6 |
> |
|
7 |
|
# For gcc version >= 4.0.0, a number of additional sources are needed. |
8 |
< |
%define gmpVersion 4.3.2 |
9 |
< |
%define mpfrVersion 2.4.2 |
10 |
< |
%define mpcVersion 0.8.1 |
8 |
> |
%define gmpVersion 5.0.2 |
9 |
> |
%define mpfrVersion 3.0.1 |
10 |
> |
%define mpcVersion 0.9 |
11 |
|
Source1: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmpVersion}.tar.bz2 |
12 |
|
Source2: http://www.mpfr.org/mpfr-%{mpfrVersion}/mpfr-%{mpfrVersion}.tar.bz2 |
13 |
|
Source3: http://www.multiprecision.org/mpc/download/mpc-%{mpcVersion}.tar.gz |
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 |
< |
%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 |
18 |
> |
%define pplVersion 0.11.2 |
19 |
> |
%define cloogVersion 0.16.2 |
20 |
> |
Source4: http://bugseng.com/products/ppl/download/ftp/releases/%{pplVersion}/ppl-%{pplVersion}.tar.bz2 |
21 |
|
Source5: ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-%{cloogVersion}.tar.gz |
22 |
|
%endif |
23 |
|
|
24 |
|
# On 64bit Scientific Linux build our own binutils. |
25 |
< |
%define use_custom_binutils %(echo %cmsos | sed -e 's|slc[0-9]*_amd64|true|') |
25 |
> |
# Notice that since we don't support building 32bit nor slc4 anymore. |
26 |
> |
%define use_custom_binutils %(case %cmsos in (slc*) echo true ;; (*) echo false ;; esac) |
27 |
|
%if "%use_custom_binutils" == "true" |
28 |
|
%define bisonVersion 2.4 |
29 |
|
Source6: http://ftp.gnu.org/gnu/bison/bison-%{bisonVersion}.tar.bz2 |
30 |
< |
%define binutilsv 2.21.51.0.8 |
31 |
< |
#Source7: http://ftp.gnu.org/gnu/binutils/binutils-%binutilsv.tar.bz2 |
32 |
< |
Source7: http://www.kernel.org/pub/linux/devel/binutils/binutils-%binutilsv.tar.bz2 |
30 |
> |
%define binutilsv 2.21.1 |
31 |
> |
Source7: http://ftp.gnu.org/gnu/binutils/binutils-%binutilsv.tar.bz2 |
32 |
> |
#Source7: http://cmsrep.cern.ch/cmssw/binutils-mirror/binutils-%binutilsv.tar.bz2 |
33 |
> |
#Source7: http://www.kernel.org/pub/linux/devel/binutils/binutils-%binutilsv.tar.bz2 |
34 |
|
%endif |
35 |
|
|
36 |
|
# gcc 4.5+ link time optimization support requires libelf to work. However |
38 |
|
# build it in gcc and we pick it up from there also for rpm. Notice that |
39 |
|
# libelf does not work on Macosx however this is not a problem until |
40 |
|
# we use the system compiler there. |
41 |
< |
%define isslc %(echo %cmsos | sed -e 's|slc.*|true|') |
42 |
< |
%define elfutilsVersion 0.131 |
41 |
> |
%define isslc %(case %cmsos in (slc*) echo true ;; (*) echo false ;; esac) |
42 |
> |
%define elfutilsVersion 0.152 |
43 |
|
%if "%isslc" == "true" |
44 |
< |
Source8: ftp://sources.redhat.com/pub/systemtap/elfutils/elfutils-%{elfutilsVersion}.tar.gz |
44 |
> |
Source8: https://fedorahosted.org/releases/e/l/elfutils/%{elfutilsVersion}/elfutils-%{elfutilsVersion}.tar.bz2 |
45 |
|
%endif |
46 |
+ |
Patch0: gcc-4.6.1-ignore-arch-flags-macosx |
47 |
+ |
# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49540 |
48 |
+ |
Patch1: gcc-4.6.1-fix-gfortran-regression |
49 |
+ |
Patch2: gcc-4.6.1-elfutils-portability |
50 |
|
|
51 |
|
%prep |
52 |
|
echo "use_custom_binutils: %use_custom_binutils" |
53 |
|
%setup -T -b 0 -n gcc-%realversion |
54 |
< |
|
54 |
> |
%if "%gcc_45plus" == "true" |
55 |
> |
# Get the macosx build to accept -arch, -F options like the official Apple one. |
56 |
> |
# Notice that patch command have to stay on a single line. |
57 |
|
case %cmsos in |
58 |
< |
# Hack to always have -m32 in the 32bit compiler, even when it's built on a 64 |
59 |
< |
# 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 |
58 |
> |
osx*) |
59 |
> |
%patch0 -p1 |
60 |
|
;; |
61 |
< |
slc*_amd64 ) |
61 |
> |
esac |
62 |
> |
%patch1 -p0 |
63 |
> |
%endif |
64 |
> |
|
65 |
> |
case %cmsos in |
66 |
> |
slc*) |
67 |
|
# Hack needed to align sections to 4096 bytes rather than 2MB on 64bit linux |
68 |
|
# architectures. This is done to reduce the amount of address space wasted by |
69 |
|
# relocating many libraries. This was done with a linker script before, but |
87 |
|
;; |
88 |
|
esac |
89 |
|
|
90 |
+ |
case %cmsos in |
91 |
+ |
slc*_corei7) |
92 |
+ |
cat << \EOF_CMS_H >> gcc/config/i386/cms.h |
93 |
+ |
#undef ASM_SPEC |
94 |
+ |
#define ASM_SPEC "%%{v:-V} %%{Qy:} %%{!Qn:-Qy} %%{n} %%{T} %%{Ym,*} %%{Yd,*} %%{Wa,*:%%*} -march=corei7 -mtune=corei7" |
95 |
+ |
#undef CC1_SPEC |
96 |
+ |
#define CC1_SPEC "%%(cc1_cpu) %%{profile:-p} -march=corei7 -mtune=corei7" |
97 |
+ |
#undef CC1PLUS_SPEC |
98 |
+ |
#define CC1PLUS_SPEC "-march=corei7" |
99 |
+ |
EOF_CMS_H |
100 |
+ |
;; |
101 |
+ |
esac |
102 |
+ |
|
103 |
|
%if "%{use_custom_binutils}" == "true" |
104 |
|
%setup -D -T -b 6 -n bison-%{bisonVersion} |
105 |
|
%setup -D -T -b 7 -n binutils-%binutilsv |
119 |
|
# These are required by rpm as well, but only on linux. |
120 |
|
%if "%isslc" == "true" |
121 |
|
%setup -D -T -b 8 -n elfutils-%{elfutilsVersion} |
122 |
+ |
%patch2 -p1 |
123 |
|
%endif |
124 |
|
|
125 |
|
%build |
126 |
< |
|
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. |
126 |
> |
# On mac we need to use gcc-proper, not gcc-llvm |
127 |
|
case %{cmsos} in |
128 |
< |
slc*_ia32) |
129 |
< |
CCOPTS="-fPIC -m32 -Wa,--32" ;; |
128 |
> |
osx*) |
129 |
> |
CC=/usr/bin/gcc-4.2 |
130 |
> |
CXX=/usr/bin/c++-4.2 |
131 |
> |
CPP=/usr/bin/cpp-4.2 |
132 |
> |
ADDITIONAL_LANGUAGES=,objc,obj-c++ |
133 |
> |
|
134 |
> |
# Apparently must emulate apple compiler even if we build |
135 |
> |
# full chain ourselves, as things come in via system libs. |
136 |
> |
# - http://newartisans.com/2009/10/a-c-gotcha-on-snow-leopard/ |
137 |
> |
# - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41645 |
138 |
> |
# - http://trac.macports.org/ticket/25205 (and 22234) |
139 |
> |
CONF_GCC_OS_SPEC=--enable-fully-dynamic-string |
140 |
> |
;; |
141 |
|
*) |
142 |
< |
CCOPTS="-fPIC" ;; |
142 |
> |
CC=gcc |
143 |
> |
CXX=c++ |
144 |
> |
CPP=cpp |
145 |
> |
CONF_GCC_OS_SPEC= |
146 |
> |
;; |
147 |
|
esac |
148 |
|
|
149 |
+ |
CC="$CC -fPIC" |
150 |
+ |
CXX="$CXX -fPIC" |
151 |
+ |
|
152 |
|
# Whenever we build custom binutils we also enable the new linker "gold". |
153 |
|
# We do so only if we are using the new gcc 4.5+ |
154 |
|
if [ "X%use_custom_binutils:%gcc_45plus" = Xtrue:true ] ; then |
155 |
< |
CONF_BINUTILS_OPTS="--enable-gold --enable-lto --enable-plugins --enable-threads" |
155 |
> |
CONF_BINUTILS_OPTS="--enable-gold=default --enable-lto --enable-plugins --enable-threads" |
156 |
> |
CONF_GCC_WITH_LTO="--enable-gold=yes --enable-lto" # --with-build-config=bootstrap-lto |
157 |
|
fi |
158 |
|
|
140 |
– |
USER_CXX=$CCOPTS |
141 |
– |
|
159 |
|
# Build libelf. |
160 |
|
if [ "X%isslc" = Xtrue ]; then |
161 |
|
cd ../elfutils-%{elfutilsVersion} |
162 |
< |
./configure --prefix=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
162 |
> |
./configure --disable-static --prefix=%i CC="$CC" CXX="$CXX" CPP="$CPP" |
163 |
|
make %makeprocesses |
164 |
|
make install |
165 |
|
fi |
172 |
|
if [ "X%use_custom_binutils" = Xtrue ] |
173 |
|
then |
174 |
|
cd ../bison-%{bisonVersion} |
175 |
< |
CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/bison |
175 |
> |
CC="$CC" ./configure --prefix=%i/tmp/bison |
176 |
|
make %makeprocesses |
177 |
|
make install |
178 |
|
export PATH=%i/tmp/bison/bin:$PATH |
179 |
|
cd ../binutils-%{binutilsv} |
180 |
< |
# Try to avoid dependency on makeinfo. |
181 |
< |
perl -p -i -e 's|SUBDIRS = .*|SUBDIRS =|' bfd/Makefile.in binutils/Makefile.in |
180 |
> |
# Try to avoid dependency on makeinfo by forcing make not |
181 |
> |
# to build the documentation. |
182 |
> |
perl -p -i -e 's|SUBDIRS = .*|SUBDIRS =|' bfd/Makefile.in binutils/Makefile.in gas/Makefile.in |
183 |
|
perl -p -i -e 's|all: info|all:|' etc/Makefile.in |
184 |
+ |
perl -p -i -e 's|TEXINFOS =.*|TEXINFOS =|;s|INFO_DEPS =.*|INFO_DEPS =|' gprof/Makefile.in |
185 |
+ |
perl -p -i -e 's|man_MANS =.*|man_MANS =|' gprof/Makefile.in |
186 |
+ |
perl -p -i -e 's|INFO_DEPS =.*|INFO_DEPS =|' ld/Makefile.in |
187 |
+ |
perl -p -i -e 's|INFOFILES =.*|INFOFILES =|' etc/Makefile.in |
188 |
+ |
perl -p -i -e 's|DVIFILES =.*|DVIFILES =|' etc/Makefile.in |
189 |
+ |
perl -p -i -e 's|PDFFILES =.*|PDFFILES =|' etc/Makefile.in |
190 |
+ |
perl -p -i -e 's|HTMLFILES =.*|HTMLFILES =|' etc/Makefile.in |
191 |
|
|
192 |
< |
./configure --prefix=%i ${CONF_BINUTILS_OPTS} \ |
193 |
< |
CC="gcc $CCOPTS" CFLAGS="-I%i/include" \ |
192 |
> |
./configure --disable-static --prefix=%i ${CONF_BINUTILS_OPTS} --disable-werror \ |
193 |
> |
CC="$CC" CXX="$CXX" CPP="$CPP" CFLAGS="-I%i/include" \ |
194 |
|
CXXFLAGS="-I%i/include" LDFLAGS="-L%i/lib" |
195 |
|
make %makeprocesses |
196 |
|
find . -name Makefile -exec perl -p -i -e 's|LN = ln|LN = cp -p|;s|ln ([^-])|cp -p $1|g' {} \; |
200 |
|
|
201 |
|
# Build GMP/MPFR/MPC |
202 |
|
cd ../gmp-%{gmpVersion} |
203 |
< |
./configure --prefix=%i --enable-shared --disable-static --enable-cxx CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
203 |
> |
./configure --disable-static --prefix=%i --enable-shared --disable-static --enable-cxx CC="$CC" CXX="$CXX" CPP="$CPP" |
204 |
|
make %makeprocesses |
205 |
|
make install |
206 |
|
|
207 |
|
cd ../mpfr-%{mpfrVersion} |
208 |
< |
./configure --prefix=%i --with-gmp=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
208 |
> |
./configure --disable-static --prefix=%i --with-gmp=%i CC="$CC" CXX="$CXX" CPP="$CPP" |
209 |
|
make %makeprocesses |
210 |
|
make install |
211 |
|
|
212 |
|
cd ../mpc-%{mpcVersion} |
213 |
< |
./configure --prefix=%i --with-gmp=%i --with-mpfr=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
213 |
> |
./configure --disable-static --prefix=%i --with-gmp=%i --with-mpfr=%i CC="$CC" CXX="$CXX" CPP="$CPP" |
214 |
|
make %makeprocesses |
215 |
|
make install |
216 |
|
CONF_GCC_VERSION_OPTS="--with-gmp=%i --with-mpfr=%i --with-mpc=%i" |
218 |
|
# Build additional stuff for gcc 4.5+ |
219 |
|
if [ "X%gcc_45plus" = Xtrue ]; then |
220 |
|
cd ../ppl-%{pplVersion} |
221 |
< |
./configure --prefix=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
221 |
> |
./configure --disable-static --with-gmp-prefix=%i --with-cxxflags="-I%i/include" --enable-interfaces=c --prefix=%i CC="$CC" CXX="$CXX" CPP="$CPP" LDFLAGS="-L%i/lib" |
222 |
|
make %makeprocesses |
223 |
|
make install |
224 |
|
|
225 |
|
cd ../cloog-%{cloogVersion} |
226 |
< |
./configure --prefix=%i --with-ppl=%i --with-gmp=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
226 |
> |
./configure --disable-static --prefix=%i --with-ppl=%i --with-gmp-prefix=%i CC="$CC" CXX="$CXX" CPP="$CPP" |
227 |
|
make %makeprocesses |
228 |
|
make install |
229 |
|
|
235 |
|
mkdir -p obj |
236 |
|
cd obj |
237 |
|
export LD_LIBRARY_PATH=%i/lib64:%i/lib:$LD_LIBRARY_PATH |
238 |
< |
../configure --prefix=%i \ |
239 |
< |
--enable-gold=yes --enable-lto --with-build-config=bootstrap-lto \ |
240 |
< |
--enable-languages=c,c++,fortran \ |
241 |
< |
$CONF_GCC_VERSION_OPTS --enable-shared CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
238 |
> |
../configure --prefix=%i --disable-multilib --disable-nls \ |
239 |
> |
--enable-languages=c,c++,fortran$ADDITIONAL_LANGUAGES \ |
240 |
> |
$CONF_GCC_OS_SPEC $CONF_GCC_WITH_LTO $CONF_GCC_VERSION_OPTS \ |
241 |
> |
--enable-shared CC="$CC" CXX="$CXX" CPP="$CPP" |
242 |
|
|
243 |
|
make %makeprocesses bootstrap |
244 |
|
make install |
247 |
|
cd %_builddir/gcc-%{realversion}/obj && make install |
248 |
|
|
249 |
|
ln -s gcc %i/bin/cc |
250 |
< |
find %i/lib %i/lib32 %i/lib64 -name '*.la' -exec rm -f {} \; || true |
251 |
< |
# SCRAM ToolBox toolfile is now geneated by the gcc-toolfile.spec |
252 |
< |
# so that everything works even in the case "--use-system-compiler" |
253 |
< |
# option is specified. |
250 |
> |
find %i/lib %i/lib64 -name '*.la' -exec rm -f {} \; || true |
251 |
> |
|
252 |
> |
# Remove unneeded documentation, temporary areas, unneeded files. |
253 |
> |
%define drop_files %i/share/{man,info,doc,locale} %i/tmp %i/lib*/{libstdc++.a,libsupc++.a} |
254 |
> |
# Strip things people will most likely never debug themself. |
255 |
> |
%define more_strip %i/bin/*{c++,g++,gcc,gfortran,gcov,ppl,cloog,cpp}* |
256 |
> |
%define strip_files %i/libexec/*/*/*/{cc1,cc1plus,f951,lto1,collect2} %i/x86_64*/bin %i/lib/lib{mpfr,ppl,gmp,cloog}* %more_strip |
257 |
> |
%define keep_archives yes |
258 |
> |
# This avoids having a dependency on the system pkg-config. |
259 |
> |
rm -rf %i/lib/pkg-config |