1 |
< |
### RPM external gcc 3.4.4 |
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 [ $(uname) != Darwin ] |
5 |
< |
Source: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%v/%n-%v.tar.bz2 |
4 |
> |
Source0: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%realversion/%n-%realversion.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 |
+ |
# 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 |
+ |
|
31 |
+ |
%prep |
32 |
+ |
echo "use_custom_binutils: %use_custom_binutils" |
33 |
+ |
%setup -T -b 0 -n gcc-%realversion |
34 |
+ |
|
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" |
42 |
+ |
tmake_file="$tmake_file i386/t-cms" |
43 |
+ |
EOF_CONFIG_GCC |
44 |
+ |
|
45 |
+ |
cat << \EOF_CMS_H > gcc/config/i386/cms.h |
46 |
+ |
#undef ASM_SPEC |
47 |
+ |
#define ASM_SPEC "%%{v:-V} %%{Qy:} %%{!Qn:-Qy} %%{n} %%{T} %%{Ym,*} %%{Yd,*} %%{Wa,*:%%*} --32" |
48 |
+ |
#undef CC1_SPEC |
49 |
+ |
#define CC1_SPEC "%%(cc1_cpu) %%{profile:-p} -m32" |
50 |
+ |
#undef CC1PLUS_SPEC |
51 |
+ |
#define CC1PLUS_SPEC "-m32" |
52 |
+ |
#undef MULTILIB_DEFAULTS |
53 |
+ |
#define MULTILIB_DEFAULTS { "m32" } |
54 |
+ |
EOF_CMS_H |
55 |
+ |
|
56 |
+ |
cat << \EOF_T_CMS > gcc/config/i386/t-cms |
57 |
+ |
MULTILIB_OPTIONS = m32 |
58 |
+ |
MULTILIB_DIRNAMES = ../lib |
59 |
+ |
MULTILIB_MATCHES = m32=m32 |
60 |
+ |
EOF_T_CMS |
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 |
+ |
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 |
8 |
– |
# FIXME: --enable-__cxa_atexit can't be used with gcc 3.2.3 on RH 7.3, |
9 |
– |
# enabling it causes qt's uic to die with segmentation violation half |
10 |
– |
# way down the build of qt (projecsettings.ui or something like that; |
11 |
– |
# not the first or only call to uic). Disabling the flag removes the |
12 |
– |
# issue, so clearly the option does not work correctly on this |
13 |
– |
# platform combination. |
14 |
– |
mkdir -p obj |
15 |
– |
cd obj |
102 |
|
|
103 |
< |
if [ "`echo %v | cut -d. -f 1`" == "3" ] |
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 %{cmsos} in |
108 |
> |
slc*_ia32) |
109 |
> |
CCOPTS="-fPIC -m32 -Wa,--32" ;; |
110 |
> |
*) |
111 |
> |
CCOPTS="-fPIC" ;; |
112 |
> |
esac |
113 |
> |
|
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 |
< |
../configure --prefix=%i --enable-languages=c,c++,f77 \ |
130 |
< |
--enable-shared # --enable-__cxa_atexit |
131 |
< |
else |
132 |
< |
../configure --prefix=%i --enable-languages=c,c++ \ |
133 |
< |
--enable-shared # --enable-__cxa_atexit |
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/MPC |
143 |
+ |
cd ../gmp-%{gmpVersion} |
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 |
+ |
./configure --prefix=%i --with-gmp=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX" |
150 |
+ |
make %makeprocesses |
151 |
+ |
make install |
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 |
+ |
export LD_LIBRARY_PATH=%i/lib64:%i/lib:$LD_LIBRARY_PATH |
179 |
+ |
../configure --prefix=%i \ |
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 obj && make install |
187 |
> |
cd %_builddir/gcc-%{realversion}/obj && make install |
188 |
> |
|
189 |
|
ln -s gcc %i/bin/cc |
190 |
< |
# |
191 |
< |
# |
190 |
> |
find %i/lib %i/lib32 %i/lib64 -name '*.la' -exec rm -f {} \; || true |
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. |