1 |
< |
### RPM external gcc 4.1.2 |
1 |
> |
### RPM external gcc 3.4.5-wt1 |
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 |
5 |
– |
%define realversion %(echo %v | cut -d- -f1 ) |
5 |
|
Source0: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%realversion/%n-%realversion.tar.bz2 |
6 |
|
%define binutilsv 2.17 |
7 |
|
Source1: http://ftp.gnu.org/gnu/binutils/binutils-%binutilsv.tar.bz2 |
11 |
|
# --enable-languages option of gcc's configure) to gfortran. |
12 |
|
# Notice that we need to build those twice: once using the system compiler |
13 |
|
# and the using the newly built gcc. |
15 |
– |
# I also set the convenience macro gcc4 to ease gcc detection. |
14 |
|
%define gmpVersion 4.2.1 |
15 |
|
%define mpfrVersion 2.2.1 |
16 |
|
Source2: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmpVersion}.tar.bz2 |
17 |
|
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 |
– |
|
18 |
|
|
19 |
|
%define cpu %(echo %cmsplatf | cut -d_ -f2) |
20 |
|
%prep |
28 |
|
EOF_CONFIG_GCC |
29 |
|
|
30 |
|
cat << \EOF_CMS_H > gcc/config/i386/cms.h |
31 |
+ |
#undef ASM_SPEC |
32 |
|
#define ASM_SPEC "%%{v:-V} %%{Qy:} %%{!Qn:-Qy} %%{n} %%{T} %%{Ym,*} %%{Yd,*} %%{Wa,*:%%*} --32" |
33 |
+ |
#undef CC1_SPEC |
34 |
|
#define CC1_SPEC "%%(cc1_cpu) %%{profile:-p} -m32" |
35 |
+ |
#undef CC1PLUS_SPEC |
36 |
|
#define CC1PLUS_SPEC "-m32" |
37 |
+ |
#undef MULTILIB_DEFAULTS |
38 |
|
#define MULTILIB_DEFAULTS { "m32" } |
39 |
|
EOF_CMS_H |
40 |
|
|
45 |
|
EOF_T_CMS |
46 |
|
%endif |
47 |
|
|
55 |
– |
#perl -p -i -e 's|SPECS = specs|SPECS = specs.install|' gcc/Makefile.in |
48 |
|
%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" |
49 |
|
%setup -D -T -b 2 -n gmp-%{gmpVersion} |
50 |
|
%setup -D -T -b 3 -n mpfr-%{mpfrVersion} |
62 |
– |
%endif |
51 |
|
|
52 |
|
%build |
53 |
< |
# FIXME: --enable-__cxa_atexit can't be used with gcc 3.2.3 on RH 7.3, |
54 |
< |
# enabling it causes qt's uic to die with segmentation violation half |
55 |
< |
# way down the build of qt (projecsettings.ui or something like that; |
56 |
< |
# not the first or only call to uic). Disabling the flag removes the |
57 |
< |
# issue, so clearly the option does not work correctly on this |
58 |
< |
# platform combination. |
59 |
< |
|
60 |
< |
|
61 |
< |
# The buildGCC function is an utility function to ease the creation of |
62 |
< |
# cross compilers. |
63 |
< |
buildGCC () { |
64 |
< |
target=$1 |
65 |
< |
host=$2 |
66 |
< |
prefix=$3 |
67 |
< |
|
68 |
< |
if [ "X$target" != "X" ] |
69 |
< |
then |
70 |
< |
targetOption="--target $target" |
83 |
< |
fi |
84 |
< |
|
85 |
< |
if [ "X$host" != "X" ] |
86 |
< |
then |
87 |
< |
hostOption="--host $host" |
88 |
< |
fi |
89 |
< |
|
90 |
< |
languages=c,c++%{fortranCompiler} |
91 |
< |
|
92 |
< |
if [ "$prefix" == "" ] |
93 |
< |
then |
94 |
< |
prefix=%i |
95 |
< |
fi |
96 |
< |
|
97 |
< |
mkdir -p obj-$target |
98 |
< |
cd obj-$target |
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} \ |
53 |
> |
# Set special variables required to build 32-bit executables on 64-bit |
54 |
> |
# systems. Note that if the architecture is SLC4/IA32, we may be on a |
55 |
> |
# 64-bit system and need to produce a 32-bit capable compiler, which |
56 |
> |
# _itself_ is a 32-bit executable. |
57 |
> |
case $(uname -m):%{cmsos} in |
58 |
> |
*:slc4_ia32 ) |
59 |
> |
CCOPTS="-m32 -Wa,--32" ;; |
60 |
> |
* ) |
61 |
> |
CCOPTS="" ;; |
62 |
> |
esac |
63 |
> |
|
64 |
> |
# If requested, build our own binutils. Currently the default is to use |
65 |
> |
# the system binutils. |
66 |
> |
%if "%{?use_external_binutils:set}" == "set" |
67 |
> |
cd ../binutils-%{binutilsv} |
68 |
> |
CC="gcc $CCOPTS" ./configure --prefix=%i |
69 |
> |
make %makeprocesses |
70 |
> |
make install |
71 |
|
%endif |
106 |
– |
$targetOption \ |
107 |
– |
$hostOption |
108 |
– |
make %makeprocesses bootstrap |
109 |
– |
make install |
110 |
– |
cd .. |
111 |
– |
} |
112 |
– |
|
113 |
– |
# create a tmp |
114 |
– |
mkdir -p %i/tmp |
115 |
– |
|
116 |
– |
# build the latest/greatest binutils |
117 |
– |
mkdir -p %i/tmp/binutils |
118 |
– |
cd ../binutils-%{binutilsv} |
119 |
– |
./configure --prefix=%i/tmp/binutils |
120 |
– |
make %makeprocesses |
121 |
– |
make install |
122 |
– |
export PATH=%i/tmp/binutils/bin:$PATH |
123 |
– |
export LD_LIBRARY_PATH=%i/tmp/binutils/lib:$PATH |
124 |
– |
|
125 |
– |
# build the native platform compiler |
126 |
– |
cd ../gcc-%v |
127 |
– |
mkdir -p obj |
128 |
– |
cd obj |
129 |
– |
../configure --prefix=%i --enable-languages=c,c++%{firstStepFortran} \ |
130 |
– |
--enable-shared |
131 |
– |
|
132 |
– |
make %makeprocesses bootstrap |
133 |
– |
make install |
134 |
– |
cd .. |
72 |
|
|
73 |
< |
# rebuild binutils with the new compiler |
137 |
< |
export PATH=%i/bin:$PATH |
138 |
< |
export LD_LIBRARY_PATH=%i/lib:$PATH |
139 |
< |
cd ../binutils-%binutilsv |
140 |
< |
./configure --prefix=%i |
141 |
< |
make %makeprocesses |
142 |
< |
make install |
143 |
< |
rm -fr %i/tmp |
144 |
< |
|
145 |
< |
# And if we are building gcc4, we build gmp and mpfr as well and then rebuild gcc4 with fortran support. |
146 |
< |
%if "%{?gcc4:set}" == "set" |
73 |
> |
# Build GMP/MPFR for GCC 4.x |
74 |
|
cd ../gmp-%{gmpVersion} |
75 |
< |
./configure --prefix=%i |
75 |
> |
CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/gmp --disable-shared |
76 |
|
make %makeprocesses |
77 |
|
make install |
78 |
|
|
79 |
|
cd ../mpfr-%{mpfrVersion} |
80 |
< |
./configure --prefix=%i --with-gmp=%i |
80 |
> |
CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/mpfr --with-gmp=%i/tmp/gmp --disable-shared |
81 |
|
make %makeprocesses |
155 |
– |
make install |
156 |
– |
|
157 |
– |
cd ../gcc-%{v}/obj |
158 |
– |
make distclean |
159 |
– |
cd .. |
82 |
|
|
83 |
< |
buildGCC |
83 |
> |
# Build the compilers |
84 |
> |
cd ../gcc-%realversion |
85 |
> |
mkdir -p obj |
86 |
> |
cd obj |
87 |
> |
CC="gcc $CCOPTS" \ |
88 |
> |
../configure --prefix=%i \ |
89 |
> |
--enable-languages=c,c++,`case %v in 3.*) echo f77;; *) echo fortran;; esac` \ |
90 |
> |
--with-gmp-dir=%_builddir/gmp-%{gmpVersion} \ |
91 |
> |
--with-mpfr-dir=%_builddir/mpfr-%{mpfrVersion} \ |
92 |
> |
--enable-shared |
93 |
|
|
94 |
< |
%endif |
94 |
> |
make %makeprocesses bootstrap |
95 |
|
|
96 |
|
%install |
97 |
< |
#cd obj && make install |
97 |
> |
cd %_builddir/gcc-%{realversion}/obj && make install |
98 |
|
ln -s gcc %i/bin/cc |
99 |
+ |
find %i/lib %i/lib32 %i/lib64 -name '*.la' -exec rm -f {} \; || true |
100 |
+ |
|
101 |
|
%post |
102 |
< |
%{relocateConfig}lib/libg2c.la |
103 |
< |
%{relocateConfig}lib/libstdc++.la |
104 |
< |
%{relocateConfig}lib/libsupc++.la |
105 |
< |
%if "%cpu" == "amd64" |
106 |
< |
%{relocateConfig}lib64/libg2c.la |
107 |
< |
%{relocateConfig}lib64/libstdc++.la |
108 |
< |
%{relocateConfig}lib64/libsupc++.la |
109 |
< |
%{relocateConfig}lib/32/libg2c.la |
110 |
< |
%{relocateConfig}lib/32/libstdc++.la |
111 |
< |
%{relocateConfig}lib/32/libsupc++.la |
112 |
< |
%endif |
113 |
< |
%if "%gcc4" == "true" |
114 |
< |
%{relocateConfig}lib/libbfd.la |
115 |
< |
%{relocateConfig}lib/libgmp.la |
116 |
< |
%{relocateConfig}lib/libopcodes.la |
184 |
< |
%{relocateConfig}lib/libmudflap.la |
185 |
< |
%{relocateConfig}lib/libgfortran.la |
186 |
< |
%{relocateConfig}lib/libmudflapth.la |
187 |
< |
%{relocateConfig}lib/libmpfr.la |
188 |
< |
%{relocateConfig}lib/libssp.la |
189 |
< |
%{relocateConfig}lib/libgfortranbegin.la |
190 |
< |
%endif |
102 |
> |
# %{relocateConfig}lib/libg2c.la |
103 |
> |
# %{relocateConfig}lib/libstdc++.la |
104 |
> |
# %{relocateConfig}lib/libsupc++.la |
105 |
> |
# %if "%cpu" == "amd64" |
106 |
> |
# %{relocateConfig}lib64/libg2c.la |
107 |
> |
# %{relocateConfig}lib64/libstdc++.la |
108 |
> |
# %{relocateConfig}lib64/libsupc++.la |
109 |
> |
# %{relocateConfig}lib/32/libg2c.la |
110 |
> |
# %{relocateConfig}lib/32/libstdc++.la |
111 |
> |
# %{relocateConfig}lib/32/libsupc++.la |
112 |
> |
# %endif |
113 |
> |
# %if "%gcc4" == "true" |
114 |
> |
# %{relocateConfig}lib/libgfortran.la |
115 |
> |
# %{relocateConfig}lib/libgfortranbegin.la |
116 |
> |
# %endif |