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