ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/gcc.spec
(Generate patch)

Comparing COMP/CMSDIST/gcc.spec (file contents):
Revision 1.2 by eulisse, Mon Feb 27 14:54:19 2006 UTC vs.
Revision 1.67 by elmer, Sun Mar 6 21:43:44 2011 UTC

# Line 1 | Line 1
1 < ### RPM external gcc 3.2.3
2 < ## BUILDIF [ $(uname) != Darwin ]
3 < Source: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%v/%n-%v.tar.gz
1 > ### RPM external gcc 4.6.0
2 > ## INITENV +PATH LD_LIBRARY_PATH %i/lib/32
3 > ## INITENV +PATH LD_LIBRARY_PATH %i/lib64
4 > %define realversion 4.6-20110226
5 > #Source0: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%realversion/%n-%realversion.tar.bz2
6 > Source0: ftp://ftp.nluug.nl/mirror/languages/gcc/snapshots/%realversion/gcc-%realversion.tar.bz2
7 > # If gcc version >= 4.0.0, we need two additional sources, for gmp and mpfr.
8 > %define gmpVersion 4.3.2
9 > %define mpfrVersion 2.4.2
10 > %define mpcVersion 0.8.1
11 > Source1: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmpVersion}.tar.bz2
12 > Source2: http://www.mpfr.org/mpfr-%{mpfrVersion}/mpfr-%{mpfrVersion}.tar.bz2
13 > Source3: http://www.multiprecision.org/mpc/download/mpc-%{mpcVersion}.tar.gz
14 >
15 > # For gcc 4.5+ we need the additional tools ppl and cloog.
16 > %define gcc_45plus %(echo %realversion | sed -e 's|4[.][5-9].*|true|')
17 > %if "%{gcc_45plus}" == "true"
18 > %define pplVersion 0.11
19 > %define cloogVersion 0.16.1
20 > Source4: http://www.cs.unipr.it/ppl/Download/ftp/releases/%{pplVersion}/ppl-%{pplVersion}.tar.bz2
21 > Source5: ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-%{cloogVersion}.tar.gz
22 > %endif
23 >
24 > # On 64bit Scientific Linux build our own binutils.
25 > %define use_custom_binutils %(echo %cmsos | sed -e 's|slc[0-9]*_amd64|true|')
26 > %if "%use_custom_binutils" == "true"
27 > %define bisonVersion 2.4
28 > %define binutilsv 2.20.1
29 > Source6: http://ftp.gnu.org/gnu/bison/bison-%{bisonVersion}.tar.bz2
30 > Source7: http://ftp.gnu.org/gnu/binutils/binutils-%binutilsv.tar.bz2
31 > %endif
32 >
33 > # gcc 4.5+ link time optimization support requires libelf to work. However
34 > # also rpm requires it. In order to have to duplicate dependencies we
35 > # build it in gcc and we pick it up from there also for rpm. Notice that
36 > # libelf does not work on Macosx however this is not a problem until
37 > # we use the system compiler there.
38 > %define isslc %(echo %cmsos | sed -e 's|slc.*|true|')
39 > %define elfutilsVersion 0.131
40 > %if "%isslc" == "true"
41 > Source8: ftp://sources.redhat.com/pub/systemtap/elfutils/elfutils-%{elfutilsVersion}.tar.gz
42 > %endif
43 >
44 > %prep
45 > echo "use_custom_binutils: %use_custom_binutils"
46 > %setup -T -b 0 -n gcc-%realversion
47 >
48 > case %cmsos in
49 > # Hack to always have -m32 in the 32bit compiler, even when it's built on a 64
50 > # bit architecture.
51 >  slc*_ia32 )
52 > cat << \EOF_CONFIG_GCC >> gcc/config.gcc
53 > # CMS patch to include gcc/config/i386/t-cms when building gcc
54 > tm_file="$tm_file i386/cms.h"
55 > tmake_file="$tmake_file i386/t-cms"
56 > EOF_CONFIG_GCC
57 >
58 > cat << \EOF_CMS_H > gcc/config/i386/cms.h
59 > #undef ASM_SPEC
60 > #define ASM_SPEC  "%%{v:-V} %%{Qy:} %%{!Qn:-Qy} %%{n} %%{T} %%{Ym,*} %%{Yd,*} %%{Wa,*:%%*} --32"
61 > #undef CC1_SPEC
62 > #define CC1_SPEC  "%%(cc1_cpu) %%{profile:-p} -m32"
63 > #undef CC1PLUS_SPEC
64 > #define CC1PLUS_SPEC "-m32"
65 > #undef MULTILIB_DEFAULTS
66 > #define MULTILIB_DEFAULTS { "m32" }
67 > EOF_CMS_H
68 >
69 > cat << \EOF_T_CMS > gcc/config/i386/t-cms
70 > MULTILIB_OPTIONS = m32
71 > MULTILIB_DIRNAMES = ../lib
72 > MULTILIB_MATCHES = m32=m32
73 > EOF_T_CMS
74 >  ;;
75 >  slc*_amd64 )
76 > # Hack needed to align sections to 4096 bytes rather than 2MB on 64bit linux
77 > # architectures.  This is done to reduce the amount of address space wasted by
78 > # relocating many libraries. This was done with a linker script before, but
79 > # this approach seems to be more correct.
80 > cat << \EOF_CONFIG_GCC >> gcc/config.gcc
81 > # CMS patch to include gcc/config/i386/t-cms when building gcc
82 > tm_file="$tm_file i386/cms.h"
83 > EOF_CONFIG_GCC
84 >
85 > cat << \EOF_CMS_H > gcc/config/i386/cms.h
86 > #undef LINK_SPEC
87 > #define LINK_SPEC "%{" SPEC_64 ":-m elf_x86_64} %{" SPEC_32 ":-m elf_i386} \
88 >  %{shared:-shared} \
89 >  %{!shared: \
90 >    %{!static: \
91 >      %{rdynamic:-export-dynamic} \
92 >      %{" SPEC_32 ":%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER32 "}} \
93 >      %{" SPEC_64 ":%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER64 "}}} \
94 >    %{static:-static}} -z common-page-size=4096 -z max-page-size=4096"
95 > EOF_CMS_H
96 >  ;;
97 > esac
98 >
99 > %if "%{use_custom_binutils}" == "true"
100 > %setup -D -T -b 6 -n bison-%{bisonVersion}
101 > %setup -D -T -b 7 -n binutils-%binutilsv
102 > %endif
103 >
104 > # These are required for any gcc 4.x build.
105 > %setup -D -T -b 1 -n gmp-%{gmpVersion}
106 > %setup -D -T -b 2 -n mpfr-%{mpfrVersion}
107 > %setup -D -T -b 3 -n mpc-%{mpcVersion}
108 >
109 > # For gcc 4.5 and later we also need the following.
110 > %if "%gcc_45plus" == "true"
111 > %setup -D -T -b 4 -n ppl-%{pplVersion}
112 > %setup -D -T -b 5 -n cloog-%{cloogVersion}
113 > %endif
114 >
115 > # These are required by rpm as well, but only on linux.
116 > %if "%isslc" == "true"
117 > %setup -D -T -b 8 -n elfutils-%{elfutilsVersion}
118 > %endif
119  
120   %build
121 < # FIXME: --enable-__cxa_atexit can't be used with gcc 3.2.3 on RH 7.3,
122 < # enabling it causes qt's uic to die with segmentation violation half
123 < # way down the build of qt (projecsettings.ui or something like that;
124 < # not the first or only call to uic).  Disabling the flag removes the
125 < # issue, so clearly the option does not work correctly on this
126 < # platform combination.
121 >
122 > # Set special variables required to build 32-bit executables on 64-bit
123 > # systems.  Note that if the architecture is SLC4/IA32, we may be on a
124 > # 64-bit system and need to produce a 32-bit capable compiler, which
125 > # _itself_ is a 32-bit executable.
126 > case %{cmsos} in
127 >  slc*_ia32)
128 >    CCOPTS="-fPIC -m32 -Wa,--32" ;;
129 >  *)
130 >    CCOPTS="-fPIC" ;;
131 > esac
132 >
133 > # Whenever we build custom binutils we also enable the new linker "gold".
134 > # We do so only if we are using the new gcc 4.5+
135 > if [ "X%use_custom_binutils:%gcc_45plus" = Xtrue:true ] ; then
136 >  CONF_BINUTILS_OPTS="--enable-gold"
137 > fi
138 >
139 > USER_CXX=$CCOPTS
140 >
141 > # Build libelf.
142 > if [ "X%isslc" = Xtrue ]; then
143 >  cd ../elfutils-%{elfutilsVersion}
144 >  ./configure --prefix=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX"
145 >  make %makeprocesses
146 >  make install
147 > fi
148 >
149 > # If requested, build our own binutils.  Currently the default is to use the
150 > # system binutils on 32bit platforms and our own on 64 bit ones.  
151 > # FIXME: Notice that this copy is actually built using the system compiler, so
152 > # we chances are we will need to rebuild it later on to make sure they get
153 > # linked against our libstdc++ (required by gold).
154 > if [ "X%use_custom_binutils" = Xtrue ]
155 > then
156 >  cd ../bison-%{bisonVersion}
157 >  CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/bison
158 >  make %makeprocesses
159 >  make install
160 >  export PATH=%i/tmp/bison/bin:$PATH
161 >  cd ../binutils-%{binutilsv}
162 >  ./configure --prefix=%i ${CONF_BINUTILS_OPTS} \
163 >              CC="gcc $CCOPTS" CFLAGS="-I%i/include" \
164 >              CXXFLAGS="-I%i/include" LDFLAGS="-L%i/lib"
165 >  make %makeprocesses
166 >  find . -name Makefile -exec perl -p -i -e 's|LN = ln|LN = cp -p|;s|ln ([^-])|cp -p $1|g' {} \;
167 >  make install
168 >  which ld
169 > fi
170 >
171 > # Build GMP/MPFR/MPC
172 > cd ../gmp-%{gmpVersion}
173 > ./configure --prefix=%i --enable-shared --disable-static --enable-cxx CC="gcc $CCOPTS" CXX="c++ $USER_CXX"
174 > make %makeprocesses
175 > make install
176 >
177 > cd ../mpfr-%{mpfrVersion}
178 > ./configure --prefix=%i --with-gmp=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX"
179 > make %makeprocesses
180 > make install
181 >
182 > cd ../mpc-%{mpcVersion}
183 > ./configure --prefix=%i --with-gmp=%i --with-mpfr=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX"
184 > make %makeprocesses
185 > make install
186 > CONF_GCC_VERSION_OPTS="--with-gmp=%i --with-mpfr=%i --with-mpc=%i"
187 >
188 > # Build additional stuff for gcc 4.5+
189 > if [ "X%gcc_45plus" = Xtrue ]; then
190 >  cd ../ppl-%{pplVersion}
191 >  ./configure --prefix=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX"
192 >  make %makeprocesses
193 >  make install
194 >
195 >  cd ../cloog-%{cloogVersion}
196 >  ./configure --prefix=%i --with-ppl=%i --with-gmp=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX"
197 >  make %makeprocesses
198 >  make install
199 >
200 >  CONF_GCC_VERSION_OPTS="$CONF_GCC_VERSION_OPTS --with-ppl=%i --with-cloog=%i --enable-cloog-backend=isl"
201 > fi
202 >
203 > # Build the compilers
204 > cd ../gcc-%realversion
205   mkdir -p obj
206   cd obj
207 < ../configure --prefix=%i --enable-languages=c,c++,f77 \
208 <    --enable-shared # --enable-__cxa_atexit
207 > export LD_LIBRARY_PATH=%i/lib64:%i/lib:$LD_LIBRARY_PATH
208 > ../configure --prefix=%i \
209 >  --enable-languages=c,c++,fortran \
210 >  $CONF_GCC_VERSION_OPTS --enable-shared CC="gcc $CCOPTS" CXX="c++ $USER_CXX"
211 >
212   make %makeprocesses bootstrap
213 + make install
214  
215   %install
216 < cd obj && make install
216 > cd %_builddir/gcc-%{realversion}/obj && make install
217 >
218   ln -s gcc %i/bin/cc
219 + find %i/lib %i/lib32 %i/lib64 -name '*.la' -exec rm -f {} \; || true
220 + # SCRAM ToolBox toolfile is now geneated by the gcc-toolfile.spec
221 + # so that everything works even in the case "--use-system-compiler"
222 + # option is specified.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines