summaryrefslogtreecommitdiffstats
path: root/rtems/config/tools/rtems-nios2-gcc-4.1-newlib-1.19.0-1.cfg
blob: cb410da672bb767ad2299effec10a2deae023f90 (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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#
# RTEMS NIOS2 GCC 4.1., Newlib 1.19.0
#
# This configuration has special support for the NIOS2.
#

%disable select

%include %{_configdir}/checks.cfg
%include %{_configdir}/base.cfg

%define gcc_version    4.1
%define newlib_version 1.19.0
%define newlib_cfg     normalc

%define with_threads 1
%define with_plugin  0
%define enable_cxx   1

#
# The RTEMS 4.11 patches
#
Patch0:  %{rtems_gcc_patches}/nios2/nios2-gcc-4.1-rtems-20110818.diff
Patch10: %{rtems_newlib_patches}/nios2/nios2-newlib-1.19.0-rtems-20110720.diff

Name:      %{_target}-gcc-%{gcc_version}-newlib-%{newlib_version}-%{release}
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)

#
# Supports Candian Cross (Cxc).
#
%define allow_cxc

#
# Source
#
#
# GCC core and G++
#
Source0: http://ftp.rtems.org/ftp/pub/rtems/people/chrisj/nios/nios2-gcc-4.1.tar.bz2

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

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

#
# Prepare the source code.
#
%prep
  # gcc
  source_dir_0="gcc-%{gcc_version}"
  %setup -q -c -n %{name}-%{version}
  cd ${source_dir_0}
  %{?patch0:%patch0 %{?patch0_opts:%{patch0_opts}}%{!?patch0_opts:-p1}}
  %{?patch1:%patch1 %{?patch1_opts:%{patch1_opts}}%{!?patch1_opts:-p1}}
  %{?patch2:%patch2 %{?patch2_opts:%{patch2_opts}}%{!?patch2_opts:-p1}}
  %{?patch3:%patch3 %{?patch3_opts:%{patch3_opts}}%{!?patch3_opts:-p1}}
  %{?patch4:%patch4 %{?patch4_opts:%{patch4_opts}}%{!?patch4_opts:-p1}}
  %{?patch5:%patch5 %{?patch5_opts:%{patch5_opts}}%{!?patch5_opts:-p1}}
  %{?patch6:%patch6 %{?patch6_opts:%{patch6_opts}}%{!?patch6_opts:-p1}}
  %{?patch7:%patch7 %{?patch7_opts:%{patch7_opts}}%{!?patch7_opts:-p1}}
  %{?patch8:%patch8 %{?patch8_opts:%{patch8_opts}}%{!?patch8_opts:-p1}}
  %{?patch9:%patch9 %{?patch9_opts:%{patch9_opts}}%{!?patch9_opts:-p1}}
  cd ..

  # newlib
  source_dir_10="newlib-%{newlib_version}"
  %setup -q -D -T -n %{name}-%{version} -a10
  cd ${source_dir_10}
  %{?patch10:%patch10 %{?patch10_opts:%{patch10_opts}}%{!?patch10_opts:-p1}}
  %{?patch11:%patch11 %{?patch11_opts:%{patch11_opts}}%{!?patch11_opts:-p1}}
  %{?patch12:%patch12 %{?patch12_opts:%{patch12_opts}}%{!?patch12_opts:-p1}}
  %{?patch13:%patch13 %{?patch13_opts:%{patch13_opts}}%{!?patch13_opts:-p1}}
  %{?patch14:%patch14 %{?patch14_opts:%{patch14_opts}}%{!?patch14_opts:-p1}}
  %{?patch15:%patch15 %{?patch15_opts:%{patch15_opts}}%{!?patch15_opts:-p1}}
  %{?patch16:%patch16 %{?patch16_opts:%{patch16_opts}}%{!?patch16_opts:-p1}}
  %{?patch17:%patch17 %{?patch17_opts:%{patch17_opts}}%{!?patch17_opts:-p1}}
  %{?patch18:%patch18 %{?patch18_opts:%{patch18_opts}}%{!?patch18_opts:-p1}}
  %{?patch19:%patch19 %{?patch19_opts:%{patch19_opts}}%{!?patch19_opts:-p1}}
  cd ..

  # Link newlib into the gcc source tree
  %{__rmfile} ${source_dir_0}/newlib
  %{__ln_s} $PWD/${source_dir_10}/newlib ${source_dir_0}/newlib

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

  # Fix timestamps
  cd ${source_dir_0}
  contrib/gcc_update --touch
  cd ..

%build
  %{build_directory}

  mkdir -p ${build_dir}
  cd ${build_dir}

  languages="c"
%if %{enable_cxx}
  languages="$languages,c++"
%endif

  %{host_build_flags}

  ../${source_dir_0}/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 \
    %{?with_lto:--enable-lto}%{!?with_lto:--disable-lto} \
    %{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \
    %{?with_plugin:--enable-plugin}%{!?with_plugin:--disable-plugin} \
    %{?enable_obsolete:--enable-obsolete} \
    --enable-languages="$languages"

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

  # jobs > 1 is broken with this version of gcc
  %{__make} -w N2GNU_BUILD_NEWLIB="%{newlib_cfg}" all
  cd ..

%install
  %{__rmdir} $SB_BUILD_ROOT

  cd ${build_dir}

  #
  # Filter the doc stuff we do not want so it builds without error on
  # hosts that do not have tex to pdf converters installed.
  #
  for m in $(find . -name Makefile)
  do
    mv $m $m.orig
    echo "Doc filteirng $m.orig -> $m"
    cat $m.orig | sed -e 's/ pdf / /g' \
                      -e 's/ pdf$/ /g' \
                      -e 's/ install-pdf / /g' \
                      -e 's/ install-pdf$/ /g' \
                      -e 's/ install-html / /g' \
                      -e 's/ install-html$/ /g' \
                      -e 's/ html / /g' \
                      -e 's/ html$/ /g' > $m
  done

  %{__make} -w DESTDIR=$SB_BUILD_ROOT N2GNU_BUILD_NEWLIB="%{newlib_cfg}" install
  cd ..

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

  # We use the version from binutils
  %{__rmfile} $SB_BUILD_ROOT%{_bindir}/%{_target}-c++filt%{_exeext}

  # We don't ship info/dir
  %{__rmfile} $SB_BUILD_ROOT%{_infodir}/dir

  # Don't want libffi's man-pages
  %{__rmfile} $SB_BUILD_ROOT%{_mandir}/man3/*ffi*

  # Clean the symlinks away incase the source is a repo
  %{__rmfile} ${source_dir_0}/newlib