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.51 by eulisse, Thu Jun 11 20:57:42 2009 UTC vs.
Revision 1.73 by eulisse, Mon May 23 10:25:11 2011 UTC

# Line 1 | Line 1
1 < ### RPM external gcc 4.3.2
2 < ## BUILDIF case `uname`:`uname -p` in Linux:i*86 ) true ;; Linux:x86_64 ) true ;;  Linux:ppc64 ) false ;; Darwin:* ) false ;; * ) true ;; esac
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 < Source0: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%realversion/%n-%realversion.tar.bz2
5 < %if "%(echo %cmsos | cut -f2 -d_)" == "amd64"
6 < %define binutilsv 2.19.1
7 < Source3: http://ftp.gnu.org/gnu/binutils/binutils-%binutilsv.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 < # If gcc version >= 4.0.0, we need two additional sources, for gmp and mpfr,
35 < # and we set the fortranCompiler macro (which is going to be used by the
36 < # --enable-languages option of gcc's configure) to gfortran.
37 < # Notice that we need to build those twice: once using the system compiler
38 < # and the using the newly built gcc.
39 < %define gmpVersion 4.2.4
40 < %define mpfrVersion 2.3.2
41 < Source1: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmpVersion}.tar.bz2
42 < Source2: http://www.mpfr.org/mpfr-%{mpfrVersion}/mpfr-%{mpfrVersion}.tar.bz2
43 < Patch0: binutils-2.19.1-fix-gold
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  
23 %define cpu %(echo %cmsplatf | cut -d_ -f2)
24 %define gcc_major %(echo %realversion | cut -f1 -d.)
45   %prep
46 < %setup -T -b 0 -n gcc-%realversion
46 > echo "use_custom_binutils: %use_custom_binutils"
47 > %setup -T -b 0 -n gcc-%realversion
48  
49   case %cmsos in
50 <  "slc4_ia32" | "slc5_ia32" )
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"
# Line 50 | Line 73 | MULTILIB_DIRNAMES = ../lib
73   MULTILIB_MATCHES = m32=m32
74   EOF_T_CMS
75    ;;
53 esac
54
55 %if "%{?binutilsv:set}" == "set"
56 %setup -D -T -b 3 -n binutils-%binutilsv
57 %patch0 -p1
58 case %cmsos in
76    slc*_amd64 )
77 <    # This patches the default linker script to align stuff at 4096 kB boundaries rather
78 <    # than the default 2MB (MAXPAGESIZE value for x86_64 architecture).
79 <    perl -p -i -e 's|\$[{]MAXPAGESIZE[}]|4096|g;s|\$[{]SEGMENT_SIZE[}]|4096|g' ld/scripttempl/elf.sc
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
122 +
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 $(uname -m):%{cmsos} in
128 <  *:slc4_ia32 )
129 <    CCOPTS="-m32 -Wa,--32" ;;
130 <  *:slc5_ia32 )
131 <    CCOPTS="-m32 -Wa,--32" ;;
80 <  * )
81 <    CCOPTS="" ;;
127 > case %{cmsos} in
128 >  slc*_ia32)
129 >    CCOPTS="-fPIC -m32 -Wa,--32" ;;
130 >  *)
131 >    CCOPTS="-fPIC" ;;
132   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
133  
134 < # Build GMP/MPFR for GCC 4.x
135 < %define gcc4opts %{nil}
136 < %if "%gcc_major" == "4"
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 >  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 < CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/gmp --disable-shared
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 < CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/mpfr --with-gmp=%i/tmp/gmp --disable-shared
183 > ./configure --prefix=%i --with-gmp=%i CC="gcc $CCOPTS" CXX="c++ $USER_CXX"
184   make %makeprocesses
185   make install
186 < %define gcc4opts --with-gmp=%i/tmp/gmp --with-mpfr=%i/tmp/mpfr
187 < %endif
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 <
113 < CC="gcc $CCOPTS" \
212 > export LD_LIBRARY_PATH=%i/lib64:%i/lib:$LD_LIBRARY_PATH
213   ../configure --prefix=%i \
214 <  --enable-languages=c,c++,`case %v in 3.*) echo f77;; *) echo fortran;; esac` \
215 <  %gcc4opts --enable-shared
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 %_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
125
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