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.41 by elmer, Thu Jan 3 14:57:18 2008 UTC vs.
Revision 1.79 by eulisse, Mon Sep 12 11:27:51 2011 UTC

# Line 1 | Line 1
1 < ### RPM external gcc 4.2.2-CMS19
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
4   Source0: ftp://ftp.fu-berlin.de/unix/gnu/%n/%n-%realversion/%n-%realversion.tar.bz2
5 < %define binutilsv 2.17
6 < Source1: http://ftp.gnu.org/gnu/binutils/binutils-%binutilsv.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 < # If gcc version >= 4.0.0, we need two additional sources, for gmp and mpfr,
33 < # and we set the fortranCompiler macro (which is going to be used by the
34 < # --enable-languages option of gcc's configure) to gfortran.
35 < # Notice that we need to build those twice: once using the system compiler
36 < # and the using the newly built gcc.
37 < %define gmpVersion 4.2.1
38 < %define mpfrVersion 2.2.1
39 < Source2: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmpVersion}.tar.bz2
40 < Source3: http://www.mpfr.org/mpfr-%{mpfrVersion}/mpfr-%{mpfrVersion}.tar.bz2
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  
19 %define cpu %(echo %cmsplatf | cut -d_ -f2)
20 %define gcc_major %(echo %realversion | cut -f1 -d.)
46   %prep
47 < %setup -T -b 0 -n gcc-%realversion
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 < %if "%cmsos" == "slc4_ia32"
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"
28 tmake_file="$tmake_file i386/t-cms"
67   EOF_CONFIG_GCC
68  
69   cat << \EOF_CMS_H > gcc/config/i386/cms.h
70 < #undef ASM_SPEC
71 < #define ASM_SPEC  "%%{v:-V} %%{Qy:} %%{!Qn:-Qy} %%{n} %%{T} %%{Ym,*} %%{Yd,*} %%{Wa,*:%%*} --32"
72 < #undef CC1_SPEC
73 < #define CC1_SPEC  "%%(cc1_cpu) %%{profile:-p} -m32"
74 < #undef CC1PLUS_SPEC
75 < #define CC1PLUS_SPEC "-m32"
76 < #undef MULTILIB_DEFAULTS
77 < #define MULTILIB_DEFAULTS { "m32" }
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 < cat << \EOF_T_CMS > gcc/config/i386/t-cms
84 < MULTILIB_OPTIONS = m32
85 < MULTILIB_DIRNAMES = ../lib
45 < MULTILIB_MATCHES = m32=m32
46 < EOF_T_CMS
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 < %setup -D -T -b 1 -n binutils-%binutilsv
89 < %setup -D -T -b 2 -n gmp-%{gmpVersion}
90 < %setup -D -T -b 3 -n mpfr-%{mpfrVersion}
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 < # Set special variables required to build 32-bit executables on 64-bit
106 < # systems.  Note that if the architecture is SLC4/IA32, we may be on a
107 < # 64-bit system and need to produce a 32-bit capable compiler, which
108 < # _itself_ is a 32-bit executable.
109 < case $(uname -m):%{cmsos} in
110 <  *:slc4_ia32 )
111 <    CCOPTS="-m32 -Wa,--32" ;;
112 <  * )
113 <    CCOPTS="" ;;
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 < # If requested, build our own binutils.  Currently the default is to use
121 < # the system binutils.
122 < %if "%{?use_external_binutils:set}" == "set"
123 < cd ../binutils-%{binutilsv}
124 < CC="gcc $CCOPTS" ./configure --prefix=%i
125 < make %makeprocesses
126 < make install
127 < %endif
120 > CC="$CC -fPIC"
121 > CXX="$CXX -fPIC"
122 >
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 >  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 for GCC 4.x
75 < %define gcc4opts %{nil}
76 < %if "%gcc_major" == "4"
171 > # Build GMP/MPFR/MPC
172   cd ../gmp-%{gmpVersion}
173 < CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/gmp --disable-shared
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 < CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/mpfr --with-gmp=%i/tmp/gmp --disable-shared
178 > ./configure --disable-static --prefix=%i --with-gmp=%i CC="$CC" CXX="$CXX" CPP="$CPP"
179   make %makeprocesses
180   make install
181 < %define gcc4opts --with-gmp=%i/tmp/gmp --with-mpfr=%i/tmp/mpfr
182 < %endif
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 < CC="gcc $CCOPTS" \
207 > export LD_LIBRARY_PATH=%i/lib64:%i/lib:$LD_LIBRARY_PATH
208   ../configure --prefix=%i \
209 <  --enable-languages=c,c++,`case %v in 3.*) echo f77;; *) echo fortran;; esac` \
210 <  %gcc4opts --enable-shared
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 %_builddir/gcc-%{realversion}/obj && make install
217 > cd %_builddir/gcc-%{realversion}/obj && make install
218 >
219   ln -s gcc %i/bin/cc
220 < find %i/lib %i/lib32 %i/lib64 -name '*.la' -exec rm -f {} \; || true
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.
108
109 %post
110 # %{relocateConfig}lib/libg2c.la
111 # %{relocateConfig}lib/libstdc++.la
112 # %{relocateConfig}lib/libsupc++.la
113 # %if "%cpu" == "amd64"
114 # %{relocateConfig}lib64/libg2c.la
115 # %{relocateConfig}lib64/libstdc++.la
116 # %{relocateConfig}lib64/libsupc++.la
117 # %{relocateConfig}lib/32/libg2c.la
118 # %{relocateConfig}lib/32/libstdc++.la
119 # %{relocateConfig}lib/32/libsupc++.la
120 # %endif
121 # %if "%gcc4" == "true"
122 # %{relocateConfig}lib/libgfortran.la
123 # %{relocateConfig}lib/libgfortranbegin.la
124 # %endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines