ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/gcc.spec
Revision: 1.20
Committed: Wed May 9 12:32:52 2007 UTC (17 years, 11 months ago) by eulisse
Branch: MAIN
CVS Tags: re20080623, forPHEDEX303, forPHEDEX-datasvc100, forPHEDEX302, forPHEDEX301, forPHEDEX300, forPHEDEX300pre14, forPHEDEX300pre13, forPHEDEX300pre12, forPHEDEX300pre11, forPHEDEX-datasvc002, forPHEDEX-datasvc001, forPHEDEX300pre7, forPHEDEX300pre6, forPHEDEX263, forPHEDEX262_cmsbuild2, forPHEDEX262_cmsbuild, forPHEDEX262, forPHEDEX261, forPHEDEX260-1, forPHEDEX260, ge20071212-phedex, forPHEDEX2540, forPHEDEX2536, pe20070522a-ports, pe20070519a-ports, pe20070512a-ports
Changes since 1.19: +52 -115 lines
Log Message:
* gcc for slc4_ia32 can be built on x86_64 using linux32.
* custom (non system) binutils are now optional (not built by default).

File Contents

# Content
1 ### RPM external gcc 3.4.5
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 %define gmpVersion 4.2.1
16 %define mpfrVersion 2.2.1
17 Source2: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmpVersion}.tar.bz2
18 Source3: http://www.mpfr.org/mpfr-current/mpfr-%{mpfrVersion}.tar.bz2
19
20 %define cpu %(echo %cmsplatf | cut -d_ -f2)
21 %prep
22 %setup -T -b 0 -n gcc-%realversion
23
24 %if "%cmsos" == "slc4_ia32"
25 cat << \EOF_CONFIG_GCC >> gcc/config.gcc
26 # CMS patch to include gcc/config/i386/t-cms when building gcc
27 tm_file="$tm_file i386/cms.h"
28 tmake_file="$tmake_file i386/t-cms"
29 EOF_CONFIG_GCC
30
31 cat << \EOF_CMS_H > gcc/config/i386/cms.h
32 #undef ASM_SPEC
33 #define ASM_SPEC "%%{v:-V} %%{Qy:} %%{!Qn:-Qy} %%{n} %%{T} %%{Ym,*} %%{Yd,*} %%{Wa,*:%%*} --32"
34 #undef CC1_SPEC
35 #define CC1_SPEC "%%(cc1_cpu) %%{profile:-p} -m32"
36 #undef CC1PLUS_SPEC
37 #define CC1PLUS_SPEC "-m32"
38 #undef MULTILIB_DEFAULTS
39 #define MULTILIB_DEFAULTS { "m32" }
40 EOF_CMS_H
41
42 cat << \EOF_T_CMS > gcc/config/i386/t-cms
43 MULTILIB_OPTIONS = m32
44 MULTILIB_DIRNAMES = ../lib
45 MULTILIB_MATCHES = m32=m32
46 EOF_T_CMS
47 %endif
48
49 %setup -D -T -b 1 -n binutils-%binutilsv
50 %setup -D -T -b 2 -n gmp-%{gmpVersion}
51 %setup -D -T -b 3 -n mpfr-%{mpfrVersion}
52
53 %build
54 # Set special variables required to build 32-bit executables on 64-bit
55 # systems. Note that if the architecture is SLC4/IA32, we may be on a
56 # 64-bit system and need to produce a 32-bit capable compiler, which
57 # _itself_ is a 32-bit executable.
58 case $(uname -m):%{cmsos} in
59 *:slc4_ia32 )
60 CCOPTS="-m32 -Wa,--32" ;;
61 * )
62 CCOPTS="" ;;
63 esac
64
65 # If requested, build our own binutils. Currently the default is to use
66 # the system binutils.
67 %if "%{?use_external_binutils:set}" == "set"
68 cd ../binutils-%{binutilsv}
69 CC="gcc $CCOPTS" ./configure --prefix=%i
70 make %makeprocesses
71 make install
72 %endif
73
74 # Build GMP/MPFR for GCC 4.x
75 cd ../gmp-%{gmpVersion}
76 CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/gmp --disable-shared
77 make %makeprocesses
78 make install
79
80 cd ../mpfr-%{mpfrVersion}
81 CC="gcc $CCOPTS" ./configure --prefix=%i/tmp/mpfr --with-gmp=%i/tmp/gmp --disable-shared
82 make %makeprocesses
83
84 # Build the compilers
85 cd ../gcc-%v
86 mkdir -p obj
87 cd obj
88 CC="gcc $CCOPTS" \
89 ../configure --prefix=%i \
90 --enable-languages=c,c++,`case %v in 3.*) echo f77;; *) echo fortran;; esac` \
91 --with-gmp-dir=%_builddir/gmp-%{gmpVersion} \
92 --with-mpfr-dir=%_builddir/mpfr-%{mpfrVersion} \
93 --enable-shared
94
95 make %makeprocesses bootstrap
96
97 %install
98 cd %_builddir/gcc-%{v}/obj && make install
99 ln -s gcc %i/bin/cc
100 find %i/lib %i/lib32 %i/lib64 -name '*.la' -exec rm -f {} \; || true
101
102 %post
103 # %{relocateConfig}lib/libg2c.la
104 # %{relocateConfig}lib/libstdc++.la
105 # %{relocateConfig}lib/libsupc++.la
106 # %if "%cpu" == "amd64"
107 # %{relocateConfig}lib64/libg2c.la
108 # %{relocateConfig}lib64/libstdc++.la
109 # %{relocateConfig}lib64/libsupc++.la
110 # %{relocateConfig}lib/32/libg2c.la
111 # %{relocateConfig}lib/32/libstdc++.la
112 # %{relocateConfig}lib/32/libsupc++.la
113 # %endif
114 # %if "%gcc4" == "true"
115 # %{relocateConfig}lib/libgfortran.la
116 # %{relocateConfig}lib/libgfortranbegin.la
117 # %endif