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.9 by eulisse, Tue Aug 22 22:53:15 2006 UTC vs.
Revision 1.73 by eulisse, Mon May 23 10:25:11 2011 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines