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.18 by eulisse, Mon May 7 13:49:43 2007 UTC vs.
Revision 1.73 by eulisse, Mon May 23 10:25:11 2011 UTC

# Line 1 | Line 1
1 < ### RPM external gcc 4.1.2
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 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 <
10 < # If gcc version >= 4.0.0, we need two additional sources, for gmp and mpfr,
11 < # and we set the fortranCompiler macro (which is going to be used by the
12 < # --enable-languages option of gcc's configure) to gfortran.
13 < # Notice that we need to build those twice: once using the system compiler
14 < # and the using the newly built gcc.
15 < # I also set the convenience macro gcc4 to ease gcc detection.
16 < %define gmpVersion 4.2.1
17 < %define mpfrVersion 2.2.1
18 < Source2: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmpVersion}.tar.bz2
19 < Source3: http://www.mpfr.org/mpfr-current/mpfr-%{mpfrVersion}.tar.bz2
20 < %if "%(echo %v | cut -f1 -d. )" == "4"
21 < %define gcc4 true
22 < %define firstStepFortran %{nil}
23 < %define fortranCompiler ,fortran
24 < %else
25 < %define firstStepFortran ,f77
26 < %define fortranCompiler ,f77
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  
29
30 %define cpu %(echo %cmsplatf | cut -d_ -f2)
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 < %if "%cmsos" == "slc4_ia32"
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"
# Line 39 | Line 57 | 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  
# Line 50 | Line 72 | 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 < #perl -p -i -e 's|SPECS = specs|SPECS = specs.install|' gcc/Makefile.in
106 < %setup -D -T -b 1 -n binutils-%binutilsv
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 < # We need to setup gmp and mpfr as well if the compiler version is >= 4.0.0.
111 < %if "%{?gcc4:set}" == "set"
112 < %setup -D -T -b 2 -n gmp-%{gmpVersion}
113 < %setup -D -T -b 3 -n mpfr-%{mpfrVersion}
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 < %build
117 < # FIXME: --enable-__cxa_atexit can't be used with gcc 3.2.3 on RH 7.3,
118 < # enabling it causes qt's uic to die with segmentation violation half
119 < # way down the build of qt (projecsettings.ui or something like that;
68 < # not the first or only call to uic).  Disabling the flag removes the
69 < # issue, so clearly the option does not work correctly on this
70 < # platform combination.
71 <
72 <
73 < # The buildGCC function is an utility function to ease the creation of
74 < # cross compilers.
75 < buildGCC () {
76 <    target=$1
77 <    host=$2
78 <    prefix=$3
79 <
80 <    if [ "X$target" != "X" ]
81 <    then
82 <        targetOption="--target $target"
83 <    fi
84 <
85 <    if [ "X$host" != "X" ]
86 <    then
87 <        hostOption="--host $host"
88 <    fi
89 <
90 <    languages=c,c++%{fortranCompiler}
91 <
92 <    if [ "$prefix" == "" ]
93 <    then
94 <        prefix=%i
95 <    fi
96 <    
97 <    mkdir -p obj-$target
98 <    cd obj-$target
99 <
100 <    ../configure --prefix=$prefix --enable-languages=$languages \
101 <        --enable-shared \
102 < %if "%{gcc4}" == "true"
103 <            --with-gmp-dir=%_builddir/gmp-%{gmpVersion} \
104 <            --with-mpfr-dir=%_builddir/mpfr-%{mpfrVersion} \
105 < %endif
106 <        $targetOption \
107 <        $hostOption
108 <    make %makeprocesses bootstrap
109 <    make install            
110 <    cd ..
111 < }
112 <
113 < # create a tmp
114 < mkdir -p %i/tmp
115 <
116 < # build the latest/greatest binutils
117 < mkdir -p %i/tmp/binutils
118 < cd ../binutils-%{binutilsv}
119 < ./configure --prefix=%i/tmp/binutils
120 < make %makeprocesses
121 < make install
122 < export PATH=%i/tmp/binutils/bin:$PATH
123 < export LD_LIBRARY_PATH=%i/tmp/binutils/lib:$PATH
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 the native platform compiler
126 < cd ../gcc-%v
127 < mkdir -p obj
128 < cd obj
129 < ../configure --prefix=%i --enable-languages=c,c++%{firstStepFortran} \
130 <                         --enable-shared
121 > %build
122  
123 < make %makeprocesses bootstrap
124 < make install
125 < cd ..
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 >  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 < # rebuild binutils with the new compiler
177 < export PATH=%i/bin:$PATH
178 < export LD_LIBRARY_PATH=%i/lib:$PATH
139 < cd ../binutils-%binutilsv
140 < ./configure --prefix=%i
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
143 rm -fr %i/tmp
181  
182 < # And if we are building gcc4, we build gmp and mpfr as well and then rebuild gcc4 with fortran support.
183 < %if "%{?gcc4:set}" == "set"
147 < cd ../gmp-%{gmpVersion}
148 < ./configure --prefix=%i
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 ../mpfr-%{mpfrVersion}
188 < ./configure --prefix=%i --with-gmp=%i
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 < cd ../gcc-%{v}/obj
194 < make distclean
195 < cd ..
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 < buildGCC
205 >  CONF_GCC_VERSION_OPTS="$CONF_GCC_VERSION_OPTS --with-ppl=%i --with-cloog=%i --enable-cloog-backend=isl"
206 > fi
207  
208 < %endif
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
222 > cd %_builddir/gcc-%{realversion}/obj && make install
223 >
224   ln -s gcc %i/bin/cc
225 < %post
226 < %{relocateConfig}lib/libg2c.la
227 < %{relocateConfig}lib/libstdc++.la
228 < %{relocateConfig}lib/libsupc++.la
172 < %if "%cpu" == "amd64"
173 < %{relocateConfig}lib64/libg2c.la
174 < %{relocateConfig}lib64/libstdc++.la
175 < %{relocateConfig}lib64/libsupc++.la
176 < %{relocateConfig}lib/32/libg2c.la
177 < %{relocateConfig}lib/32/libstdc++.la
178 < %{relocateConfig}lib/32/libsupc++.la
179 < %endif
180 < %if "%gcc4" == "true"
181 < %{relocateConfig}lib/libbfd.la
182 < %{relocateConfig}lib/libgmp.la
183 < %{relocateConfig}lib/libopcodes.la
184 < %{relocateConfig}lib/libmudflap.la
185 < %{relocateConfig}lib/libgfortran.la
186 < %{relocateConfig}lib/libmudflapth.la
187 < %{relocateConfig}lib/libmpfr.la
188 < %{relocateConfig}lib/libssp.la
189 < %{relocateConfig}lib/libgfortranbegin.la
190 < %endif
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