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.93 by eulisse, Thu Dec 1 16:08:28 2011 UTC

# Line 1 | Line 1
1 < ### RPM external gcc 3.4.5
2 < ## INITENV +PATH LD_LIBRARY_PATH %i/lib/32
1 > ### RPM external gcc 4.6.1
2   ## INITENV +PATH LD_LIBRARY_PATH %i/lib64
3 < ## BUILDIF case $(uname):$(uname -p) in Linux:i*86 ) true ;; Linux:x86_64 ) true ;;  Linux:ppc64 ) false ;; Darwin:* ) false ;; * ) true ;; esac
4 < Source: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%v/%n-%v.tar.bz2
5 < %define cpu %(echo %cmsplatf | cut -d_ -f2)
3 > Source0: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%realversion/%n-%realversion.tar.bz2
4 >
5 > %define keep_archives true
6 >
7 > # For gcc version >= 4.0.0, a number of additional sources are needed.
8 > %define gmpVersion 5.0.2
9 > %define mpfrVersion 3.0.1
10 > %define mpcVersion 0.9
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.2
19 > %define cloogVersion 0.16.2
20 > Source4: http://bugseng.com/products/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 > # Notice that since we don't support building 32bit nor slc4 anymore.
26 > %define use_custom_binutils %(case %cmsos in (slc*) echo true ;; (*) echo false ;; esac)
27 > %if "%use_custom_binutils" == "true"
28 > %define bisonVersion 2.4
29 > Source6: http://ftp.gnu.org/gnu/bison/bison-%{bisonVersion}.tar.bz2
30 > %define binutilsv 2.21.1
31 > Source7: http://ftp.gnu.org/gnu/binutils/binutils-%binutilsv.tar.bz2
32 > #Source7: http://cmsrep.cern.ch/cmssw/binutils-mirror/binutils-%binutilsv.tar.bz2
33 > #Source7: http://www.kernel.org/pub/linux/devel/binutils/binutils-%binutilsv.tar.bz2
34 > %endif
35 >
36 > # gcc 4.5+ link time optimization support requires libelf to work. However
37 > # also rpm requires it. In order to have to duplicate dependencies we
38 > # build it in gcc and we pick it up from there also for rpm. Notice that
39 > # libelf does not work on Macosx however this is not a problem until
40 > # we use the system compiler there.
41 > %define isslc %(case %cmsos in (slc*) echo true ;; (*) echo false ;; esac)
42 > %define elfutilsVersion 0.152
43 > %if "%isslc" == "true"
44 > Source8: https://fedorahosted.org/releases/e/l/elfutils/%{elfutilsVersion}/elfutils-%{elfutilsVersion}.tar.bz2
45 > %endif
46 > Patch0: gcc-4.6.1-ignore-arch-flags-macosx
47 > # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49540
48 > Patch1: gcc-4.6.1-fix-gfortran-regression
49 > Patch2: gcc-4.6.1-elfutils-portability
50 >
51 > %prep
52 > echo "use_custom_binutils: %use_custom_binutils"
53 > %setup -T -b 0 -n gcc-%realversion
54 > %if "%gcc_45plus" == "true"
55 > # Get the macosx build to accept -arch, -F options like the official Apple one.
56 > # Notice that  patch command have to stay on a single line.
57 > case %cmsos in
58 >  osx*)
59 > %patch0 -p1
60 >  ;;
61 > esac
62 > %patch1 -p0
63 > %endif
64 >
65 > case %cmsos in
66 >  slc*)
67 > # Hack needed to align sections to 4096 bytes rather than 2MB on 64bit linux
68 > # architectures.  This is done to reduce the amount of address space wasted by
69 > # relocating many libraries. This was done with a linker script before, but
70 > # this approach seems to be more correct.
71 > cat << \EOF_CONFIG_GCC >> gcc/config.gcc
72 > # CMS patch to include gcc/config/i386/t-cms when building gcc
73 > tm_file="$tm_file i386/cms.h"
74 > EOF_CONFIG_GCC
75 >
76 > cat << \EOF_CMS_H > gcc/config/i386/cms.h
77 > #undef LINK_SPEC
78 > #define LINK_SPEC "%{" SPEC_64 ":-m elf_x86_64} %{" SPEC_32 ":-m elf_i386} \
79 >  %{shared:-shared} \
80 >  %{!shared: \
81 >    %{!static: \
82 >      %{rdynamic:-export-dynamic} \
83 >      %{" SPEC_32 ":%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER32 "}} \
84 >      %{" SPEC_64 ":%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER64 "}}} \
85 >    %{static:-static}} -z common-page-size=4096 -z max-page-size=4096"
86 > EOF_CMS_H
87 >  ;;
88 > esac
89 >
90 > case %cmsos in
91 >  slc*_corei7)
92 > cat << \EOF_CMS_H >> gcc/config/i386/cms.h
93 > #undef ASM_SPEC
94 > #define ASM_SPEC  "%%{v:-V} %%{Qy:} %%{!Qn:-Qy} %%{n} %%{T} %%{Ym,*} %%{Yd,*} %%{Wa,*:%%*} -march=corei7 -mtune=corei7"
95 > #undef CC1_SPEC
96 > #define CC1_SPEC  "%%(cc1_cpu) %%{profile:-p} -march=corei7 -mtune=corei7"
97 > #undef CC1PLUS_SPEC
98 > #define CC1PLUS_SPEC "-march=corei7"
99 > EOF_CMS_H
100 >  ;;
101 > esac
102 >
103 > %if "%{use_custom_binutils}" == "true"
104 > %setup -D -T -b 6 -n bison-%{bisonVersion}
105 > %setup -D -T -b 7 -n binutils-%binutilsv
106 > %endif
107 >
108 > # These are required for any gcc 4.x build.
109 > %setup -D -T -b 1 -n gmp-%{gmpVersion}
110 > %setup -D -T -b 2 -n mpfr-%{mpfrVersion}
111 > %setup -D -T -b 3 -n mpc-%{mpcVersion}
112 >
113 > # For gcc 4.5 and later we also need the following.
114 > %if "%gcc_45plus" == "true"
115 > %setup -D -T -b 4 -n ppl-%{pplVersion}
116 > %setup -D -T -b 5 -n cloog-%{cloogVersion}
117 > %endif
118 >
119 > # These are required by rpm as well, but only on linux.
120 > %if "%isslc" == "true"
121 > %setup -D -T -b 8 -n elfutils-%{elfutilsVersion}
122 > %patch2 -p1
123 > %endif
124 >
125   %build
126 < # FIXME: --enable-__cxa_atexit can't be used with gcc 3.2.3 on RH 7.3,
127 < # enabling it causes qt's uic to die with segmentation violation half
128 < # way down the build of qt (projecsettings.ui or something like that;
129 < # not the first or only call to uic).  Disabling the flag removes the
130 < # issue, so clearly the option does not work correctly on this
131 < # platform combination.
132 < mkdir -p obj
133 < cd obj
126 > # On mac we need to use gcc-proper, not gcc-llvm
127 > case %{cmsos} in
128 >  osx*)
129 >    CC=/usr/bin/gcc-4.2
130 >    CXX=/usr/bin/c++-4.2
131 >    CPP=/usr/bin/cpp-4.2
132 >    ADDITIONAL_LANGUAGES=,objc,obj-c++
133 >
134 >    # Apparently must emulate apple compiler even if we build
135 >    # full chain ourselves, as things come in via system libs.
136 >    #  - http://newartisans.com/2009/10/a-c-gotcha-on-snow-leopard/
137 >    #  - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41645
138 >    #  - http://trac.macports.org/ticket/25205 (and 22234)
139 >    CONF_GCC_OS_SPEC=--enable-fully-dynamic-string
140 >  ;;
141 >  *)
142 >    CC=gcc
143 >    CXX=c++
144 >    CPP=cpp
145 >    CONF_GCC_OS_SPEC=
146 >  ;;
147 > esac
148 >
149 > CC="$CC -fPIC"
150 > CXX="$CXX -fPIC"
151  
152 < if [ "`echo %v | cut -d. -f 1`" == "3" ]
152 > # Whenever we build custom binutils we also enable the new linker "gold".
153 > # We do so only if we are using the new gcc 4.5+
154 > if [ "X%use_custom_binutils:%gcc_45plus" = Xtrue:true ] ; then
155 >  CONF_BINUTILS_OPTS="--enable-gold=default --enable-lto --enable-plugins --enable-threads"
156 >  CONF_GCC_WITH_LTO="--enable-gold=yes --enable-lto" # --with-build-config=bootstrap-lto
157 > fi
158 >
159 > # Build libelf.
160 > if [ "X%isslc" = Xtrue ]; then
161 >  cd ../elfutils-%{elfutilsVersion}
162 >  ./configure --disable-static --prefix=%i CC="$CC" CXX="$CXX" CPP="$CPP"
163 >  make %makeprocesses
164 >  make install
165 > fi
166 >
167 > # If requested, build our own binutils.  Currently the default is to use the
168 > # system binutils on 32bit platforms and our own on 64 bit ones.  
169 > # FIXME: Notice that this copy is actually built using the system compiler, so
170 > # we chances are we will need to rebuild it later on to make sure they get
171 > # linked against our libstdc++ (required by gold).
172 > if [ "X%use_custom_binutils" = Xtrue ]
173   then
174 < ../configure --prefix=%i --enable-languages=c,c++,f77 \
175 <    --enable-shared # --enable-__cxa_atexit
176 < else
177 < ../configure --prefix=%i --enable-languages=c,c++ \
178 <    --enable-shared # --enable-__cxa_atexit
174 >  cd ../bison-%{bisonVersion}
175 >  CC="$CC" ./configure --prefix=%i/tmp/bison
176 >  make %makeprocesses
177 >  make install
178 >  export PATH=%i/tmp/bison/bin:$PATH
179 >  cd ../binutils-%{binutilsv}
180 >  # Try to avoid dependency on makeinfo by forcing make not
181 >  # to build the documentation.
182 >  perl -p -i -e 's|SUBDIRS = .*|SUBDIRS =|' bfd/Makefile.in binutils/Makefile.in gas/Makefile.in
183 >  perl -p -i -e 's|all: info|all:|' etc/Makefile.in
184 >  perl -p -i -e 's|TEXINFOS =.*|TEXINFOS =|;s|INFO_DEPS =.*|INFO_DEPS =|' gprof/Makefile.in
185 >  perl -p -i -e 's|man_MANS =.*|man_MANS =|' gprof/Makefile.in
186 >  perl -p -i -e 's|INFO_DEPS =.*|INFO_DEPS =|' ld/Makefile.in
187 >  perl -p -i -e 's|INFOFILES =.*|INFOFILES =|' etc/Makefile.in
188 >  perl -p -i -e 's|DVIFILES =.*|DVIFILES =|' etc/Makefile.in
189 >  perl -p -i -e 's|PDFFILES =.*|PDFFILES =|' etc/Makefile.in
190 >  perl -p -i -e 's|HTMLFILES =.*|HTMLFILES =|' etc/Makefile.in        
191 >
192 >  ./configure --disable-static --prefix=%i ${CONF_BINUTILS_OPTS} --disable-werror \
193 >              CC="$CC" CXX="$CXX" CPP="$CPP" CFLAGS="-I%i/include" \
194 >              CXXFLAGS="-I%i/include" LDFLAGS="-L%i/lib"
195 >  make %makeprocesses
196 >  find . -name Makefile -exec perl -p -i -e 's|LN = ln|LN = cp -p|;s|ln ([^-])|cp -p $1|g' {} \;
197 >  make install
198 >  which ld
199 > fi
200 >
201 > # Build GMP/MPFR/MPC
202 > cd ../gmp-%{gmpVersion}
203 > ./configure --disable-static --prefix=%i --enable-shared --disable-static --enable-cxx CC="$CC" CXX="$CXX" CPP="$CPP"
204 > make %makeprocesses
205 > make install
206 >
207 > cd ../mpfr-%{mpfrVersion}
208 > ./configure --disable-static --prefix=%i --with-gmp=%i CC="$CC" CXX="$CXX" CPP="$CPP"
209 > make %makeprocesses
210 > make install
211 >
212 > cd ../mpc-%{mpcVersion}
213 > ./configure --disable-static --prefix=%i --with-gmp=%i --with-mpfr=%i CC="$CC" CXX="$CXX" CPP="$CPP"
214 > make %makeprocesses
215 > make install
216 > CONF_GCC_VERSION_OPTS="--with-gmp=%i --with-mpfr=%i --with-mpc=%i"
217 >
218 > # Build additional stuff for gcc 4.5+
219 > if [ "X%gcc_45plus" = Xtrue ]; then
220 >  cd ../ppl-%{pplVersion}
221 >  ./configure --disable-static --with-gmp-prefix=%i --with-cxxflags="-I%i/include" --enable-interfaces=c --prefix=%i CC="$CC" CXX="$CXX" CPP="$CPP" LDFLAGS="-L%i/lib"
222 >  make %makeprocesses
223 >  make install
224 >
225 >  cd ../cloog-%{cloogVersion}
226 >  ./configure --disable-static --prefix=%i --with-ppl=%i --with-gmp-prefix=%i CC="$CC" CXX="$CXX" CPP="$CPP"
227 >  make %makeprocesses
228 >  make install
229 >
230 >  CONF_GCC_VERSION_OPTS="$CONF_GCC_VERSION_OPTS --with-ppl=%i --with-cloog=%i --enable-cloog-backend=isl"
231   fi
232 +
233 + # Build the compilers
234 + cd ../gcc-%realversion
235 + mkdir -p obj
236 + cd obj
237 + export LD_LIBRARY_PATH=%i/lib64:%i/lib:$LD_LIBRARY_PATH
238 + ../configure --prefix=%i --disable-multilib --disable-nls \
239 +  --enable-languages=c,c++,fortran$ADDITIONAL_LANGUAGES \
240 +  $CONF_GCC_OS_SPEC $CONF_GCC_WITH_LTO $CONF_GCC_VERSION_OPTS \
241 +  --enable-shared CC="$CC" CXX="$CXX" CPP="$CPP"
242 +
243   make %makeprocesses bootstrap
244 + make install
245  
246   %install
247 < cd obj && make install
247 > cd %_builddir/gcc-%{realversion}/obj && make install
248 >
249   ln -s gcc %i/bin/cc
250 < %post
251 < %{relocateConfig}lib/libg2c.la
252 < %{relocateConfig}lib/libstdc++.la
253 < %{relocateConfig}lib/libsupc++.la
254 < %if "%cpu" == "amd64"
255 < %{relocateConfig}lib64/libg2c.la
256 < %{relocateConfig}lib64/libstdc++.la
257 < %{relocateConfig}lib64/libsupc++.la
258 < %{relocateConfig}lib/32/libg2c.la
259 < %{relocateConfig}lib/32/libstdc++.la
40 < %{relocateConfig}lib/32/libsupc++.la
41 < %endif
250 > find %i/lib %i/lib64 -name '*.la' -exec rm -f {} \; || true
251 >
252 > # Remove unneeded documentation, temporary areas, unneeded files.
253 > %define drop_files %i/share/{man,info,doc,locale} %i/tmp %i/lib*/{libstdc++.a,libsupc++.a}
254 > # Strip things people will most likely never debug themself.
255 > %define more_strip %i/bin/*{c++,g++,gcc,gfortran,gcov,ppl,cloog,cpp}*
256 > %define strip_files %i/libexec/*/*/*/{cc1,cc1plus,f951,lto1,collect2} %i/x86_64*/bin %i/lib/lib{mpfr,ppl,gmp,cloog}* %more_strip
257 > %define keep_archives yes
258 > # This avoids having a dependency on the system pkg-config.
259 > rm -rf %i/lib/pkg-config

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines