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 [ $(uname) != Darwin ] |
5 |
< |
Source: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%v/%n-%v.tar.bz2 |
4 |
> |
## BUILDIF case $(uname):$(uname -p) in Linux:i*86 ) true ;; Linux:x86_64 ) true ;; Linux:ppc64 ) false ;; Darwin:* ) false ;; * ) true ;; esac |
5 |
> |
Source0: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%v/%n-%v.tar.bz2 |
6 |
> |
%define binutilsv 2.17 |
7 |
> |
Source1: http://ftp.gnu.org/gnu/binutils/binutils-%binutilsv.tar.bz2 |
8 |
|
%define cpu %(echo %cmsplatf | cut -d_ -f2) |
9 |
+ |
%prep |
10 |
+ |
%setup -T -b 0 -n gcc-%v |
11 |
+ |
|
12 |
+ |
%if "%cmsos" == "slc4_ia32" |
13 |
+ |
cat << \EOF_CONFIG_GCC >> gcc/config.gcc |
14 |
+ |
# CMS patch to include gcc/config/i386/t-cms when building gcc |
15 |
+ |
tm_file="$tm_file i386/cms.h" |
16 |
+ |
tmake_file="$tmake_file i386/t-cms" |
17 |
+ |
EOF_CONFIG_GCC |
18 |
+ |
|
19 |
+ |
cat << \EOF_CMS_H > gcc/config/i386/cms.h |
20 |
+ |
#define ASM_SPEC "%%{v:-V} %%{Qy:} %%{!Qn:-Qy} %%{n} %%{T} %%{Ym,*} %%{Yd,*} %%{Wa,*:%%*} --32" |
21 |
+ |
#define CC1_SPEC "%%(cc1_cpu) %%{profile:-p} -m32" |
22 |
+ |
#define CC1PLUS_SPEC "-m32" |
23 |
+ |
#define MULTILIB_DEFAULTS { "m32" } |
24 |
+ |
EOF_CMS_H |
25 |
+ |
|
26 |
+ |
cat << \EOF_T_CMS > gcc/config/i386/t-cms |
27 |
+ |
MULTILIB_OPTIONS = m32 |
28 |
+ |
MULTILIB_DIRNAMES = ../lib |
29 |
+ |
MULTILIB_MATCHES = m32=m32 |
30 |
+ |
EOF_T_CMS |
31 |
+ |
%endif |
32 |
+ |
|
33 |
+ |
#perl -p -i -e 's|SPECS = specs|SPECS = specs.install|' gcc/Makefile.in |
34 |
+ |
%setup -D -T -b 1 -n binutils-%binutilsv |
35 |
|
%build |
36 |
|
# FIXME: --enable-__cxa_atexit can't be used with gcc 3.2.3 on RH 7.3, |
37 |
|
# enabling it causes qt's uic to die with segmentation violation half |
39 |
|
# not the first or only call to uic). Disabling the flag removes the |
40 |
|
# issue, so clearly the option does not work correctly on this |
41 |
|
# platform combination. |
14 |
– |
mkdir -p obj |
15 |
– |
cd obj |
42 |
|
|
43 |
< |
if [ "`echo %v | cut -d. -f 1`" == "3" ] |
44 |
< |
then |
45 |
< |
../configure --prefix=%i --enable-languages=c,c++,f77 \ |
46 |
< |
--enable-shared # --enable-__cxa_atexit |
47 |
< |
else |
48 |
< |
../configure --prefix=%i --enable-languages=c,c++ \ |
49 |
< |
--enable-shared # --enable-__cxa_atexit |
50 |
< |
fi |
51 |
< |
make %makeprocesses bootstrap |
43 |
> |
buildGCC () { |
44 |
> |
target=$1 |
45 |
> |
host=$2 |
46 |
> |
prefix=$3 |
47 |
> |
|
48 |
> |
if [ "X$target" != "X" ] |
49 |
> |
then |
50 |
> |
targetOption="--target $target" |
51 |
> |
fi |
52 |
> |
|
53 |
> |
if [ "X$host" != "X" ] |
54 |
> |
then |
55 |
> |
hostOption="--host $host" |
56 |
> |
fi |
57 |
> |
|
58 |
> |
languages=c,c++ |
59 |
> |
if [ "`echo %v | cut -d. -f 1`" == "3" ] |
60 |
> |
then |
61 |
> |
languages=c,c++,f77 |
62 |
> |
fi |
63 |
> |
|
64 |
> |
if [ "$prefix" == "" ] |
65 |
> |
then |
66 |
> |
prefix=%i |
67 |
> |
fi |
68 |
> |
|
69 |
> |
mkdir -p obj-$target |
70 |
> |
cd obj-$target |
71 |
> |
|
72 |
> |
../configure --prefix=$prefix --enable-languages=$languages \ |
73 |
> |
--enable-shared \ |
74 |
> |
$targetOption \ |
75 |
> |
$hostOption |
76 |
> |
make CC1_SPEC="bogus" %makeprocesses bootstrap |
77 |
> |
make install |
78 |
> |
cd .. |
79 |
> |
} |
80 |
> |
|
81 |
> |
# create a tmp |
82 |
> |
mkdir -p %i/tmp |
83 |
> |
|
84 |
> |
# build the latest/greatest binutils |
85 |
> |
mkdir -p %i/tmp/binutils |
86 |
> |
cd ../binutils-%{binutilsv} |
87 |
> |
./configure --prefix=%i/tmp/binutils |
88 |
> |
make %makeprocesses |
89 |
> |
make install |
90 |
> |
|
91 |
> |
# build the native platform compiler |
92 |
> |
cd ../gcc-%v |
93 |
> |
export PATH=%i/tmp/binutils/bin:$PATH |
94 |
> |
export LD_LIBRARY_PATH=%i/tmp/binutils/lib:$PATH |
95 |
> |
buildGCC |
96 |
> |
|
97 |
> |
# rebuild binutils with the new compiler |
98 |
> |
export PATH=%i/bin:$PATH |
99 |
> |
export LD_LIBRARY_PATH=%i/lib:$PATH |
100 |
> |
cd ../binutils-%binutilsv |
101 |
> |
./configure --prefix=%i |
102 |
> |
make %makeprocesses |
103 |
> |
make install |
104 |
> |
rm -fr %i/tmp |
105 |
> |
|
106 |
|
|
107 |
|
%install |
108 |
< |
cd obj && make install |
108 |
> |
#cd obj && make install |
109 |
|
ln -s gcc %i/bin/cc |
110 |
|
%post |
111 |
|
%{relocateConfig}lib/libg2c.la |