1 |
< |
### RPM external gcc 4.2.2-CMS19 |
1 |
> |
### RPM external gcc 4.3.4 |
2 |
|
## INITENV +PATH LD_LIBRARY_PATH %i/lib/32 |
3 |
|
## INITENV +PATH LD_LIBRARY_PATH %i/lib64 |
4 |
– |
## BUILDIF case $(uname):$(uname -p) in Linux:i*86 ) true ;; Linux:x86_64 ) true ;; Linux:ppc64 ) false ;; Darwin:* ) false ;; * ) true ;; esac |
4 |
|
Source0: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%realversion/%n-%realversion.tar.bz2 |
5 |
< |
%define binutilsv 2.17 |
6 |
< |
Source1: http://ftp.gnu.org/gnu/binutils/binutils-%binutilsv.tar.bz2 |
5 |
> |
# If gcc version >= 4.0.0, we need two additional sources, for gmp and mpfr. |
6 |
> |
%define gmpVersion 4.3.2 |
7 |
> |
%define mpfrVersion 2.4.2 |
8 |
> |
%define mpcVersion 0.8.1 |
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 |
12 |
> |
|
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.10.2 |
17 |
> |
%define cloogpplVersion 0.15.9 |
18 |
> |
Source4: http://www.cs.unipr.it/ppl/Download/ftp/releases/0.10.2/ppl-%{pplVersion}.tar.bz2 |
19 |
> |
Source5: ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-ppl-%{cloogpplVersion}.tar.gz |
20 |
> |
%endif |
21 |
|
|
22 |
< |
# If gcc version >= 4.0.0, we need two additional sources, for gmp and mpfr, |
23 |
< |
# and we set the fortranCompiler macro (which is going to be used by the |
24 |
< |
# --enable-languages option of gcc's configure) to gfortran. |
25 |
< |
# Notice that we need to build those twice: once using the system compiler |
26 |
< |
# and the using the newly built gcc. |
27 |
< |
%define gmpVersion 4.2.1 |
28 |
< |
%define mpfrVersion 2.2.1 |
29 |
< |
Source2: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmpVersion}.tar.bz2 |
17 |
< |
Source3: http://www.mpfr.org/mpfr-%{mpfrVersion}/mpfr-%{mpfrVersion}.tar.bz2 |
22 |
> |
# On 64bit Scientific Linux build our own binutils. |
23 |
> |
%define use_custom_binutils %(echo %cmsos | sed -e 's|slc[0-9]*_amd64|true|') |
24 |
> |
%if "%use_custom_binutils" == "true" |
25 |
> |
%define bisonVersion 2.4 |
26 |
> |
%define binutilsv 2.20.1 |
27 |
> |
Source6: http://ftp.gnu.org/gnu/bison/bison-%{bisonVersion}.tar.bz2 |
28 |
> |
Source7: http://ftp.gnu.org/gnu/binutils/binutils-%binutilsv.tar.bz2 |
29 |
> |
%endif |
30 |
|
|
19 |
– |
%define cpu %(echo %cmsplatf | cut -d_ -f2) |
20 |
– |
%define gcc_major %(echo %realversion | cut -f1 -d.) |
31 |
|
%prep |
32 |
< |
%setup -T -b 0 -n gcc-%realversion |
32 |
> |
echo "use_custom_binutils: %use_custom_binutils" |
33 |
> |
%setup -T -b 0 -n gcc-%realversion |
34 |
|
|
35 |
< |
%if "%cmsos" == "slc4_ia32" |
35 |
> |
case %cmsos in |
36 |
> |
# Hack to always have -m32 in the 32bit compiler, even when it's built on a 64 |
37 |
> |
# bit architecture. |
38 |
> |
slc*_ia32 ) |
39 |
|
cat << \EOF_CONFIG_GCC >> gcc/config.gcc |
40 |
|
# CMS patch to include gcc/config/i386/t-cms when building gcc |
41 |
|
tm_file="$tm_file i386/cms.h" |
58 |
|
MULTILIB_DIRNAMES = ../lib |
59 |
|
MULTILIB_MATCHES = m32=m32 |
60 |
|
EOF_T_CMS |
61 |
< |
%endif |
61 |
> |
;; |
62 |
> |
slc*_amd64 ) |
63 |
> |
# Hack needed to align sections to 4096 bytes rather than 2MB on 64bit linux |
64 |
> |
# architectures. This is done to reduce the amount of address space wasted by |
65 |
> |
# relocating many libraries. This was done with a linker script before, but |
66 |
> |
# this approach seems to be more correct. |
67 |
> |
cat << \EOF_CONFIG_GCC >> gcc/config.gcc |
68 |
> |
# CMS patch to include gcc/config/i386/t-cms when building gcc |
69 |
> |
tm_file="$tm_file i386/cms.h" |
70 |
> |
EOF_CONFIG_GCC |
71 |
|
|
72 |
< |
%setup -D -T -b 1 -n binutils-%binutilsv |
73 |
< |
%setup -D -T -b 2 -n gmp-%{gmpVersion} |
74 |
< |
%setup -D -T -b 3 -n mpfr-%{mpfrVersion} |
72 |
> |
cat << \EOF_CMS_H > gcc/config/i386/cms.h |
73 |
> |
#undef LINK_SPEC |
74 |
> |
#define LINK_SPEC "%{" SPEC_64 ":-m elf_x86_64} %{" SPEC_32 ":-m elf_i386} \ |
75 |
> |
%{shared:-shared} \ |
76 |
> |
%{!shared: \ |
77 |
> |
%{!static: \ |
78 |
> |
%{rdynamic:-export-dynamic} \ |
79 |
> |
%{" SPEC_32 ":%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER32 "}} \ |
80 |
> |
%{" SPEC_64 ":%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER64 "}}} \ |
81 |
> |
%{static:-static}} -z common-page-size=4096 -z max-page-size=4096" |
82 |
> |
EOF_CMS_H |
83 |
> |
;; |
84 |
> |
esac |
85 |
|
|
86 |
+ |
%if "%{use_custom_binutils}" == "true" |
87 |
+ |
%setup -D -T -b 6 -n bison-%{bisonVersion} |
88 |
+ |
%setup -D -T -b 7 -n binutils-%binutilsv |
89 |
+ |
%endif |
90 |
+ |
|
91 |
+ |
# These are required for any gcc 4.x build. |
92 |
+ |
%setup -D -T -b 1 -n gmp-%{gmpVersion} |
93 |
+ |
%setup -D -T -b 2 -n mpfr-%{mpfrVersion} |
94 |
+ |
%setup -D -T -b 3 -n mpc-%{mpcVersion} |
95 |
+ |
|
96 |
+ |
# For gcc 4.5 and later we also need the following. |
97 |
+ |
%if "%gcc_45plus" == "true" |
98 |
+ |
%setup -D -T -b 4 -n ppl-%{pplVersion} |
99 |
+ |
%setup -D -T -b 5 -n cloog-ppl-%{cloogpplVersion} |
100 |
+ |
%endif |
101 |
|
%build |
102 |
+ |
|
103 |
|
# Set special variables required to build 32-bit executables on 64-bit |
104 |
|
# systems. Note that if the architecture is SLC4/IA32, we may be on a |
105 |
|
# 64-bit system and need to produce a 32-bit capable compiler, which |
106 |
|
# _itself_ is a 32-bit executable. |
107 |
< |
case $(uname -m):%{cmsos} in |
108 |
< |
*:slc4_ia32 ) |
109 |
< |
CCOPTS="-m32 -Wa,--32" ;; |
110 |
< |
* ) |
111 |
< |
CCOPTS="" ;; |
107 |
> |
case %{cmsos} in |
108 |
> |
slc*_ia32) |
109 |
> |
CCOPTS="-fPIC -m32 -Wa,--32" ;; |
110 |
> |
*) |
111 |
> |
CCOPTS="-fPIC" ;; |
112 |
|
esac |
113 |
|
|
114 |
< |
# If requested, build our own binutils. Currently the default is to use |
115 |
< |
# the system binutils. |
116 |
< |
%if "%{?use_external_binutils:set}" == "set" |
117 |
< |
cd ../binutils-%{binutilsv} |
118 |
< |
CC="gcc $CCOPTS" ./configure --prefix=%i |
119 |
< |
make %makeprocesses |
120 |
< |
make install |
121 |
< |
%endif |
114 |
> |
# Whenever we build custom binutils we also enable the new linker "gold". |
115 |
> |
# We do so only if we are using the new gcc 4.5+ |
116 |
> |
if [ "X%use_custom_binutils:%gcc_45plus" = Xtrue:true ] ; then |
117 |
> |
CONF_BINUTILS_OPTS="--enable-gold" |
118 |
> |
fi |
119 |
> |
|
120 |
> |
USER_CXX=$CCOPTS |
121 |
> |
|
122 |
> |
# If requested, build our own binutils. Currently the default is to use the |
123 |
> |
# system binutils on 32bit platforms and our own on 64 bit ones. |
124 |
> |
# FIXME: Notice that this copy is actually built using the system compiler, so |
125 |
> |
# we chances are we will need to rebuild it later on to make sure they get |
126 |
> |
# linked against our libstdc++ (required by gold). |
127 |
> |
if [ "X%use_custom_binutils" = Xtrue ] |
128 |
> |
then |
129 |
> |
cd ../bison-%{bisonVersion} |
130 |
> |
CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/bison |
131 |
> |
make %makeprocesses |
132 |
> |
make install |
133 |
> |
export PATH=%i/tmp/bison/bin:$PATH |
134 |
> |
cd ../binutils-%{binutilsv} |
135 |
> |
./configure --prefix=%i ${CONF_BINUTILS_OPTS} CC="gcc $CCOPTS" |
136 |
> |
make %makeprocesses |
137 |
> |
find . -name Makefile -exec perl -p -i -e 's|LN = ln|LN = cp -p|;s|ln ([^-])|cp -p $1|g' {} \; |
138 |
> |
make install |
139 |
> |
which ld |
140 |
> |
fi |
141 |
|
|
142 |
< |
# Build GMP/MPFR for GCC 4.x |
75 |
< |
%define gcc4opts %{nil} |
76 |
< |
%if "%gcc_major" == "4" |
142 |
> |
# Build GMP/MPFR/MPC |
143 |
|
cd ../gmp-%{gmpVersion} |
144 |
< |
CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/gmp --disable-shared |
144 |
> |
./configure --prefix=%i --enable-shared --disable-static --enable-cxx CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
145 |
|
make %makeprocesses |
146 |
|
make install |
147 |
|
|
148 |
|
cd ../mpfr-%{mpfrVersion} |
149 |
< |
CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/mpfr --with-gmp=%i/tmp/gmp --disable-shared |
149 |
> |
./configure --prefix=%i --with-gmp=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
150 |
|
make %makeprocesses |
151 |
|
make install |
152 |
< |
%define gcc4opts --with-gmp=%i/tmp/gmp --with-mpfr=%i/tmp/mpfr |
153 |
< |
%endif |
152 |
> |
|
153 |
> |
cd ../mpc-%{mpcVersion} |
154 |
> |
./configure --prefix=%i --with-gmp=%i --with-mpfr=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
155 |
> |
make %makeprocesses |
156 |
> |
make install |
157 |
> |
CONF_GCC_VERSION_OPTS="--with-gmp=%i --with-mpfr=%i --with-mpc=%i" |
158 |
> |
|
159 |
> |
# Build additional stuff for gcc 4.5+ |
160 |
> |
if [ "X%gcc_45plus" = Xtrue ]; then |
161 |
> |
cd ../ppl-%{pplVersion} |
162 |
> |
./configure --prefix=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
163 |
> |
make %makeprocesses |
164 |
> |
make install |
165 |
> |
|
166 |
> |
cd ../cloog-ppl-%{cloogpplVersion} |
167 |
> |
./configure --prefix=%i --with-ppl=%i --with-gmp=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
168 |
> |
make %makeprocesses |
169 |
> |
make install |
170 |
> |
|
171 |
> |
CONF_GCC_VERSION_OPTS="$CONF_GCC_VERSION_OPTS --with-ppl=%i --with-cloog=%i" |
172 |
> |
fi |
173 |
|
|
174 |
|
# Build the compilers |
175 |
|
cd ../gcc-%realversion |
176 |
|
mkdir -p obj |
177 |
|
cd obj |
178 |
< |
CC="gcc $CCOPTS" \ |
178 |
> |
export LD_LIBRARY_PATH=%i/lib64:%i/lib:$LD_LIBRARY_PATH |
179 |
|
../configure --prefix=%i \ |
180 |
< |
--enable-languages=c,c++,`case %v in 3.*) echo f77;; *) echo fortran;; esac` \ |
181 |
< |
%gcc4opts --enable-shared |
180 |
> |
--enable-languages=c,c++,fortran \ |
181 |
> |
$CONF_GCC_VERSION_OPTS --enable-shared CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
182 |
|
|
183 |
|
make %makeprocesses bootstrap |
184 |
+ |
make install |
185 |
|
|
186 |
|
%install |
187 |
< |
cd %_builddir/gcc-%{realversion}/obj && make install |
187 |
> |
cd %_builddir/gcc-%{realversion}/obj && make install |
188 |
> |
|
189 |
|
ln -s gcc %i/bin/cc |
190 |
|
find %i/lib %i/lib32 %i/lib64 -name '*.la' -exec rm -f {} \; || true |
104 |
– |
|
191 |
|
# SCRAM ToolBox toolfile is now geneated by the gcc-toolfile.spec |
192 |
|
# so that everything works even in the case "--use-system-compiler" |
193 |
|
# option is specified. |
108 |
– |
|
109 |
– |
%post |
110 |
– |
# %{relocateConfig}lib/libg2c.la |
111 |
– |
# %{relocateConfig}lib/libstdc++.la |
112 |
– |
# %{relocateConfig}lib/libsupc++.la |
113 |
– |
# %if "%cpu" == "amd64" |
114 |
– |
# %{relocateConfig}lib64/libg2c.la |
115 |
– |
# %{relocateConfig}lib64/libstdc++.la |
116 |
– |
# %{relocateConfig}lib64/libsupc++.la |
117 |
– |
# %{relocateConfig}lib/32/libg2c.la |
118 |
– |
# %{relocateConfig}lib/32/libstdc++.la |
119 |
– |
# %{relocateConfig}lib/32/libsupc++.la |
120 |
– |
# %endif |
121 |
– |
# %if "%gcc4" == "true" |
122 |
– |
# %{relocateConfig}lib/libgfortran.la |
123 |
– |
# %{relocateConfig}lib/libgfortranbegin.la |
124 |
– |
# %endif |