1 |
< |
### RPM external gcc 3.4.5-CMS2 |
1 |
> |
### RPM external gcc 4.1.2 |
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 |
6 |
|
Source0: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%realversion/%n-%realversion.tar.bz2 |
7 |
|
%define binutilsv 2.17 |
8 |
|
Source1: http://ftp.gnu.org/gnu/binutils/binutils-%binutilsv.tar.bz2 |
9 |
+ |
|
10 |
+ |
# If gcc version >= 4.0.0, we need two additional sources, for gmp and mpfr, |
11 |
+ |
# and we set the fortranCompiler macro (which is going to be used by the |
12 |
+ |
# --enable-languages option of gcc's configure) to gfortran. |
13 |
+ |
# Notice that we need to build those twice: once using the system compiler |
14 |
+ |
# and the using the newly built gcc. |
15 |
+ |
# I also set the convenience macro gcc4 to ease gcc detection. |
16 |
+ |
%define gmpVersion 4.2.1 |
17 |
+ |
%define mpfrVersion 2.2.1 |
18 |
+ |
Source2: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmpVersion}.tar.bz2 |
19 |
+ |
Source3: http://www.mpfr.org/mpfr-current/mpfr-%{mpfrVersion}.tar.bz2 |
20 |
+ |
%if "%(echo %v | cut -f1 -d. )" == "4" |
21 |
+ |
%define gcc4 true |
22 |
+ |
%define firstStepFortran %{nil} |
23 |
+ |
%define fortranCompiler ,fortran |
24 |
+ |
%else |
25 |
+ |
%define firstStepFortran ,f77 |
26 |
+ |
%define fortranCompiler ,f77 |
27 |
+ |
%endif |
28 |
+ |
|
29 |
+ |
|
30 |
|
%define cpu %(echo %cmsplatf | cut -d_ -f2) |
31 |
|
%prep |
32 |
|
%setup -T -b 0 -n gcc-%realversion |
54 |
|
|
55 |
|
#perl -p -i -e 's|SPECS = specs|SPECS = specs.install|' gcc/Makefile.in |
56 |
|
%setup -D -T -b 1 -n binutils-%binutilsv |
57 |
+ |
|
58 |
+ |
# We need to setup gmp and mpfr as well if the compiler version is >= 4.0.0. |
59 |
+ |
%if "%{?gcc4:set}" == "set" |
60 |
+ |
%setup -D -T -b 2 -n gmp-%{gmpVersion} |
61 |
+ |
%setup -D -T -b 3 -n mpfr-%{mpfrVersion} |
62 |
+ |
%endif |
63 |
+ |
|
64 |
|
%build |
65 |
|
# FIXME: --enable-__cxa_atexit can't be used with gcc 3.2.3 on RH 7.3, |
66 |
|
# enabling it causes qt's uic to die with segmentation violation half |
69 |
|
# issue, so clearly the option does not work correctly on this |
70 |
|
# platform combination. |
71 |
|
|
72 |
+ |
|
73 |
+ |
# The buildGCC function is an utility function to ease the creation of |
74 |
+ |
# cross compilers. |
75 |
|
buildGCC () { |
76 |
|
target=$1 |
77 |
|
host=$2 |
87 |
|
hostOption="--host $host" |
88 |
|
fi |
89 |
|
|
90 |
< |
languages=c,c++ |
60 |
< |
if [ "`echo %realversion | cut -d. -f 1`" == "3" ] |
61 |
< |
then |
62 |
< |
languages=c,c++,f77 |
63 |
< |
fi |
90 |
> |
languages=c,c++%{fortranCompiler} |
91 |
|
|
92 |
|
if [ "$prefix" == "" ] |
93 |
|
then |
96 |
|
|
97 |
|
mkdir -p obj-$target |
98 |
|
cd obj-$target |
99 |
< |
|
99 |
> |
|
100 |
|
../configure --prefix=$prefix --enable-languages=$languages \ |
101 |
|
--enable-shared \ |
102 |
+ |
%if "%{gcc4}" == "true" |
103 |
+ |
--with-gmp-dir=%_builddir/gmp-%{gmpVersion} \ |
104 |
+ |
--with-mpfr-dir=%_builddir/mpfr-%{mpfrVersion} \ |
105 |
+ |
%endif |
106 |
|
$targetOption \ |
107 |
|
$hostOption |
108 |
< |
make CC1_SPEC="bogus" %makeprocesses bootstrap |
108 |
> |
make %makeprocesses bootstrap |
109 |
|
make install |
110 |
|
cd .. |
111 |
|
} |
119 |
|
./configure --prefix=%i/tmp/binutils |
120 |
|
make %makeprocesses |
121 |
|
make install |
91 |
– |
|
92 |
– |
# build the native platform compiler |
93 |
– |
cd ../gcc-%realversion |
122 |
|
export PATH=%i/tmp/binutils/bin:$PATH |
123 |
|
export LD_LIBRARY_PATH=%i/tmp/binutils/lib:$PATH |
124 |
< |
buildGCC |
124 |
> |
|
125 |
> |
# Build gmp/mpfr |
126 |
> |
%if "%{?gcc4:set}" == "set" |
127 |
> |
cd ../gmp-%{gmpVersion} |
128 |
> |
./configure --prefix=%i/tmp/gmp --disable-shared |
129 |
> |
make %makeprocesses |
130 |
> |
|
131 |
> |
cd ../mpfr-%{mpfrVersion} |
132 |
> |
./configure --prefix=%i/tmp/mpfr --with-gmp=%i/tmp/gmp --disable-shared |
133 |
> |
make %makeprocesses |
134 |
> |
%endif |
135 |
> |
|
136 |
> |
# build the native platform compiler |
137 |
> |
cd ../gcc-%v |
138 |
> |
mkdir -p obj |
139 |
> |
cd obj |
140 |
> |
../configure --prefix=%i --enable-languages=c,c++%{fortranCompiler} \ |
141 |
> |
%if "%{gcc4}" == "true" |
142 |
> |
--with-gmp-dir=%_builddir/gmp-%{gmpVersion} \ |
143 |
> |
--with-mpfr-dir=%_builddir/mpfr-%{mpfrVersion} \ |
144 |
> |
%endif |
145 |
> |
--enable-shared |
146 |
> |
|
147 |
> |
make %makeprocesses bootstrap |
148 |
> |
make install |
149 |
> |
cd .. |
150 |
|
|
151 |
|
# rebuild binutils with the new compiler |
152 |
|
export PATH=%i/bin:$PATH |
157 |
|
make install |
158 |
|
rm -fr %i/tmp |
159 |
|
|
107 |
– |
|
160 |
|
%install |
161 |
|
#cd obj && make install |
162 |
|
ln -s gcc %i/bin/cc |
172 |
|
%{relocateConfig}lib/32/libstdc++.la |
173 |
|
%{relocateConfig}lib/32/libsupc++.la |
174 |
|
%endif |
175 |
+ |
%if "%gcc4" == "true" |
176 |
+ |
%{relocateConfig}lib/libbfd.la |
177 |
+ |
%{relocateConfig}lib/libopcodes.la |
178 |
+ |
%{relocateConfig}lib/libgfortran.la |
179 |
+ |
%{relocateConfig}lib/libgfortranbegin.la |
180 |
+ |
%endif |