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