1 |
elmer |
1.76 |
### RPM external gcc 4.6.1
|
2 |
eulisse |
1.16 |
## INITENV +PATH LD_LIBRARY_PATH %i/lib64
|
3 |
elmer |
1.76 |
Source0: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%realversion/%n-%realversion.tar.bz2
|
4 |
eulisse |
1.83 |
|
5 |
|
|
%define keep_archives true
|
6 |
|
|
|
7 |
elmer |
1.70 |
# For gcc version >= 4.0.0, a number of additional sources are needed.
|
8 |
eulisse |
1.77 |
%define gmpVersion 5.0.2
|
9 |
|
|
%define mpfrVersion 3.0.1
|
10 |
|
|
%define mpcVersion 0.9
|
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 |
eulisse |
1.77 |
%define pplVersion 0.11.2
|
19 |
|
|
%define cloogVersion 0.16.2
|
20 |
elmer |
1.67 |
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 |
lat |
1.80 |
%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 |
elmer |
1.57 |
%endif
|
34 |
|
|
|
35 |
eulisse |
1.65 |
# gcc 4.5+ link time optimization support requires libelf to work. However
|
36 |
|
|
# also rpm requires it. In order to have to duplicate dependencies we
|
37 |
|
|
# build it in gcc and we pick it up from there also for rpm. Notice that
|
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 |
eulisse |
1.84 |
%define elfutilsVersion 0.152
|
42 |
eulisse |
1.65 |
%if "%isslc" == "true"
|
43 |
eulisse |
1.84 |
Source8: https://fedorahosted.org/releases/e/l/elfutils/%{elfutilsVersion}/elfutils-%{elfutilsVersion}.tar.bz2
|
44 |
eulisse |
1.65 |
%endif
|
45 |
eulisse |
1.77 |
Patch0: gcc-4.6.1-ignore-arch-flags-macosx
|
46 |
eulisse |
1.78 |
# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49540
|
47 |
|
|
Patch1: gcc-4.6.1-fix-gfortran-regression
|
48 |
eulisse |
1.85 |
Patch2: gcc-4.6.1-elfutils-portability
|
49 |
eulisse |
1.65 |
|
50 |
eulisse |
1.16 |
%prep
|
51 |
eulisse |
1.63 |
echo "use_custom_binutils: %use_custom_binutils"
|
52 |
|
|
%setup -T -b 0 -n gcc-%realversion
|
53 |
eulisse |
1.77 |
# 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 |
|
|
osx*)
|
57 |
|
|
%patch0 -p1
|
58 |
|
|
;;
|
59 |
|
|
esac
|
60 |
eulisse |
1.78 |
%patch1 -p0
|
61 |
dlange |
1.15 |
|
62 |
elmer |
1.43 |
case %cmsos in
|
63 |
eulisse |
1.62 |
slc*_amd64 )
|
64 |
eulisse |
1.63 |
# 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
|
66 |
|
|
# relocating many libraries. This was done with a linker script before, but
|
67 |
|
|
# this approach seems to be more correct.
|
68 |
eulisse |
1.62 |
cat << \EOF_CONFIG_GCC >> gcc/config.gcc
|
69 |
|
|
# CMS patch to include gcc/config/i386/t-cms when building gcc
|
70 |
|
|
tm_file="$tm_file i386/cms.h"
|
71 |
|
|
EOF_CONFIG_GCC
|
72 |
|
|
|
73 |
|
|
cat << \EOF_CMS_H > gcc/config/i386/cms.h
|
74 |
|
|
#undef LINK_SPEC
|
75 |
|
|
#define LINK_SPEC "%{" SPEC_64 ":-m elf_x86_64} %{" SPEC_32 ":-m elf_i386} \
|
76 |
|
|
%{shared:-shared} \
|
77 |
|
|
%{!shared: \
|
78 |
|
|
%{!static: \
|
79 |
|
|
%{rdynamic:-export-dynamic} \
|
80 |
|
|
%{" SPEC_32 ":%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER32 "}} \
|
81 |
|
|
%{" SPEC_64 ":%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER64 "}}} \
|
82 |
|
|
%{static:-static}} -z common-page-size=4096 -z max-page-size=4096"
|
83 |
|
|
EOF_CMS_H
|
84 |
|
|
;;
|
85 |
elmer |
1.43 |
esac
|
86 |
dlange |
1.15 |
|
87 |
eulisse |
1.63 |
%if "%{use_custom_binutils}" == "true"
|
88 |
elmer |
1.60 |
%setup -D -T -b 6 -n bison-%{bisonVersion}
|
89 |
|
|
%setup -D -T -b 7 -n binutils-%binutilsv
|
90 |
eulisse |
1.46 |
%endif
|
91 |
|
|
|
92 |
eulisse |
1.63 |
# These are required for any gcc 4.x build.
|
93 |
eulisse |
1.46 |
%setup -D -T -b 1 -n gmp-%{gmpVersion}
|
94 |
|
|
%setup -D -T -b 2 -n mpfr-%{mpfrVersion}
|
95 |
elmer |
1.56 |
%setup -D -T -b 3 -n mpc-%{mpcVersion}
|
96 |
eulisse |
1.63 |
|
97 |
|
|
# For gcc 4.5 and later we also need the following.
|
98 |
|
|
%if "%gcc_45plus" == "true"
|
99 |
elmer |
1.57 |
%setup -D -T -b 4 -n ppl-%{pplVersion}
|
100 |
elmer |
1.67 |
%setup -D -T -b 5 -n cloog-%{cloogVersion}
|
101 |
eulisse |
1.63 |
%endif
|
102 |
eulisse |
1.65 |
|
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 |
eulisse |
1.85 |
%patch2 -p1
|
107 |
eulisse |
1.65 |
%endif
|
108 |
|
|
|
109 |
eulisse |
1.63 |
%build
|
110 |
eulisse |
1.77 |
# On mac we need to use gcc-proper, not gcc-llvm
|
111 |
eulisse |
1.63 |
case %{cmsos} in
|
112 |
eulisse |
1.77 |
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 |
lat |
1.80 |
|
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 |
eulisse |
1.77 |
;;
|
125 |
eulisse |
1.63 |
*)
|
126 |
eulisse |
1.77 |
CC=gcc
|
127 |
|
|
CXX=c++
|
128 |
|
|
CPP=cpp
|
129 |
lat |
1.80 |
CONF_GCC_OS_SPEC=
|
130 |
eulisse |
1.77 |
;;
|
131 |
eulisse |
1.20 |
esac
|
132 |
eulisse |
1.59 |
|
133 |
eulisse |
1.77 |
CC="$CC -fPIC"
|
134 |
|
|
CXX="$CXX -fPIC"
|
135 |
|
|
|
136 |
eulisse |
1.63 |
# 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 |
elmer |
1.75 |
CONF_BINUTILS_OPTS="--enable-gold=default --enable-lto --enable-plugins --enable-threads"
|
140 |
lat |
1.80 |
CONF_GCC_WITH_LTO="--enable-gold=yes --enable-lto --with-build-config=bootstrap-lto"
|
141 |
eulisse |
1.63 |
fi
|
142 |
|
|
|
143 |
eulisse |
1.65 |
# Build libelf.
|
144 |
|
|
if [ "X%isslc" = Xtrue ]; then
|
145 |
|
|
cd ../elfutils-%{elfutilsVersion}
|
146 |
eulisse |
1.79 |
./configure --disable-static --prefix=%i CC="$CC" CXX="$CXX" CPP="$CPP"
|
147 |
eulisse |
1.65 |
make %makeprocesses
|
148 |
|
|
make install
|
149 |
|
|
fi
|
150 |
|
|
|
151 |
eulisse |
1.63 |
# If requested, build our own binutils. Currently the default is to use the
|
152 |
|
|
# system binutils on 32bit platforms and our own on 64 bit ones.
|
153 |
|
|
# FIXME: Notice that this copy is actually built using the system compiler, so
|
154 |
|
|
# we chances are we will need to rebuild it later on to make sure they get
|
155 |
|
|
# linked against our libstdc++ (required by gold).
|
156 |
|
|
if [ "X%use_custom_binutils" = Xtrue ]
|
157 |
|
|
then
|
158 |
|
|
cd ../bison-%{bisonVersion}
|
159 |
eulisse |
1.77 |
CC="$CC" ./configure --prefix=%i/tmp/bison
|
160 |
eulisse |
1.63 |
make %makeprocesses
|
161 |
|
|
make install
|
162 |
|
|
export PATH=%i/tmp/bison/bin:$PATH
|
163 |
|
|
cd ../binutils-%{binutilsv}
|
164 |
eulisse |
1.74 |
# 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 |
eulisse |
1.73 |
perl -p -i -e 's|all: info|all:|' etc/Makefile.in
|
168 |
eulisse |
1.74 |
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 |
eulisse |
1.73 |
|
176 |
eulisse |
1.79 |
./configure --disable-static --prefix=%i ${CONF_BINUTILS_OPTS} --disable-werror \
|
177 |
eulisse |
1.77 |
CC="$CC" CXX="$CXX" CPP="$CPP" CFLAGS="-I%i/include" \
|
178 |
eulisse |
1.65 |
CXXFLAGS="-I%i/include" LDFLAGS="-L%i/lib"
|
179 |
eulisse |
1.63 |
make %makeprocesses
|
180 |
|
|
find . -name Makefile -exec perl -p -i -e 's|LN = ln|LN = cp -p|;s|ln ([^-])|cp -p $1|g' {} \;
|
181 |
|
|
make install
|
182 |
|
|
which ld
|
183 |
|
|
fi
|
184 |
eulisse |
1.16 |
|
185 |
eulisse |
1.63 |
# Build GMP/MPFR/MPC
|
186 |
eulisse |
1.19 |
cd ../gmp-%{gmpVersion}
|
187 |
eulisse |
1.79 |
./configure --disable-static --prefix=%i --enable-shared --disable-static --enable-cxx CC="$CC" CXX="$CXX" CPP="$CPP"
|
188 |
eulisse |
1.19 |
make %makeprocesses
|
189 |
eulisse |
1.20 |
make install
|
190 |
eulisse |
1.19 |
|
191 |
|
|
cd ../mpfr-%{mpfrVersion}
|
192 |
eulisse |
1.79 |
./configure --disable-static --prefix=%i --with-gmp=%i CC="$CC" CXX="$CXX" CPP="$CPP"
|
193 |
eulisse |
1.19 |
make %makeprocesses
|
194 |
eulisse |
1.31 |
make install
|
195 |
elmer |
1.56 |
|
196 |
|
|
cd ../mpc-%{mpcVersion}
|
197 |
eulisse |
1.79 |
./configure --disable-static --prefix=%i --with-gmp=%i --with-mpfr=%i CC="$CC" CXX="$CXX" CPP="$CPP"
|
198 |
elmer |
1.56 |
make %makeprocesses
|
199 |
|
|
make install
|
200 |
eulisse |
1.63 |
CONF_GCC_VERSION_OPTS="--with-gmp=%i --with-mpfr=%i --with-mpc=%i"
|
201 |
elmer |
1.56 |
|
202 |
eulisse |
1.63 |
# Build additional stuff for gcc 4.5+
|
203 |
|
|
if [ "X%gcc_45plus" = Xtrue ]; then
|
204 |
|
|
cd ../ppl-%{pplVersion}
|
205 |
eulisse |
1.84 |
./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 |
eulisse |
1.63 |
make %makeprocesses
|
207 |
|
|
make install
|
208 |
|
|
|
209 |
elmer |
1.67 |
cd ../cloog-%{cloogVersion}
|
210 |
eulisse |
1.79 |
./configure --disable-static --prefix=%i --with-ppl=%i --with-gmp-prefix=%i CC="$CC" CXX="$CXX" CPP="$CPP"
|
211 |
eulisse |
1.63 |
make %makeprocesses
|
212 |
|
|
make install
|
213 |
elmer |
1.57 |
|
214 |
elmer |
1.67 |
CONF_GCC_VERSION_OPTS="$CONF_GCC_VERSION_OPTS --with-ppl=%i --with-cloog=%i --enable-cloog-backend=isl"
|
215 |
eulisse |
1.63 |
fi
|
216 |
eulisse |
1.19 |
|
217 |
eulisse |
1.20 |
# Build the compilers
|
218 |
elmer |
1.58 |
cd ../gcc-%realversion
|
219 |
eulisse |
1.18 |
mkdir -p obj
|
220 |
|
|
cd obj
|
221 |
eulisse |
1.59 |
export LD_LIBRARY_PATH=%i/lib64:%i/lib:$LD_LIBRARY_PATH
|
222 |
lat |
1.80 |
../configure --prefix=%i --disable-multilib --disable-nls \
|
223 |
eulisse |
1.77 |
--enable-languages=c,c++,fortran$ADDITIONAL_LANGUAGES \
|
224 |
lat |
1.80 |
$CONF_GCC_OS_SPEC $CONF_GCC_WITH_LTO $CONF_GCC_VERSION_OPTS \
|
225 |
|
|
--enable-shared CC="$CC" CXX="$CXX" CPP="$CPP"
|
226 |
eulisse |
1.18 |
|
227 |
|
|
make %makeprocesses bootstrap
|
228 |
eulisse |
1.63 |
make install
|
229 |
eulisse |
1.16 |
|
230 |
argiro |
1.1 |
%install
|
231 |
elmer |
1.58 |
cd %_builddir/gcc-%{realversion}/obj && make install
|
232 |
eulisse |
1.51 |
|
233 |
argiro |
1.1 |
ln -s gcc %i/bin/cc
|
234 |
eulisse |
1.77 |
find %i/lib %i/lib64 -name '*.la' -exec rm -f {} \; || true
|
235 |
eulisse |
1.79 |
|
236 |
eulisse |
1.83 |
# 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 |
eulisse |
1.79 |
# Strip things people will most likely never debug themself.
|
239 |
eulisse |
1.83 |
%define more_strip %i/bin/*{c++,g++,gcc,gfortran,gcov,ppl,cloog,cpp}*
|
240 |
|
|
%define strip_symbols %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 |
eulisse |
1.79 |
# This avoids having a dependency on the system pkg-config.
|
243 |
|
|
rm -rf %i/lib/pkg-config
|