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.14 by dlange, Thu Apr 19 20:52:43 2007 UTC vs.
Revision 1.79 by eulisse, Mon Sep 12 11:27:51 2011 UTC

# Line 1 | Line 1
1 < ### RPM external gcc 3.4.5
1 > ### RPM external gcc 4.6.1
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 < Source: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%v/%n-%v.tar.bz2
6 < %define cpu %(echo %cmsplatf | cut -d_ -f2)
4 > Source0: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%realversion/%n-%realversion.tar.bz2
5 > # For gcc version >= 4.0.0, a number of additional sources are needed.
6 > %define gmpVersion 5.0.2
7 > %define mpfrVersion 3.0.1
8 > %define mpcVersion 0.9
9 > Source1: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmpVersion}.tar.bz2
10 > Source2: http://www.mpfr.org/mpfr-%{mpfrVersion}/mpfr-%{mpfrVersion}.tar.bz2
11 > Source3: http://www.multiprecision.org/mpc/download/mpc-%{mpcVersion}.tar.gz
12 >
13 > # For gcc 4.5+ we need the additional tools ppl and cloog.
14 > %define gcc_45plus %(echo %realversion | sed -e 's|4[.][5-9].*|true|')
15 > %if "%{gcc_45plus}" == "true"
16 > %define pplVersion 0.11.2
17 > %define cloogVersion 0.16.2
18 > Source4: http://www.cs.unipr.it/ppl/Download/ftp/releases/%{pplVersion}/ppl-%{pplVersion}.tar.bz2
19 > Source5: ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-%{cloogVersion}.tar.gz
20 > %endif
21 >
22 > # On 64bit Scientific Linux build our own binutils.
23 > %define use_custom_binutils %(echo %cmsos | sed -e 's|slc[0-9]*_amd64|true|')
24 > %if "%use_custom_binutils" == "true"
25 > %define bisonVersion 2.4
26 > Source6: http://ftp.gnu.org/gnu/bison/bison-%{bisonVersion}.tar.bz2
27 > %define binutilsv 2.21.53.0.2
28 > #Source7: http://ftp.gnu.org/gnu/binutils/binutils-%binutilsv.tar.bz2
29 > Source7: http://www.kernel.org/pub/linux/devel/binutils/binutils-%binutilsv.tar.bz2
30 > %endif
31 >
32 > # gcc 4.5+ link time optimization support requires libelf to work. However
33 > # also rpm requires it. In order to have to duplicate dependencies we
34 > # build it in gcc and we pick it up from there also for rpm. Notice that
35 > # libelf does not work on Macosx however this is not a problem until
36 > # we use the system compiler there.
37 > %define isslc %(echo %cmsos | sed -e 's|slc.*|true|')
38 > %define elfutilsVersion 0.131
39 > %if "%isslc" == "true"
40 > Source8: ftp://sources.redhat.com/pub/systemtap/elfutils/elfutils-%{elfutilsVersion}.tar.gz
41 > %endif
42 > Patch0: gcc-4.6.1-ignore-arch-flags-macosx
43 > # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49540
44 > Patch1: gcc-4.6.1-fix-gfortran-regression
45 >
46 > %prep
47 > echo "use_custom_binutils: %use_custom_binutils"
48 > %setup -T -b 0 -n gcc-%realversion
49 > # Get the macosx build to accept -arch, -F options like the official Apple one.
50 > # Notice that  patch command have to stay on a single line.
51 > case %cmsos in
52 >  osx*)
53 > %patch0 -p1
54 >  ;;
55 > esac
56 > %patch1 -p0
57 >
58 > case %cmsos in
59 >  slc*_amd64 )
60 > # Hack needed to align sections to 4096 bytes rather than 2MB on 64bit linux
61 > # architectures.  This is done to reduce the amount of address space wasted by
62 > # relocating many libraries. This was done with a linker script before, but
63 > # this approach seems to be more correct.
64 > cat << \EOF_CONFIG_GCC >> gcc/config.gcc
65 > # CMS patch to include gcc/config/i386/t-cms when building gcc
66 > tm_file="$tm_file i386/cms.h"
67 > EOF_CONFIG_GCC
68 >
69 > cat << \EOF_CMS_H > gcc/config/i386/cms.h
70 > #undef LINK_SPEC
71 > #define LINK_SPEC "%{" SPEC_64 ":-m elf_x86_64} %{" SPEC_32 ":-m elf_i386} \
72 >  %{shared:-shared} \
73 >  %{!shared: \
74 >    %{!static: \
75 >      %{rdynamic:-export-dynamic} \
76 >      %{" SPEC_32 ":%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER32 "}} \
77 >      %{" SPEC_64 ":%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER64 "}}} \
78 >    %{static:-static}} -z common-page-size=4096 -z max-page-size=4096"
79 > EOF_CMS_H
80 >  ;;
81 > esac
82 >
83 > %if "%{use_custom_binutils}" == "true"
84 > %setup -D -T -b 6 -n bison-%{bisonVersion}
85 > %setup -D -T -b 7 -n binutils-%binutilsv
86 > %endif
87 >
88 > # These are required for any gcc 4.x build.
89 > %setup -D -T -b 1 -n gmp-%{gmpVersion}
90 > %setup -D -T -b 2 -n mpfr-%{mpfrVersion}
91 > %setup -D -T -b 3 -n mpc-%{mpcVersion}
92 >
93 > # For gcc 4.5 and later we also need the following.
94 > %if "%gcc_45plus" == "true"
95 > %setup -D -T -b 4 -n ppl-%{pplVersion}
96 > %setup -D -T -b 5 -n cloog-%{cloogVersion}
97 > %endif
98 >
99 > # These are required by rpm as well, but only on linux.
100 > %if "%isslc" == "true"
101 > %setup -D -T -b 8 -n elfutils-%{elfutilsVersion}
102 > %endif
103 >
104   %build
105 < # FIXME: --enable-__cxa_atexit can't be used with gcc 3.2.3 on RH 7.3,
106 < # enabling it causes qt's uic to die with segmentation violation half
107 < # way down the build of qt (projecsettings.ui or something like that;
108 < # not the first or only call to uic).  Disabling the flag removes the
109 < # issue, so clearly the option does not work correctly on this
110 < # platform combination.
111 < mkdir -p obj
112 < cd obj
105 > # On mac we need to use gcc-proper, not gcc-llvm
106 > case %{cmsos} in
107 >  osx*)
108 >    CC=/usr/bin/gcc-4.2
109 >    CXX=/usr/bin/c++-4.2
110 >    CPP=/usr/bin/cpp-4.2
111 >    ADDITIONAL_LANGUAGES=,objc,obj-c++
112 >  ;;
113 >  *)
114 >    CC=gcc
115 >    CXX=c++
116 >    CPP=cpp
117 >  ;;
118 > esac
119 >
120 > CC="$CC -fPIC"
121 > CXX="$CXX -fPIC"
122  
123 < if [ "`echo %v | cut -d. -f 1`" == "3" ]
123 > # Whenever we build custom binutils we also enable the new linker "gold".
124 > # We do so only if we are using the new gcc 4.5+
125 > if [ "X%use_custom_binutils:%gcc_45plus" = Xtrue:true ] ; then
126 >  CONF_BINUTILS_OPTS="--enable-gold=default --enable-lto --enable-plugins --enable-threads"
127 > fi
128 >
129 > # Build libelf.
130 > if [ "X%isslc" = Xtrue ]; then
131 >  cd ../elfutils-%{elfutilsVersion}
132 >  ./configure --disable-static --prefix=%i CC="$CC" CXX="$CXX" CPP="$CPP"
133 >  make %makeprocesses
134 >  make install
135 > fi
136 >
137 > # If requested, build our own binutils.  Currently the default is to use the
138 > # system binutils on 32bit platforms and our own on 64 bit ones.  
139 > # FIXME: Notice that this copy is actually built using the system compiler, so
140 > # we chances are we will need to rebuild it later on to make sure they get
141 > # linked against our libstdc++ (required by gold).
142 > if [ "X%use_custom_binutils" = Xtrue ]
143   then
144 < ../configure --prefix=%i --enable-languages=c,c++,f77 \
145 <    --enable-shared # --enable-__cxa_atexit
146 < else
147 < ../configure --prefix=%i --enable-languages=c,c++ \
148 <    --enable-shared # --enable-__cxa_atexit
144 >  cd ../bison-%{bisonVersion}
145 >  CC="$CC" ./configure --prefix=%i/tmp/bison
146 >  make %makeprocesses
147 >  make install
148 >  export PATH=%i/tmp/bison/bin:$PATH
149 >  cd ../binutils-%{binutilsv}
150 >  # Try to avoid dependency on makeinfo by forcing make not
151 >  # to build the documentation.
152 >  perl -p -i -e 's|SUBDIRS = .*|SUBDIRS =|' bfd/Makefile.in binutils/Makefile.in gas/Makefile.in
153 >  perl -p -i -e 's|all: info|all:|' etc/Makefile.in
154 >  perl -p -i -e 's|TEXINFOS =.*|TEXINFOS =|;s|INFO_DEPS =.*|INFO_DEPS =|' gprof/Makefile.in
155 >  perl -p -i -e 's|man_MANS =.*|man_MANS =|' gprof/Makefile.in
156 >  perl -p -i -e 's|INFO_DEPS =.*|INFO_DEPS =|' ld/Makefile.in
157 >  perl -p -i -e 's|INFOFILES =.*|INFOFILES =|' etc/Makefile.in
158 >  perl -p -i -e 's|DVIFILES =.*|DVIFILES =|' etc/Makefile.in
159 >  perl -p -i -e 's|PDFFILES =.*|PDFFILES =|' etc/Makefile.in
160 >  perl -p -i -e 's|HTMLFILES =.*|HTMLFILES =|' etc/Makefile.in        
161 >
162 >  ./configure --disable-static --prefix=%i ${CONF_BINUTILS_OPTS} --disable-werror \
163 >              CC="$CC" CXX="$CXX" CPP="$CPP" 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 --disable-static --prefix=%i --enable-shared --disable-static --enable-cxx CC="$CC" CXX="$CXX" CPP="$CPP"
174 > make %makeprocesses
175 > make install
176 >
177 > cd ../mpfr-%{mpfrVersion}
178 > ./configure --disable-static --prefix=%i --with-gmp=%i CC="$CC" CXX="$CXX" CPP="$CPP"
179 > make %makeprocesses
180 > make install
181 >
182 > cd ../mpc-%{mpcVersion}
183 > ./configure --disable-static --prefix=%i --with-gmp=%i --with-mpfr=%i CC="$CC" CXX="$CXX" CPP="$CPP"
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 --disable-static --prefix=%i CC="$CC" CXX="$CXX" CPP="$CPP"
192 >  make %makeprocesses
193 >  make install
194 >
195 >  cd ../cloog-%{cloogVersion}
196 >  ./configure --disable-static --prefix=%i --with-ppl=%i --with-gmp-prefix=%i CC="$CC" CXX="$CXX" CPP="$CPP"
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 + export LD_LIBRARY_PATH=%i/lib64:%i/lib:$LD_LIBRARY_PATH
208 + ../configure --prefix=%i \
209 +  --enable-gold=yes --enable-lto  --with-build-config=bootstrap-lto \
210 +  --enable-languages=c,c++,fortran$ADDITIONAL_LANGUAGES \
211 +  $CONF_GCC_VERSION_OPTS --enable-shared CC="$CC" CXX="$CXX" CPP="$CPP"
212 +
213   make %makeprocesses bootstrap
214 + make install
215  
216   %install
217 < cd obj && make install
217 > cd %_builddir/gcc-%{realversion}/obj && make install
218 >
219   ln -s gcc %i/bin/cc
220 < %post
221 < %{relocateConfig}lib/libg2c.la
222 < %{relocateConfig}lib/libstdc++.la
223 < %{relocateConfig}lib/libsupc++.la
224 < %if "%cpu" == "amd64"
225 < %{relocateConfig}lib64/libg2c.la
226 < %{relocateConfig}lib64/libstdc++.la
227 < %{relocateConfig}lib64/libsupc++.la
228 < %{relocateConfig}lib/32/libg2c.la
229 < %{relocateConfig}lib/32/libstdc++.la
230 < %{relocateConfig}lib/32/libsupc++.la
231 < %endif
220 > find %i/lib %i/lib64 -name '*.la' -exec rm -f {} \; || true
221 >
222 > # Remove unneeded documentation.
223 > rm -rf %i/share/{man,info,doc,locale}
224 > # Strip things people will most likely never debug themself.
225 > find %i/libexec -name cc1 -exec strip {} \;
226 > find %i/libexec -name cc1plus -exec strip {} \;
227 > find %i/libexec -name f951 -exec strip {} \;
228 > find %i/libexec -name lto1 -exec strip {} \;
229 > find %i/libexec -name collect2 -exec strip {} \;
230 > find %i/bin -type f -exec file {} \; | grep executable | grep -v make-debug-archive | sed -e 's|:.*||' | xargs -n1 strip
231 > find %i/x86_64*/bin -type f -exec strip {} \;
232 > strip %i/lib/libmpfr*
233 > strip %i/lib/libppl*
234 > strip %i/lib/libgmp*
235 > strip %i/lib/libcloog*
236 > # Remove temporary bison installation
237 > rm -rf %i/tmp
238 > # Remove unneeded archive libraries.
239 > rm -rf %i/lib/libstdc++.a %i/lib/libsupc++.a
240 > # This avoids having a dependency on the system pkg-config.
241 > rm -rf %i/lib/pkg-config
242 >
243 > # SCRAM ToolBox toolfile is now geneated by the gcc-toolfile.spec
244 > # so that everything works even in the case "--use-system-compiler"
245 > # option is specified.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines