1 |
< |
### RPM external gcc 4.1.2 |
1 |
> |
### RPM external gcc 3.4.5 |
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 |
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. |
15 |
|
%define gmpVersion 4.2.1 |
16 |
|
%define mpfrVersion 2.2.1 |
17 |
|
Source2: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmpVersion}.tar.bz2 |
18 |
|
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 |
– |
|
19 |
|
|
20 |
|
%define cpu %(echo %cmsplatf | cut -d_ -f2) |
21 |
|
%prep |
29 |
|
EOF_CONFIG_GCC |
30 |
|
|
31 |
|
cat << \EOF_CMS_H > gcc/config/i386/cms.h |
32 |
+ |
#undef ASM_SPEC |
33 |
|
#define ASM_SPEC "%%{v:-V} %%{Qy:} %%{!Qn:-Qy} %%{n} %%{T} %%{Ym,*} %%{Yd,*} %%{Wa,*:%%*} --32" |
34 |
+ |
#undef CC1_SPEC |
35 |
|
#define CC1_SPEC "%%(cc1_cpu) %%{profile:-p} -m32" |
36 |
+ |
#undef CC1PLUS_SPEC |
37 |
|
#define CC1PLUS_SPEC "-m32" |
38 |
+ |
#undef MULTILIB_DEFAULTS |
39 |
|
#define MULTILIB_DEFAULTS { "m32" } |
40 |
|
EOF_CMS_H |
41 |
|
|
46 |
|
EOF_T_CMS |
47 |
|
%endif |
48 |
|
|
55 |
– |
#perl -p -i -e 's|SPECS = specs|SPECS = specs.install|' gcc/Makefile.in |
49 |
|
%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" |
50 |
|
%setup -D -T -b 2 -n gmp-%{gmpVersion} |
51 |
|
%setup -D -T -b 3 -n mpfr-%{mpfrVersion} |
62 |
– |
%endif |
52 |
|
|
53 |
|
%build |
54 |
< |
# FIXME: --enable-__cxa_atexit can't be used with gcc 3.2.3 on RH 7.3, |
55 |
< |
# enabling it causes qt's uic to die with segmentation violation half |
56 |
< |
# way down the build of qt (projecsettings.ui or something like that; |
57 |
< |
# not the first or only call to uic). Disabling the flag removes the |
58 |
< |
# issue, so clearly the option does not work correctly on this |
59 |
< |
# platform combination. |
60 |
< |
|
61 |
< |
|
62 |
< |
# The buildGCC function is an utility function to ease the creation of |
63 |
< |
# cross compilers. |
64 |
< |
buildGCC () { |
65 |
< |
target=$1 |
66 |
< |
host=$2 |
67 |
< |
prefix=$3 |
68 |
< |
|
69 |
< |
if [ "X$target" != "X" ] |
70 |
< |
then |
71 |
< |
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} \ |
54 |
> |
# Set special variables required to build 32-bit executables on 64-bit |
55 |
> |
# systems. Note that if the architecture is SLC4/IA32, we may be on a |
56 |
> |
# 64-bit system and need to produce a 32-bit capable compiler, which |
57 |
> |
# _itself_ is a 32-bit executable. |
58 |
> |
case $(uname -m):%{cmsos} in |
59 |
> |
*:slc4_ia32 ) |
60 |
> |
CCOPTS="-m32 -Wa,--32" ;; |
61 |
> |
* ) |
62 |
> |
CCOPTS="" ;; |
63 |
> |
esac |
64 |
> |
|
65 |
> |
# If requested, build our own binutils. Currently the default is to use |
66 |
> |
# the system binutils. |
67 |
> |
%if "%{?use_external_binutils:set}" == "set" |
68 |
> |
cd ../binutils-%{binutilsv} |
69 |
> |
CC="gcc $CCOPTS" ./configure --prefix=%i |
70 |
> |
make %makeprocesses |
71 |
> |
make install |
72 |
|
%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 |
73 |
|
|
74 |
< |
# Build gmp/mpfr |
126 |
< |
%if "%{?gcc4:set}" == "set" |
74 |
> |
# Build GMP/MPFR for GCC 4.x |
75 |
|
cd ../gmp-%{gmpVersion} |
76 |
< |
./configure --prefix=%i/tmp/gmp --disable-shared |
76 |
> |
CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/gmp --disable-shared |
77 |
|
make %makeprocesses |
78 |
+ |
make install |
79 |
|
|
80 |
|
cd ../mpfr-%{mpfrVersion} |
81 |
< |
./configure --prefix=%i/tmp/mpfr --with-gmp=%i/tmp/gmp --disable-shared |
81 |
> |
CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/mpfr --with-gmp=%i/tmp/gmp --disable-shared |
82 |
|
make %makeprocesses |
134 |
– |
%endif |
83 |
|
|
84 |
< |
# build the native platform compiler |
84 |
> |
# Build the compilers |
85 |
|
cd ../gcc-%v |
86 |
|
mkdir -p obj |
87 |
|
cd obj |
88 |
< |
../configure --prefix=%i --enable-languages=c,c++%{fortranCompiler} \ |
89 |
< |
%if "%{gcc4}" == "true" |
90 |
< |
--with-gmp-dir=%_builddir/gmp-%{gmpVersion} \ |
91 |
< |
--with-mpfr-dir=%_builddir/mpfr-%{mpfrVersion} \ |
92 |
< |
%endif |
93 |
< |
--enable-shared |
88 |
> |
CC="gcc $CCOPTS" \ |
89 |
> |
../configure --prefix=%i \ |
90 |
> |
--enable-languages=c,c++,`case %v in 3.*) echo f77;; *) echo fortran;; esac` \ |
91 |
> |
--with-gmp-dir=%_builddir/gmp-%{gmpVersion} \ |
92 |
> |
--with-mpfr-dir=%_builddir/mpfr-%{mpfrVersion} \ |
93 |
> |
--enable-shared |
94 |
|
|
95 |
|
make %makeprocesses bootstrap |
148 |
– |
make install |
149 |
– |
cd .. |
150 |
– |
|
151 |
– |
# rebuild binutils with the new compiler |
152 |
– |
export PATH=%i/bin:$PATH |
153 |
– |
export LD_LIBRARY_PATH=%i/lib:$PATH |
154 |
– |
cd ../binutils-%binutilsv |
155 |
– |
./configure --prefix=%i |
156 |
– |
make %makeprocesses |
157 |
– |
make install |
158 |
– |
rm -fr %i/tmp |
96 |
|
|
97 |
|
%install |
98 |
< |
#cd obj && make install |
98 |
> |
cd %_builddir/gcc-%{v}/obj && make install |
99 |
|
ln -s gcc %i/bin/cc |
100 |
+ |
find %i/lib %i/lib32 %i/lib64 -name '*.la' -exec rm -f {} \; || true |
101 |
+ |
|
102 |
|
%post |
103 |
< |
%{relocateConfig}lib/libg2c.la |
104 |
< |
%{relocateConfig}lib/libstdc++.la |
105 |
< |
%{relocateConfig}lib/libsupc++.la |
106 |
< |
%if "%cpu" == "amd64" |
107 |
< |
%{relocateConfig}lib64/libg2c.la |
108 |
< |
%{relocateConfig}lib64/libstdc++.la |
109 |
< |
%{relocateConfig}lib64/libsupc++.la |
110 |
< |
%{relocateConfig}lib/32/libg2c.la |
111 |
< |
%{relocateConfig}lib/32/libstdc++.la |
112 |
< |
%{relocateConfig}lib/32/libsupc++.la |
113 |
< |
%endif |
114 |
< |
%if "%gcc4" == "true" |
115 |
< |
%{relocateConfig}lib/libbfd.la |
116 |
< |
%{relocateConfig}lib/libopcodes.la |
117 |
< |
%{relocateConfig}lib/libgfortran.la |
179 |
< |
%{relocateConfig}lib/libgfortranbegin.la |
180 |
< |
%endif |
103 |
> |
# %{relocateConfig}lib/libg2c.la |
104 |
> |
# %{relocateConfig}lib/libstdc++.la |
105 |
> |
# %{relocateConfig}lib/libsupc++.la |
106 |
> |
# %if "%cpu" == "amd64" |
107 |
> |
# %{relocateConfig}lib64/libg2c.la |
108 |
> |
# %{relocateConfig}lib64/libstdc++.la |
109 |
> |
# %{relocateConfig}lib64/libsupc++.la |
110 |
> |
# %{relocateConfig}lib/32/libg2c.la |
111 |
> |
# %{relocateConfig}lib/32/libstdc++.la |
112 |
> |
# %{relocateConfig}lib/32/libsupc++.la |
113 |
> |
# %endif |
114 |
> |
# %if "%gcc4" == "true" |
115 |
> |
# %{relocateConfig}lib/libgfortran.la |
116 |
> |
# %{relocateConfig}lib/libgfortranbegin.la |
117 |
> |
# %endif |