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 |
18 |
> |
%define pplVersion 0.11.2 |
19 |
> |
%define cloogVersion 0.16.2 |
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 |
|
%endif |
26 |
|
%if "%use_custom_binutils" == "true" |
27 |
|
%define bisonVersion 2.4 |
28 |
|
Source6: http://ftp.gnu.org/gnu/bison/bison-%{bisonVersion}.tar.bz2 |
29 |
< |
%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 |
29 |
> |
%define binutilsv 2.21.1 |
30 |
> |
Source7: http://ftp.gnu.org/gnu/binutils/binutils-%binutilsv.tar.bz2 |
31 |
> |
#Source7: http://cmsrep.cern.ch/cmssw/binutils-mirror/binutils-%binutilsv.tar.bz2 |
32 |
> |
#Source7: http://www.kernel.org/pub/linux/devel/binutils/binutils-%binutilsv.tar.bz2 |
33 |
|
%endif |
34 |
|
|
35 |
|
# gcc 4.5+ link time optimization support requires libelf to work. However |
38 |
|
# libelf does not work on Macosx however this is not a problem until |
39 |
|
# we use the system compiler there. |
40 |
|
%define isslc %(echo %cmsos | sed -e 's|slc.*|true|') |
41 |
< |
%define elfutilsVersion 0.131 |
41 |
> |
%define elfutilsVersion 0.152 |
42 |
|
%if "%isslc" == "true" |
43 |
< |
Source8: ftp://sources.redhat.com/pub/systemtap/elfutils/elfutils-%{elfutilsVersion}.tar.gz |
43 |
> |
Source8: https://fedorahosted.org/releases/e/l/elfutils/%{elfutilsVersion}/elfutils-%{elfutilsVersion}.tar.bz2 |
44 |
|
%endif |
45 |
+ |
Patch0: gcc-4.6.1-ignore-arch-flags-macosx |
46 |
+ |
# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49540 |
47 |
+ |
Patch1: gcc-4.6.1-fix-gfortran-regression |
48 |
+ |
Patch2: gcc-4.6.1-elfutils-portability |
49 |
|
|
50 |
|
%prep |
51 |
|
echo "use_custom_binutils: %use_custom_binutils" |
52 |
|
%setup -T -b 0 -n gcc-%realversion |
53 |
< |
|
53 |
> |
# Get the macosx build to accept -arch, -F options like the official Apple one. |
54 |
> |
# Notice that patch command have to stay on a single line. |
55 |
|
case %cmsos in |
56 |
< |
# Hack to always have -m32 in the 32bit compiler, even when it's built on a 64 |
57 |
< |
# 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 |
56 |
> |
osx*) |
57 |
> |
%patch0 -p1 |
58 |
|
;; |
59 |
+ |
esac |
60 |
+ |
%patch1 -p0 |
61 |
+ |
|
62 |
+ |
case %cmsos in |
63 |
|
slc*_amd64 ) |
64 |
|
# Hack needed to align sections to 4096 bytes rather than 2MB on 64bit linux |
65 |
|
# architectures. This is done to reduce the amount of address space wasted by |
103 |
|
# These are required by rpm as well, but only on linux. |
104 |
|
%if "%isslc" == "true" |
105 |
|
%setup -D -T -b 8 -n elfutils-%{elfutilsVersion} |
106 |
+ |
%patch2 -p1 |
107 |
|
%endif |
108 |
|
|
109 |
|
%build |
110 |
< |
|
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. |
110 |
> |
# On mac we need to use gcc-proper, not gcc-llvm |
111 |
|
case %{cmsos} in |
112 |
< |
slc*_ia32) |
113 |
< |
CCOPTS="-fPIC -m32 -Wa,--32" ;; |
112 |
> |
osx*) |
113 |
> |
CC=/usr/bin/gcc-4.2 |
114 |
> |
CXX=/usr/bin/c++-4.2 |
115 |
> |
CPP=/usr/bin/cpp-4.2 |
116 |
> |
ADDITIONAL_LANGUAGES=,objc,obj-c++ |
117 |
> |
|
118 |
> |
# Apparently must emulate apple compiler even if we build |
119 |
> |
# full chain ourselves, as things come in via system libs. |
120 |
> |
# - http://newartisans.com/2009/10/a-c-gotcha-on-snow-leopard/ |
121 |
> |
# - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41645 |
122 |
> |
# - http://trac.macports.org/ticket/25205 (and 22234) |
123 |
> |
CONF_GCC_OS_SPEC=--enable-fully-dynamic-string |
124 |
> |
;; |
125 |
|
*) |
126 |
< |
CCOPTS="-fPIC" ;; |
126 |
> |
CC=gcc |
127 |
> |
CXX=c++ |
128 |
> |
CPP=cpp |
129 |
> |
CONF_GCC_OS_SPEC= |
130 |
> |
;; |
131 |
|
esac |
132 |
|
|
133 |
+ |
CC="$CC -fPIC" |
134 |
+ |
CXX="$CXX -fPIC" |
135 |
+ |
|
136 |
|
# Whenever we build custom binutils we also enable the new linker "gold". |
137 |
|
# We do so only if we are using the new gcc 4.5+ |
138 |
|
if [ "X%use_custom_binutils:%gcc_45plus" = Xtrue:true ] ; then |
139 |
< |
CONF_BINUTILS_OPTS="--enable-gold --enable-lto --enable-plugins --enable-threads" |
139 |
> |
CONF_BINUTILS_OPTS="--enable-gold=default --enable-lto --enable-plugins --enable-threads" |
140 |
> |
CONF_GCC_WITH_LTO="--enable-gold=yes --enable-lto" # --with-build-config=bootstrap-lto |
141 |
|
fi |
142 |
|
|
140 |
– |
USER_CXX=$CCOPTS |
141 |
– |
|
143 |
|
# Build libelf. |
144 |
|
if [ "X%isslc" = Xtrue ]; then |
145 |
|
cd ../elfutils-%{elfutilsVersion} |
146 |
< |
./configure --prefix=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
146 |
> |
./configure --disable-static --prefix=%i CC="$CC" CXX="$CXX" CPP="$CPP" |
147 |
|
make %makeprocesses |
148 |
|
make install |
149 |
|
fi |
156 |
|
if [ "X%use_custom_binutils" = Xtrue ] |
157 |
|
then |
158 |
|
cd ../bison-%{bisonVersion} |
159 |
< |
CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/bison |
159 |
> |
CC="$CC" ./configure --prefix=%i/tmp/bison |
160 |
|
make %makeprocesses |
161 |
|
make install |
162 |
|
export PATH=%i/tmp/bison/bin:$PATH |
163 |
|
cd ../binutils-%{binutilsv} |
164 |
< |
# Try to avoid dependency on makeinfo. |
165 |
< |
perl -p -i -e 's|SUBDIRS = .*|SUBDIRS =|' bfd/Makefile.in binutils/Makefile.in |
164 |
> |
# Try to avoid dependency on makeinfo by forcing make not |
165 |
> |
# to build the documentation. |
166 |
> |
perl -p -i -e 's|SUBDIRS = .*|SUBDIRS =|' bfd/Makefile.in binutils/Makefile.in gas/Makefile.in |
167 |
|
perl -p -i -e 's|all: info|all:|' etc/Makefile.in |
168 |
+ |
perl -p -i -e 's|TEXINFOS =.*|TEXINFOS =|;s|INFO_DEPS =.*|INFO_DEPS =|' gprof/Makefile.in |
169 |
+ |
perl -p -i -e 's|man_MANS =.*|man_MANS =|' gprof/Makefile.in |
170 |
+ |
perl -p -i -e 's|INFO_DEPS =.*|INFO_DEPS =|' ld/Makefile.in |
171 |
+ |
perl -p -i -e 's|INFOFILES =.*|INFOFILES =|' etc/Makefile.in |
172 |
+ |
perl -p -i -e 's|DVIFILES =.*|DVIFILES =|' etc/Makefile.in |
173 |
+ |
perl -p -i -e 's|PDFFILES =.*|PDFFILES =|' etc/Makefile.in |
174 |
+ |
perl -p -i -e 's|HTMLFILES =.*|HTMLFILES =|' etc/Makefile.in |
175 |
|
|
176 |
< |
./configure --prefix=%i ${CONF_BINUTILS_OPTS} \ |
177 |
< |
CC="gcc $CCOPTS" CFLAGS="-I%i/include" \ |
176 |
> |
./configure --disable-static --prefix=%i ${CONF_BINUTILS_OPTS} --disable-werror \ |
177 |
> |
CC="$CC" CXX="$CXX" CPP="$CPP" CFLAGS="-I%i/include" \ |
178 |
|
CXXFLAGS="-I%i/include" LDFLAGS="-L%i/lib" |
179 |
|
make %makeprocesses |
180 |
|
find . -name Makefile -exec perl -p -i -e 's|LN = ln|LN = cp -p|;s|ln ([^-])|cp -p $1|g' {} \; |
184 |
|
|
185 |
|
# Build GMP/MPFR/MPC |
186 |
|
cd ../gmp-%{gmpVersion} |
187 |
< |
./configure --prefix=%i --enable-shared --disable-static --enable-cxx CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
187 |
> |
./configure --disable-static --prefix=%i --enable-shared --disable-static --enable-cxx CC="$CC" CXX="$CXX" CPP="$CPP" |
188 |
|
make %makeprocesses |
189 |
|
make install |
190 |
|
|
191 |
|
cd ../mpfr-%{mpfrVersion} |
192 |
< |
./configure --prefix=%i --with-gmp=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
192 |
> |
./configure --disable-static --prefix=%i --with-gmp=%i CC="$CC" CXX="$CXX" CPP="$CPP" |
193 |
|
make %makeprocesses |
194 |
|
make install |
195 |
|
|
196 |
|
cd ../mpc-%{mpcVersion} |
197 |
< |
./configure --prefix=%i --with-gmp=%i --with-mpfr=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
197 |
> |
./configure --disable-static --prefix=%i --with-gmp=%i --with-mpfr=%i CC="$CC" CXX="$CXX" CPP="$CPP" |
198 |
|
make %makeprocesses |
199 |
|
make install |
200 |
|
CONF_GCC_VERSION_OPTS="--with-gmp=%i --with-mpfr=%i --with-mpc=%i" |
202 |
|
# Build additional stuff for gcc 4.5+ |
203 |
|
if [ "X%gcc_45plus" = Xtrue ]; then |
204 |
|
cd ../ppl-%{pplVersion} |
205 |
< |
./configure --prefix=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
205 |
> |
./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" |
206 |
|
make %makeprocesses |
207 |
|
make install |
208 |
|
|
209 |
|
cd ../cloog-%{cloogVersion} |
210 |
< |
./configure --prefix=%i --with-ppl=%i --with-gmp=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
210 |
> |
./configure --disable-static --prefix=%i --with-ppl=%i --with-gmp-prefix=%i CC="$CC" CXX="$CXX" CPP="$CPP" |
211 |
|
make %makeprocesses |
212 |
|
make install |
213 |
|
|
219 |
|
mkdir -p obj |
220 |
|
cd obj |
221 |
|
export LD_LIBRARY_PATH=%i/lib64:%i/lib:$LD_LIBRARY_PATH |
222 |
< |
../configure --prefix=%i \ |
223 |
< |
--enable-gold=yes --enable-lto --with-build-config=bootstrap-lto \ |
224 |
< |
--enable-languages=c,c++,fortran \ |
225 |
< |
$CONF_GCC_VERSION_OPTS --enable-shared CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
222 |
> |
../configure --prefix=%i --disable-multilib --disable-nls \ |
223 |
> |
--enable-languages=c,c++,fortran$ADDITIONAL_LANGUAGES \ |
224 |
> |
$CONF_GCC_OS_SPEC $CONF_GCC_WITH_LTO $CONF_GCC_VERSION_OPTS \ |
225 |
> |
--enable-shared CC="$CC" CXX="$CXX" CPP="$CPP" |
226 |
|
|
227 |
|
make %makeprocesses bootstrap |
228 |
|
make install |
231 |
|
cd %_builddir/gcc-%{realversion}/obj && make install |
232 |
|
|
233 |
|
ln -s gcc %i/bin/cc |
234 |
< |
find %i/lib %i/lib32 %i/lib64 -name '*.la' -exec rm -f {} \; || true |
235 |
< |
# SCRAM ToolBox toolfile is now geneated by the gcc-toolfile.spec |
236 |
< |
# so that everything works even in the case "--use-system-compiler" |
237 |
< |
# option is specified. |
234 |
> |
find %i/lib %i/lib64 -name '*.la' -exec rm -f {} \; || true |
235 |
> |
|
236 |
> |
# Remove unneeded documentation, temporary areas, unneeded files. |
237 |
> |
%define drop_files %i/share/{man,info,doc,locale} %i/tmp %i/lib*/{libstdc++.a,libsupc++.a} |
238 |
> |
# Strip things people will most likely never debug themself. |
239 |
> |
%define more_strip %i/bin/*{c++,g++,gcc,gfortran,gcov,ppl,cloog,cpp}* |
240 |
> |
%define strip_files %i/libexec/*/*/*/{cc1,cc1plus,f951,lto1,collect2} %i/x86_64*/bin %i/lib/lib{mpfr,ppl,gmp,cloog}* %more_strip |
241 |
> |
%define keep_archives yes |
242 |
> |
# This avoids having a dependency on the system pkg-config. |
243 |
> |
rm -rf %i/lib/pkg-config |