summaryrefslogtreecommitdiffstats
path: root/config/gcc-4.6-1.cfg
blob: a25c0f95ea5d66c4ff5a1f493ecb1b37495556be (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#
# GCC 4.6 Version 1.
#
# This configuration file configure's, make's and install's gcc. It uses
# newlib, MPFR, MPC, and GMP in a one-tree build configuration.
#

%include %{_configdir}/checks.cfg

%ifn %{defined gcc_version_message}
%error No GCC Version message defined.
%endif

Summary:   GCC v%{gcc_version} and Newlib v%{newlib_version} for target %{_target} on host %{_host}
Version:   %{gcc_version}
Release:   %{release}
URL: 	   http://gcc.gnu.org/
BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)

#
# Source
#
#
# GCC core and G++
#
Source0: ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-core-%{gcc_version}.tar.bz2
%if %{enable_cxx}
Source1: ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_pkgvers}/%{gcc_version}/gcc-g++-%{gcc_version}.tar.bz2
%endif

#
# Newlib
#
Source10: ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz

#
# Packages GCC requires
#
Source20: http://www.mpfr.org/mpfr-%{mpfr_version}/mpfr-%{mpfr_version}.tar.bz2
Source21: http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
Source22: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2

#
# The GCC library directory
#
%global _gcclibdir %{_prefix}/lib

#
# Prepare the source code.
#
%prep
  %setup -q -c -T -n %{name}-%{version}

  # gcc core
  %setup -q -T -D -n %{name}-%{version} -a0
  cd gcc-%{gcc_version}
  %{?patch0:%patch0 -p1}
  cd ..

  # g++
  %{?source1:%setup -q -T -D -n %{name}-%{version} -a1}
  cd gcc-%{gcc_version}
  %{?patch1:%patch1 -p1}
  cd ..

  # newlib
  %setup -q -T -D -n %{name}-%{version} -a10
  cd newlib-%{newlib_version}
  %{?patch10:%patch10 -p1}
  cd ..
  # Link newlib into the gcc source tree
  ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version}

  # MPFR
  %setup -q -T -D -n %{name}-%{version} -a20
  cd mpfr-%{mpfr_version}
  %{?patch20:%patch20 -p1}
  cd ..
  # Build MPFR one-tree style
  ln -s ../mpfr-%{mpfr_version} gcc-%{gcc_version}/mpfr

  # MPC
  %setup -q -T -D -n %{name}-%{version} -a21
  cd mpc-%{mpc_version}
  %{?patch21:%patch21 -p1}
  cd ..
  # Build MPC one-tree style
  ln -s ../mpc-%{mpc_version} gcc-%{gcc_version}/mpc

  # GMP
  %setup -q -T -D -n %{name}-%{version} -a22
  cd gmp-%{gmp_version}
  %{?patch22:%patch22 -p1}
  cd ..
  # Build GMP one-tree style
  ln -s ../gmp-%{gmp_version} gcc-%{gcc_version}/gmp

  echo "%{gcc_version_message}" > gcc-%{gcc_version}/gcc/DEV-PHASE

  # Fix timestamps
  cd gcc-%{gcc_version}
  contrib/gcc_update --touch
  cd ..

%build
  export PATH="%{_bindir}:${PATH}"
  mkdir -p build
  cd build
  languages="c"
%if %{enable_cxx}
  languages="$languages,c++"
%endif
%if "%{_build}" != "%{_host}"
  CFLAGS_FOR_BUILD="-g -O2 -Wall" \
  CC="%{_host}-gcc ${TB_OPT_FLAGS}" \
%else
  # gcc is not ready to be compiled with -std=gnu99
  CC=$(echo "%{__cc} ${TB_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,') \
%endif
  ../gcc-%{gcc_version}/configure \
    --prefix=%{_prefix} \
    --bindir=%{_bindir} \
    --exec_prefix=%{_exec_prefix} \
    --includedir=%{_includedir} \
    --libdir=%{_gcclibdir} \
    --libexecdir=%{_libexecdir} \
    --mandir=%{_mandir} \
    --infodir=%{_infodir} \
    --datadir=%{_datadir} \
    --build=%_build --host=%_host \
    --target=%{_target} \
    --disable-libstdcxx-pch \
    --with-gnu-as --with-gnu-ld --verbose \
    --with-newlib \
    --with-system-zlib \
    --disable-nls --without-included-gettext \
    --disable-win32-registry \
    --enable-version-specific-runtime-libs \
    --disable-lto \
    %{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \
    %{?with_plugin:--enable-plugin}%{!?with_plugin:--disable-plugin} \
    --enable-newlib-io-c99-formats \
    %{?with_iconv:--enable-newlib-iconv} \
    --enable-languages="$languages"

%if "%_host" != "%_build"
  # Bug in gcc-3.2.1:
  # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
  mkdir -p gcc/include
  cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h
%endif

  %{__make} %{?_smp_mflags} all
  cd ..

%install
  export PATH="%{_bindir}:${PATH}"
  rm -rf $TB_BUILD_ROOT

  cd build
  %{__make} DESTDIR=$TB_BUILD_ROOT install
  cd ..

  # libiberty doesn't honor --libdir, but always installs to a
  # magically guessed _libdir
  rm -f ${TB_BUILD_ROOT}%{_libdir}/libiberty.a

  # We use the version from binutils
  rm -f $TB_BUILD_ROOT%{_bindir}/%{_target}-c++filt%{_exeext}

  # We don't ship info/dir
  rm -f $TB_BUILD_ROOT%{_infodir}/dir

  # Don't want libffi's man-pages
  rm -f $TB_BUILD_ROOT%{_mandir}/man3/*ffi*