1 | # |
---|
2 | # RTEMS NIOS2 GCC 4.1., Newlib 1.19.0 |
---|
3 | # |
---|
4 | # This configuration has special support for the NIOS2. |
---|
5 | # |
---|
6 | |
---|
7 | %include %{_configdir}/checks.cfg |
---|
8 | %include %{_configdir}/base.cfg |
---|
9 | |
---|
10 | %define gcc_version 4.1 |
---|
11 | %define newlib_version 1.19.0 |
---|
12 | %define newlib_cfg normalc |
---|
13 | |
---|
14 | %define with_threads 1 |
---|
15 | %define with_plugin 0 |
---|
16 | %define enable_cxx 1 |
---|
17 | |
---|
18 | # |
---|
19 | # The RTEMS 4.11 patches |
---|
20 | # |
---|
21 | Patch0: %{rtems_gcc_patches}/nios2/nios2-gcc-4.1-rtems-20110818.diff |
---|
22 | Patch10: %{rtems_newlib_patches}/nios2/nios2-newlib-1.19.0-rtems-20110720.diff |
---|
23 | |
---|
24 | Name: %{_target}-gcc-%{gcc_version}-newlib-%{newlib_version}-%{release} |
---|
25 | Summary: GCC v%{gcc_version} and Newlib v%{newlib_version} for target %{_target} on host %{_host} |
---|
26 | Version: %{gcc_version} |
---|
27 | Release: %{release} |
---|
28 | URL: http://gcc.gnu.org/ |
---|
29 | BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n) |
---|
30 | |
---|
31 | # |
---|
32 | # Source |
---|
33 | # |
---|
34 | # |
---|
35 | # GCC core and G++ |
---|
36 | # |
---|
37 | Source0: http://ftp.rtems.org/ftp/pub/rtems/people/chrisj/nios/nios2-gcc-4.1.tar.bz2 |
---|
38 | |
---|
39 | # |
---|
40 | # Newlib |
---|
41 | # |
---|
42 | Source10: ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz |
---|
43 | |
---|
44 | # |
---|
45 | # The GCC library directory |
---|
46 | # |
---|
47 | %global _gcclibdir %{_prefix}/lib |
---|
48 | |
---|
49 | # |
---|
50 | # Prepare the source code. |
---|
51 | # |
---|
52 | %prep |
---|
53 | %setup -q -c -T -n %{name}-%{version} |
---|
54 | |
---|
55 | # gcc |
---|
56 | %setup -q -T -D -n %{name}-%{version} -a0 |
---|
57 | cd gcc-%{gcc_version} |
---|
58 | %{?patch0:%patch0 -p1} |
---|
59 | cd .. |
---|
60 | |
---|
61 | # newlib |
---|
62 | %setup -q -T -D -n %{name}-%{version} -a10 |
---|
63 | cd newlib-%{newlib_version} |
---|
64 | %{?patch10:%patch10 -p1} |
---|
65 | cd .. |
---|
66 | # Link newlib into the gcc source tree |
---|
67 | ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version} |
---|
68 | |
---|
69 | echo "%{gcc_version_message}" > gcc-%{gcc_version}/gcc/DEV-PHASE |
---|
70 | |
---|
71 | # Fix timestamps |
---|
72 | cd gcc-%{gcc_version} |
---|
73 | contrib/gcc_update --touch |
---|
74 | cd .. |
---|
75 | |
---|
76 | %build |
---|
77 | export PATH="%{_bindir}:${PATH}" |
---|
78 | mkdir -p build |
---|
79 | cd build |
---|
80 | languages="c" |
---|
81 | %if %{enable_cxx} |
---|
82 | languages="$languages,c++" |
---|
83 | %endif |
---|
84 | %if "%{_build}" != "%{_host}" |
---|
85 | CFLAGS_FOR_BUILD="-g -O2 -Wall" \ |
---|
86 | CC="%{_host}-gcc ${SB_OPT_FLAGS}" \ |
---|
87 | %else |
---|
88 | # gcc is not ready to be compiled with -std=gnu99 |
---|
89 | CC=$(echo "%{__cc} ${SB_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,') \ |
---|
90 | %endif |
---|
91 | ../gcc-%{gcc_version}/configure \ |
---|
92 | --prefix=%{_prefix} \ |
---|
93 | --bindir=%{_bindir} \ |
---|
94 | --exec_prefix=%{_exec_prefix} \ |
---|
95 | --includedir=%{_includedir} \ |
---|
96 | --libdir=%{_gcclibdir} \ |
---|
97 | --libexecdir=%{_libexecdir} \ |
---|
98 | --mandir=%{_mandir} \ |
---|
99 | --infodir=%{_infodir} \ |
---|
100 | --datadir=%{_datadir} \ |
---|
101 | --build=%_build --host=%_host \ |
---|
102 | --target=%{_target} \ |
---|
103 | --disable-libstdcxx-pch \ |
---|
104 | --with-gnu-as --with-gnu-ld --verbose \ |
---|
105 | --with-newlib \ |
---|
106 | --with-system-zlib \ |
---|
107 | --disable-nls --without-included-gettext \ |
---|
108 | --disable-win32-registry \ |
---|
109 | --enable-version-specific-runtime-libs \ |
---|
110 | %{?with_lto:--enable-lto}%{!?with_lto:--disable-lto} \ |
---|
111 | %{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \ |
---|
112 | %{?with_plugin:--enable-plugin}%{!?with_plugin:--disable-plugin} \ |
---|
113 | %{?enable_obsolete:--enable-obsolete} \ |
---|
114 | --enable-languages="$languages" |
---|
115 | |
---|
116 | %if "%_host" != "%_build" |
---|
117 | # Bug in gcc-3.2.1: |
---|
118 | # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs |
---|
119 | mkdir -p gcc/include |
---|
120 | cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h |
---|
121 | %endif |
---|
122 | |
---|
123 | # jobs > 1 is broken with this version of gcc |
---|
124 | %{__make} -w N2GNU_BUILD_NEWLIB="%{newlib_cfg}" all |
---|
125 | cd .. |
---|
126 | |
---|
127 | %install |
---|
128 | export PATH="%{_bindir}:${PATH}" |
---|
129 | rm -rf $SB_BUILD_ROOT |
---|
130 | |
---|
131 | cd build |
---|
132 | |
---|
133 | # |
---|
134 | # Filter the doc stuff we do not want so it builds without error on |
---|
135 | # hosts that do not have tex to pdf converters installed. |
---|
136 | # |
---|
137 | for m in $(find . -name Makefile) |
---|
138 | do |
---|
139 | mv $m $m.orig |
---|
140 | echo "Doc filteirng $m.orig -> $m" |
---|
141 | cat $m.orig | sed -e 's/ pdf / /g' \ |
---|
142 | -e 's/ pdf$/ /g' \ |
---|
143 | -e 's/ install-pdf / /g' \ |
---|
144 | -e 's/ install-pdf$/ /g' \ |
---|
145 | -e 's/ install-html / /g' \ |
---|
146 | -e 's/ install-html$/ /g' \ |
---|
147 | -e 's/ html / /g' \ |
---|
148 | -e 's/ html$/ /g' > $m |
---|
149 | done |
---|
150 | |
---|
151 | %{__make} -w DESTDIR=$SB_BUILD_ROOT N2GNU_BUILD_NEWLIB="%{newlib_cfg}" install |
---|
152 | cd .. |
---|
153 | |
---|
154 | # libiberty doesn't honor --libdir, but always installs to a |
---|
155 | # magically guessed _libdir |
---|
156 | rm -f ${SB_BUILD_ROOT}%{_libdir}/libiberty.a |
---|
157 | |
---|
158 | # We use the version from binutils |
---|
159 | rm -f $SB_BUILD_ROOT%{_bindir}/%{_target}-c++filt%{_exeext} |
---|
160 | |
---|
161 | # We don't ship info/dir |
---|
162 | rm -f $SB_BUILD_ROOT%{_infodir}/dir |
---|
163 | |
---|
164 | # Don't want libffi's man-pages |
---|
165 | rm -f $SB_BUILD_ROOT%{_mandir}/man3/*ffi* |
---|