1 | # |
---|
2 | # spec file for building gcc for rtems |
---|
3 | # |
---|
4 | # Copyright (c) 1999 OARCorp, Huntsville, AL |
---|
5 | # |
---|
6 | # please send bugfixes or comments to joel@OARcorp.com |
---|
7 | # |
---|
8 | |
---|
9 | Vendor: OAR Corporation |
---|
10 | Distribution: Linux |
---|
11 | Name: @target_alias@-gnat-newlib |
---|
12 | Summary: gnat, gcc, and newlib C Library for @target_alias@. |
---|
13 | Group: gnatrtems |
---|
14 | Release: @Release@ |
---|
15 | License: gcc is GPL/LGPL ; newlib no has restrictions on run-time usage |
---|
16 | |
---|
17 | Provides: rtems-base-gnat @target_alias@-gnat |
---|
18 | Provides: rtems-base-gnat-binutils @target_alias@-gnat-binutils |
---|
19 | # Requires: @target_alias@-binutils |
---|
20 | |
---|
21 | Autoreqprov: on |
---|
22 | Packager: corsepiu@faw.uni-ulm.de and joel@OARcorp.com |
---|
23 | |
---|
24 | Version: gnat@gnat_version@ |
---|
25 | Source0: ftp://ftp.gnu.org/pub/gnu/gcc/gcc-@gcc_version@.tar.gz |
---|
26 | Source1: ftp://sourceware.cygnus/com/pub/newlib/newlib-@newlib_version@.tar.gz |
---|
27 | Source2: ftp://cs.nyu.edu/pub/gnat/gnat-@gnat_version@-src.tar.gz |
---|
28 | Source3: ftp://ftp.gnu.org/pub/gnu/binutils/binutils-@binutils_version@.tar.gz |
---|
29 | Patch0: gcc-@gcc_version@-rtems-gnat-@gnat_version@-@gcc_patch_version@.diff |
---|
30 | Patch1: newlib-@newlib_version@-rtems-@newlib_patch_version@.diff |
---|
31 | Patch2: gnat-@gnat_version@-rtems-@gnat_patch_version@.diff |
---|
32 | Patch3: binutils-@binutils_version@-rtems-gnat-@gnat_version@-@binutils_patch_version@.diff |
---|
33 | # |
---|
34 | Buildroot: /tmp |
---|
35 | |
---|
36 | # |
---|
37 | # The original sources are not included in the source RPM. |
---|
38 | # If we included them, then the source RPMs for each target |
---|
39 | # would duplicate MBs of source unnecessarily. This is |
---|
40 | # a duplication of over 30 MBs of source for each of |
---|
41 | # the more than 10 targets it is possible to build. |
---|
42 | # |
---|
43 | # You can get them yourself from the Internet and copy them to |
---|
44 | # your /usr/src/redhat/SOURCES directory ($RPM_SOURCE_DIR). |
---|
45 | # Or you can try the ftp options of rpm :-) |
---|
46 | # |
---|
47 | NoSource: 0 |
---|
48 | NoSource: 1 |
---|
49 | NoSource: 2 |
---|
50 | NoSource: 3 |
---|
51 | |
---|
52 | %description |
---|
53 | RTEMS is an open source operating system for embedded systems. |
---|
54 | |
---|
55 | This is gcc's and newlib C Library's sources with patches for RTEMS. |
---|
56 | |
---|
57 | The original sources are not included in the source RPM. |
---|
58 | If we included them, then the source RPMs for each target |
---|
59 | would duplicate MBs of source unnecessarily. This is |
---|
60 | a duplication of over 30 MBs of source for each of |
---|
61 | the more than 10 targets it is possible to build. |
---|
62 | |
---|
63 | You can get them yourself from the Internet and copy them to |
---|
64 | your /usr/src/redhat/SOURCES directory ($RPM_SOURCE_DIR). |
---|
65 | Or you can try the ftp options of rpm :-) |
---|
66 | |
---|
67 | This version of GNAT/RTEMS RPMs is based on the following: |
---|
68 | |
---|
69 | + gnat-@gnat_version@-src |
---|
70 | + gcc-@gcc_version@ |
---|
71 | + newlib-@newlib_version@ |
---|
72 | + binutils-@binutils_version@ |
---|
73 | |
---|
74 | with appropriate patches. |
---|
75 | |
---|
76 | %package -n rtems-base-gnat |
---|
77 | Summary: base package for rtems gnat, gcc, and newlib C Library |
---|
78 | Group: rtems |
---|
79 | |
---|
80 | %description -n rtems-base-gnat |
---|
81 | |
---|
82 | RTEMS is an open source operating system for embedded systems. |
---|
83 | |
---|
84 | This is the files for gnat, gcc, and newlib that are shared by all targets. |
---|
85 | |
---|
86 | %package -n rtems-base-gnat-binutils |
---|
87 | Summary: base package for rtems binutils |
---|
88 | Group: rtems |
---|
89 | |
---|
90 | %description -n rtems-base-gnat-binutils |
---|
91 | |
---|
92 | RTEMS is an open source operating system for embedded systems. |
---|
93 | |
---|
94 | This is the base for binutils regardless of target CPU. |
---|
95 | |
---|
96 | %package -n @target_alias@-gnat-binutils |
---|
97 | Summary: rtems binutils for @target_alias@ |
---|
98 | Group: rtems |
---|
99 | Requires: rtems-base-gnat-binutils |
---|
100 | |
---|
101 | %description -n @target_alias@-gnat-binutils |
---|
102 | |
---|
103 | RTEMS is an open source operating system for embedded systems. |
---|
104 | |
---|
105 | This is the GNU binutils for RTEMS targetting @target_alias@. |
---|
106 | |
---|
107 | %package -n @target_alias@-gnat |
---|
108 | Summary: rtems gnat, gcc, and newlib C Library for @target_alias@ |
---|
109 | Group: rtems |
---|
110 | Requires: @target_alias@-gnat-binutils rtems-base-gnat |
---|
111 | |
---|
112 | %description -n @target_alias@-gnat |
---|
113 | RTEMS is an open source operating system for embedded systems. |
---|
114 | |
---|
115 | This is gnat, gcc, and newlib C Library for @target_alias@. |
---|
116 | |
---|
117 | %prep |
---|
118 | # untar the sources inside @target_alias@-gnat-newlib |
---|
119 | %setup -c -n @target_alias@-gnat-newlib -a 0 -a 1 -a 2 -a 3 |
---|
120 | |
---|
121 | %patch0 -p0 |
---|
122 | %patch1 -p0 |
---|
123 | %patch2 -p0 |
---|
124 | %patch3 -p0 |
---|
125 | |
---|
126 | # this 281 needs to be a variable. :( |
---|
127 | cd gcc-@gcc_version@ |
---|
128 | patch -p0 <../gnat-@gnat_version@-src/src/gcc-281.dif |
---|
129 | |
---|
130 | mv ../gnat-@gnat_version@-src/src/ada . |
---|
131 | |
---|
132 | cd ada |
---|
133 | touch treeprs.ads a-[es]info.h nmake.ad[bs] |
---|
134 | cd ../.. # now back at top |
---|
135 | |
---|
136 | # Now we should be done patching everything.. build up a source tree |
---|
137 | |
---|
138 | # this sequence is VERY dependent on the versions involved |
---|
139 | # When the gcc gets updated to 2.95.x or newer, this HAS to change. |
---|
140 | |
---|
141 | mkdir src |
---|
142 | cd src |
---|
143 | # configure scripts |
---|
144 | for f in config config.guess config.sub configure configure.in \ |
---|
145 | config-ml.in include install-sh ltconfig ltmain.sh Makefile.in \ |
---|
146 | move-if-change mkinstalldirs libiberty |
---|
147 | do |
---|
148 | # some packages have more configure scripts than others |
---|
149 | # our list is inclusive |
---|
150 | test -r ../binutils-@binutils_version@/$f && \ |
---|
151 | mv ../binutils-@binutils_version@/$f . |
---|
152 | done |
---|
153 | |
---|
154 | # link in gcc |
---|
155 | mv ../gcc-@gcc_version@ gcc |
---|
156 | |
---|
157 | # link in binutils |
---|
158 | for f in bfd binutils gas gprof ld opcodes etc |
---|
159 | do |
---|
160 | mv ../binutils-@binutils_version@/$f . |
---|
161 | done |
---|
162 | |
---|
163 | # link in newlib |
---|
164 | mv ../newlib-@newlib_version@/newlib . |
---|
165 | cd .. |
---|
166 | |
---|
167 | # now we have a linked together source tree |
---|
168 | test -d build || mkdir build |
---|
169 | |
---|
170 | |
---|
171 | %build |
---|
172 | cd build |
---|
173 | # after we switch off gcc 2.8.1, configure using gcc not a src directory |
---|
174 | # and build binutils separately. |
---|
175 | ../src/configure --target=@target_alias@ \ |
---|
176 | --with-gnu-as --with-gnu-ld --with-newlib --verbose \ |
---|
177 | --prefix=/opt/gnatrtems |
---|
178 | |
---|
179 | # for now we are building all the languages |
---|
180 | # '--enable-languages=c,c++' |
---|
181 | |
---|
182 | # # This is a hack that is only because gnat still uses gcc 2.8.1 |
---|
183 | # test -d ${RPM_BUILD_ROOT}/opt/gnatrtems/@target_alias@ || |
---|
184 | # mkdir -p ${RPM_BUILD_ROOT}/opt/gnatrtems/@target_alias@ |
---|
185 | # for dir in ${RPM_BUILD_ROOT}/opt/gnatrtems/@target_alias@/include \ |
---|
186 | # ${RPM_BUILD_ROOT}/opt/gnatrtems/@target_alias@/sys-include |
---|
187 | # do |
---|
188 | # test -d ${dir} || mkdir -p ${dir} |
---|
189 | # cp ../newlib-@newlib_version@/newlib/libc/sys/rtems/include/limits.h ${dir} |
---|
190 | # done |
---|
191 | |
---|
192 | make CC=gcc CFLAGS="-O2" LANGUAGES="c" all |
---|
193 | make CC=gcc CFLAGS="-O2" LANGUAGES="c" info |
---|
194 | # must be installed to allow gnat to continue to build |
---|
195 | make CC=gcc CFLAGS="-O2" LANGUAGES="c" install install-info |
---|
196 | make prefix=$RPM_BUILD_ROOT/opt/gnatrtems \ |
---|
197 | CC=gcc CFLAGS="-O2" LANGUAGES="c" install install-info |
---|
198 | |
---|
199 | # When GNAT uses a gcc that finds the RTEMS limits.h, this will not |
---|
200 | # be needed. This should not be needed if the limits.h trick above works. |
---|
201 | # cd gcc |
---|
202 | # rm -f stmp-multilib |
---|
203 | # find . -name "*.a" -print | xargs -e rm -f |
---|
204 | # |
---|
205 | # make all |
---|
206 | # cd .. |
---|
207 | |
---|
208 | #################### Ada from here down ################### |
---|
209 | |
---|
210 | # Just so the log shows what directory we are in. |
---|
211 | pwd |
---|
212 | cd gcc |
---|
213 | echo "Starting build of GNAT proper." |
---|
214 | make prefix=$RPM_BUILD_ROOT/opt/gnatrtems \ |
---|
215 | CC=gcc CFLAGS="-O2" LANGUAGES="c ada gcov" |
---|
216 | |
---|
217 | echo "Starting build of cross GNAT tools" |
---|
218 | make prefix=$RPM_BUILD_ROOT/opt/gnatrtems \ |
---|
219 | CC=gcc CFLAGS="-O2 -g" LANGUAGES="c ada gcov" cross-gnattools |
---|
220 | |
---|
221 | echo "Starting build of ada.all.cross" |
---|
222 | make prefix=$RPM_BUILD_ROOT/opt/gnatrtems \ |
---|
223 | CC=gcc CFLAGS="-O2" LANGUAGES="c ada gcov" ada.all.cross |
---|
224 | |
---|
225 | # must have -gnato to pass validation |
---|
226 | # may want CC=gcc GNATLIBCFLAGS="-O3" GNATLIBFLAGS="-gnatpgn" gnatliy |
---|
227 | # NOTE: gnatlib is not multilib'ed -- serious embedded flaw |
---|
228 | echo "Starting build of gnatlib" |
---|
229 | make prefix=$RPM_BUILD_ROOT/opt/gnatrtems \ |
---|
230 | CC=gcc GNATLIBCFLAGS="-O2 -g" gnatlib |
---|
231 | |
---|
232 | %install |
---|
233 | cd build |
---|
234 | # Bug in gcc-2.95.1: It doesn't build this installation directory |
---|
235 | # If it doesn't find it, gcc doesn't install @target_alias@/bin/gcc |
---|
236 | # ../gcc-@gcc_version@/mkinstalldirs \ |
---|
237 | # $RPM_BUILD_ROOT/opt/gnatrtems/@target_alias@/bin |
---|
238 | |
---|
239 | cd gcc |
---|
240 | echo "Starting install of gnat" |
---|
241 | make prefix=$RPM_BUILD_ROOT/opt/gnatrtems \ |
---|
242 | CC=gcc CFLAGS="-O2 -g -gnata -gnatp" LANGUAGES="c ada" install |
---|
243 | # GNAT has to be mostly installed to even build itself |
---|
244 | |
---|
245 | make prefix=$RPM_BUILD_ROOT/opt/gnatrtems install-info |
---|
246 | |
---|
247 | # cd go back to build/ |
---|
248 | pwd |
---|
249 | cd .. |
---|
250 | |
---|
251 | # gzip info files |
---|
252 | gzip -f $RPM_BUILD_ROOT/opt/gnatrtems/info/*.info 2>/dev/null |
---|
253 | gzip -f $RPM_BUILD_ROOT/opt/gnatrtems/info/*.info-? 2>/dev/null |
---|
254 | gzip -f $RPM_BUILD_ROOT/opt/gnatrtems/info/*.info-?? 2>/dev/null |
---|
255 | |
---|
256 | rm -f dirs ; |
---|
257 | echo "%dir /opt/gnatrtems/lib" >> dirs ; |
---|
258 | echo "%dir /opt/gnatrtems/lib/gcc-lib" >> dirs ; |
---|
259 | echo "%dir /opt/gnatrtems/lib/gcc-lib/@target_alias@" >> dirs ; |
---|
260 | |
---|
261 | touch ../files |
---|
262 | # if test -f $RPM_BUILD_ROOT/opt/gnatrtems/info/configure.info.gz; |
---|
263 | # then |
---|
264 | # These common files are only present in binutils >= 2.9.5 |
---|
265 | # find $RPM_BUILD_ROOT/opt/gnatrtems/info -name 'configure.*' | \ |
---|
266 | # sed -e "s,^$RPM_BUILD_ROOT,,g" > ../files |
---|
267 | # else |
---|
268 | # touch ../files |
---|
269 | # fi |
---|
270 | # These target specific files are only present in binutils >= 2.9.5 |
---|
271 | if test -f /opt/gnatrtems/bin/@target_alias@-readelf@exe_ext@; |
---|
272 | then |
---|
273 | echo /opt/gnatrtems/bin/@target_alias@-readelf@exe_ext@ > ../files.target |
---|
274 | else |
---|
275 | touch ../files.target |
---|
276 | fi |
---|
277 | |
---|
278 | # Collect multilib subdirectories |
---|
279 | TGTDIR="$RPM_BUILD_ROOT/opt/gnatrtems/lib/gcc-lib/@target_alias@/@gcc_version@" |
---|
280 | find $TGTDIR \ |
---|
281 | \( -type d -a ! -path "$TGTDIR/include*" \) -print | \ |
---|
282 | sed -e "s,^$RPM_BUILD_ROOT,%dir ,g" >> dirs |
---|
283 | |
---|
284 | # Collect files to go into different packages |
---|
285 | # NOTE: This is left in as a place holder to move the 2.95.x code into. |
---|
286 | cp dirs ../files.gcc |
---|
287 | |
---|
288 | f=`find $TGTDIR ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`; |
---|
289 | for i in $f; do |
---|
290 | case $i in |
---|
291 | *) echo "$i" >> ../files.gcc ;; |
---|
292 | esac |
---|
293 | done |
---|
294 | |
---|
295 | %files -n rtems-base-gnat-binutils -f files |
---|
296 | %dir /opt/gnatrtems/info |
---|
297 | # %doc /opt/gnatrtems/info/dir |
---|
298 | # %doc /opt/gnatrtems/info/as.info.gz |
---|
299 | # %doc /opt/gnatrtems/info/as.info-?.gz |
---|
300 | # %doc /opt/gnatrtems/info/bfd.info.gz |
---|
301 | # %doc /opt/gnatrtems/info/bfd.info-?.gz |
---|
302 | # %doc /opt/gnatrtems/info/binutils.info.gz |
---|
303 | # %doc /opt/gnatrtems/info/binutils.info-?.gz |
---|
304 | # %doc /opt/gnatrtems/info/ld.info.gz |
---|
305 | # %doc /opt/gnatrtems/info/ld.info-?.gz |
---|
306 | # %doc /opt/gnatrtems/info/gasp.info.gz |
---|
307 | # %doc /opt/gnatrtems/info/standards.info.gz |
---|
308 | |
---|
309 | %dir /opt/gnatrtems/man |
---|
310 | %dir /opt/gnatrtems/man/man1 |
---|
311 | |
---|
312 | %dir /opt/gnatrtems/include |
---|
313 | /opt/gnatrtems/include/bfd.h |
---|
314 | /opt/gnatrtems/include/ansidecl.h |
---|
315 | /opt/gnatrtems/include/bfdlink.h |
---|
316 | |
---|
317 | %dir /opt/gnatrtems/lib |
---|
318 | /opt/gnatrtems/lib/libbfd* |
---|
319 | /opt/gnatrtems/lib/libiberty* |
---|
320 | /opt/gnatrtems/lib/libopcodes* |
---|
321 | |
---|
322 | # %dir /opt/gnatrtems/share |
---|
323 | # %dir /opt/gnatrtems/share/locale |
---|
324 | |
---|
325 | %files -n @target_alias@-gnat-binutils -f files.target |
---|
326 | %doc /opt/gnatrtems/man/man1/@target_alias@-*.1 |
---|
327 | |
---|
328 | %dir /opt/gnatrtems/bin |
---|
329 | /opt/gnatrtems/bin/@target_alias@-addr2line@exe_ext@ |
---|
330 | /opt/gnatrtems/bin/@target_alias@-ar@exe_ext@ |
---|
331 | /opt/gnatrtems/bin/@target_alias@-as@exe_ext@ |
---|
332 | /opt/gnatrtems/bin/@target_alias@-c++filt@exe_ext@ |
---|
333 | /opt/gnatrtems/bin/@target_alias@-gasp@exe_ext@ |
---|
334 | /opt/gnatrtems/bin/@target_alias@-ld@exe_ext@ |
---|
335 | /opt/gnatrtems/bin/@target_alias@-nm@exe_ext@ |
---|
336 | /opt/gnatrtems/bin/@target_alias@-objcopy@exe_ext@ |
---|
337 | /opt/gnatrtems/bin/@target_alias@-objdump@exe_ext@ |
---|
338 | /opt/gnatrtems/bin/@target_alias@-ranlib@exe_ext@ |
---|
339 | # readelf is not in older binutils so get it from file list |
---|
340 | # /opt/gnatrtems/bin/@target_alias@-readelf@exe_ext@ |
---|
341 | /opt/gnatrtems/bin/@target_alias@-size@exe_ext@ |
---|
342 | /opt/gnatrtems/bin/@target_alias@-strings@exe_ext@ |
---|
343 | /opt/gnatrtems/bin/@target_alias@-strip@exe_ext@ |
---|
344 | |
---|
345 | %dir /opt/gnatrtems/@target_alias@ |
---|
346 | %dir /opt/gnatrtems/@target_alias@/bin |
---|
347 | /opt/gnatrtems/@target_alias@/bin/ar@exe_ext@ |
---|
348 | /opt/gnatrtems/@target_alias@/bin/as@exe_ext@ |
---|
349 | /opt/gnatrtems/@target_alias@/bin/ld@exe_ext@ |
---|
350 | /opt/gnatrtems/@target_alias@/bin/nm@exe_ext@ |
---|
351 | /opt/gnatrtems/@target_alias@/bin/ranlib@exe_ext@ |
---|
352 | /opt/gnatrtems/@target_alias@/bin/strip@exe_ext@ |
---|
353 | |
---|
354 | %dir /opt/gnatrtems/@target_alias@/lib |
---|
355 | /opt/gnatrtems/@target_alias@/lib/ldscripts |
---|
356 | %files -n rtems-base-gnat |
---|
357 | %dir /opt/gnatrtems/info |
---|
358 | # %doc /opt/gnatrtems/info/dir |
---|
359 | %doc /opt/gnatrtems/info/cpp.info* |
---|
360 | %doc /opt/gnatrtems/info/gcc.info* |
---|
361 | %doc /opt/gnatrtems/info/libc.info* |
---|
362 | %doc /opt/gnatrtems/info/libm.info* |
---|
363 | |
---|
364 | # %dir /opt/gnatrtems/man |
---|
365 | # %dir /opt/gnatrtems/man/man1 |
---|
366 | %doc /opt/gnatrtems/man/man1/cccp.1 |
---|
367 | %doc /opt/gnatrtems/man/man1/@target_alias@-gcc.1 |
---|
368 | |
---|
369 | %dir /opt/gnatrtems/bin |
---|
370 | # /opt/gnatrtems/bin/cpp@exe_ext@ |
---|
371 | # /opt/gnatrtems/bin/gcov@exe_ext@ |
---|
372 | %dir /opt/gnatrtems/include |
---|
373 | # /opt/gnatrtems/include/g++-3 |
---|
374 | |
---|
375 | %files -n @target_alias@-gnat -f files.gcc |
---|
376 | /opt/gnatrtems/bin/@target_alias@-gcc@exe_ext@ |
---|
377 | |
---|
378 | %dir /opt/gnatrtems/lib/gcc-lib/@target_alias@/@gcc_version@/include |
---|
379 | |
---|
380 | /opt/gnatrtems/@target_alias@ |
---|
381 | |
---|
382 | %post -n @target_alias@-gnat |
---|
383 | if test -d $RPM_INSTALL_PREFIX/rtems/info; |
---|
384 | then |
---|
385 | rm -f $RPM_INSTALL_PREFIX/rtems/info/dir |
---|
386 | f=`find $RPM_INSTALL_PREFIX/rtems/info -name '*.info.gz'` |
---|
387 | test -n "$f" && for i in $f; do |
---|
388 | install-info $i $RPM_INSTALL_PREFIX/rtems/info/dir |
---|
389 | done |
---|
390 | fi |
---|
391 | |
---|
392 | %postun -n @target_alias@-gnat |
---|
393 | if test -d $RPM_INSTALL_PREFIX/rtems/info; |
---|
394 | then |
---|
395 | rm -f $RPM_INSTALL_PREFIX/rtems/info/dir |
---|
396 | f=`find $RPM_INSTALL_PREFIX/rtems/info -name '*.info.gz'` |
---|
397 | test -n "$f" && for i in $f; do |
---|
398 | install-info $i $RPM_INSTALL_PREFIX/rtems/info/dir |
---|
399 | done |
---|
400 | fi |
---|
401 | |
---|