1 |
< |
### RPM external gcc 3.2.3 |
1 |
> |
### RPM external gcc 4.3.4 |
2 |
> |
## BUILDIF case `uname`:`uname -p` in Linux:i*86 ) true ;; Linux:x86_64 ) true ;; Linux:ppc64 ) false ;; Darwin:* ) false ;; * ) true ;; esac |
3 |
|
## INITENV +PATH LD_LIBRARY_PATH %i/lib/32 |
4 |
|
## INITENV +PATH LD_LIBRARY_PATH %i/lib64 |
5 |
< |
## BUILDIF [ $(uname) != Darwin ] |
6 |
< |
Source: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%v/%n-%v.tar.bz2 |
5 |
> |
Source0: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%realversion/%n-%realversion.tar.bz2 |
6 |
> |
%if "%(echo %cmsos | cut -f2 -d_)" == "amd64" |
7 |
> |
%define binutilsv 2.19.1 |
8 |
> |
Source3: http://ftp.gnu.org/gnu/binutils/binutils-%binutilsv.tar.bz2 |
9 |
> |
%endif |
10 |
> |
|
11 |
> |
|
12 |
> |
# If gcc version >= 4.0.0, we need two additional sources, for gmp and mpfr, |
13 |
> |
# and we set the fortranCompiler macro (which is going to be used by the |
14 |
> |
# --enable-languages option of gcc's configure) to gfortran. |
15 |
> |
# Notice that we need to build those twice: once using the system compiler |
16 |
> |
# and the using the newly built gcc. |
17 |
> |
%define gmpVersion 4.2.4 |
18 |
> |
%define mpfrVersion 2.3.2 |
19 |
> |
Source1: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmpVersion}.tar.bz2 |
20 |
> |
Source2: http://www.mpfr.org/mpfr-%{mpfrVersion}/mpfr-%{mpfrVersion}.tar.bz2 |
21 |
> |
Patch0: binutils-2.19.1-fix-gold |
22 |
> |
|
23 |
> |
%define cpu %(echo %cmsplatf | cut -d_ -f2) |
24 |
> |
%define gcc_major %(echo %realversion | cut -f1 -d.) |
25 |
> |
%prep |
26 |
> |
%setup -T -b 0 -n gcc-%realversion |
27 |
> |
|
28 |
> |
case %cmsos in |
29 |
> |
"slc4_ia32" | "slc5_ia32" ) |
30 |
> |
cat << \EOF_CONFIG_GCC >> gcc/config.gcc |
31 |
> |
# CMS patch to include gcc/config/i386/t-cms when building gcc |
32 |
> |
tm_file="$tm_file i386/cms.h" |
33 |
> |
tmake_file="$tmake_file i386/t-cms" |
34 |
> |
EOF_CONFIG_GCC |
35 |
> |
|
36 |
> |
cat << \EOF_CMS_H > gcc/config/i386/cms.h |
37 |
> |
#undef ASM_SPEC |
38 |
> |
#define ASM_SPEC "%%{v:-V} %%{Qy:} %%{!Qn:-Qy} %%{n} %%{T} %%{Ym,*} %%{Yd,*} %%{Wa,*:%%*} --32" |
39 |
> |
#undef CC1_SPEC |
40 |
> |
#define CC1_SPEC "%%(cc1_cpu) %%{profile:-p} -m32" |
41 |
> |
#undef CC1PLUS_SPEC |
42 |
> |
#define CC1PLUS_SPEC "-m32" |
43 |
> |
#undef MULTILIB_DEFAULTS |
44 |
> |
#define MULTILIB_DEFAULTS { "m32" } |
45 |
> |
EOF_CMS_H |
46 |
> |
|
47 |
> |
cat << \EOF_T_CMS > gcc/config/i386/t-cms |
48 |
> |
MULTILIB_OPTIONS = m32 |
49 |
> |
MULTILIB_DIRNAMES = ../lib |
50 |
> |
MULTILIB_MATCHES = m32=m32 |
51 |
> |
EOF_T_CMS |
52 |
> |
;; |
53 |
> |
esac |
54 |
> |
|
55 |
> |
%if "%{?binutilsv:set}" == "set" |
56 |
> |
%setup -D -T -b 3 -n binutils-%binutilsv |
57 |
> |
%patch0 -p1 |
58 |
> |
case %cmsos in |
59 |
> |
slc*_amd64 ) |
60 |
> |
# This patches the default linker script to align stuff at 4096 kB boundaries rather |
61 |
> |
# than the default 2MB (MAXPAGESIZE value for x86_64 architecture). |
62 |
> |
perl -p -i -e 's|\$[{]MAXPAGESIZE[}]|4096|g;s|\$[{]SEGMENT_SIZE[}]|4096|g' ld/scripttempl/elf.sc |
63 |
> |
;; |
64 |
> |
esac |
65 |
> |
%endif |
66 |
> |
|
67 |
> |
%setup -D -T -b 1 -n gmp-%{gmpVersion} |
68 |
> |
%setup -D -T -b 2 -n mpfr-%{mpfrVersion} |
69 |
|
|
70 |
|
%build |
71 |
< |
# FIXME: --enable-__cxa_atexit can't be used with gcc 3.2.3 on RH 7.3, |
72 |
< |
# enabling it causes qt's uic to die with segmentation violation half |
73 |
< |
# way down the build of qt (projecsettings.ui or something like that; |
74 |
< |
# not the first or only call to uic). Disabling the flag removes the |
75 |
< |
# issue, so clearly the option does not work correctly on this |
76 |
< |
# platform combination. |
71 |
> |
# Set special variables required to build 32-bit executables on 64-bit |
72 |
> |
# systems. Note that if the architecture is SLC4/IA32, we may be on a |
73 |
> |
# 64-bit system and need to produce a 32-bit capable compiler, which |
74 |
> |
# _itself_ is a 32-bit executable. |
75 |
> |
case $(uname -m):%{cmsos} in |
76 |
> |
*:slc4_ia32 ) |
77 |
> |
CCOPTS="-m32 -Wa,--32" ;; |
78 |
> |
*:slc5_ia32 ) |
79 |
> |
CCOPTS="-m32 -Wa,--32" ;; |
80 |
> |
* ) |
81 |
> |
CCOPTS="" ;; |
82 |
> |
esac |
83 |
> |
# If requested, build our own binutils. Currently the default is to use |
84 |
> |
# the system binutils. |
85 |
> |
%if "%{?binutilsv:set}" == "set" |
86 |
> |
cd ../binutils-%{binutilsv} |
87 |
> |
CC="gcc $CCOPTS" ./configure --prefix=%i |
88 |
> |
make %makeprocesses |
89 |
> |
perl -p -i -e 's|LN = ln|LN = cp -p|;s|ln ([^-])|cp -p $1|g' `find . -name Makefile` |
90 |
> |
make install |
91 |
> |
%endif |
92 |
> |
|
93 |
> |
# Build GMP/MPFR for GCC 4.x |
94 |
> |
%define gcc4opts %{nil} |
95 |
> |
%if "%gcc_major" == "4" |
96 |
> |
cd ../gmp-%{gmpVersion} |
97 |
> |
CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/gmp --disable-shared |
98 |
> |
make %makeprocesses |
99 |
> |
make install |
100 |
> |
|
101 |
> |
cd ../mpfr-%{mpfrVersion} |
102 |
> |
CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/mpfr --with-gmp=%i/tmp/gmp --disable-shared |
103 |
> |
make %makeprocesses |
104 |
> |
make install |
105 |
> |
%define gcc4opts --with-gmp=%i/tmp/gmp --with-mpfr=%i/tmp/mpfr |
106 |
> |
%endif |
107 |
> |
|
108 |
> |
# Build the compilers |
109 |
> |
cd ../gcc-%realversion |
110 |
|
mkdir -p obj |
111 |
|
cd obj |
112 |
|
|
113 |
< |
if [ "`echo %v | cut -d. -f 1`" == "3" ] |
114 |
< |
then |
115 |
< |
../configure --prefix=%i --enable-languages=c,c++,f77 \ |
116 |
< |
--enable-shared # --enable-__cxa_atexit |
117 |
< |
else |
22 |
< |
../configure --prefix=%i --enable-languages=c,c++ \ |
23 |
< |
--enable-shared # --enable-__cxa_atexit |
24 |
< |
fi |
113 |
> |
CC="gcc $CCOPTS" \ |
114 |
> |
../configure --prefix=%i \ |
115 |
> |
--enable-languages=c,c++,`case %v in 3.*) echo f77;; *) echo fortran;; esac` \ |
116 |
> |
%gcc4opts --enable-shared |
117 |
> |
|
118 |
|
make %makeprocesses bootstrap |
119 |
|
|
120 |
|
%install |
121 |
< |
cd obj && make install |
121 |
> |
cd %_builddir/gcc-%{realversion}/obj && make install |
122 |
> |
|
123 |
|
ln -s gcc %i/bin/cc |
124 |
+ |
find %i/lib %i/lib32 %i/lib64 -name '*.la' -exec rm -f {} \; || true |
125 |
+ |
|
126 |
+ |
# SCRAM ToolBox toolfile is now geneated by the gcc-toolfile.spec |
127 |
+ |
# so that everything works even in the case "--use-system-compiler" |
128 |
+ |
# option is specified. |