1 | # |
---|
2 | # spec file for building gcc for rtems |
---|
3 | # |
---|
4 | # Copyright (c) 1999,2000,2001 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@-gcc-newlib |
---|
12 | Summary: gcc and newlib C Library for @target_alias@. |
---|
13 | Group: rtems |
---|
14 | Release: @Release@ |
---|
15 | License: gcc is GPL/LGPL ; newlib no has restrictions on run-time usage |
---|
16 | |
---|
17 | Autoreqprov: on |
---|
18 | Packager: corsepiu@faw.uni-ulm.de and joel@OARcorp.com |
---|
19 | |
---|
20 | Version: gcc@gcc_version@newlib@newlib_version@ |
---|
21 | Source0: ftp://ftp.gnu.org/pub/gnu/gcc/gcc-everything-@gcc_version@.tar.gz |
---|
22 | Source1: ftp://sourceware.cygnus.com/pub/newlib/newlib-@newlib_version@.tar.gz |
---|
23 | Patch0: gcc-@gcc_version@-rtems-@gcc_patch_version@.diff |
---|
24 | Patch1: newlib-@newlib_version@-rtems-@newlib_patch_version@.diff |
---|
25 | Buildroot: /tmp/@target_alias@-gcc-newlib |
---|
26 | |
---|
27 | # |
---|
28 | # The original sources are not included in the source RPM. |
---|
29 | # If we included them, then the source RPMs for each target |
---|
30 | # would duplicate MBs of source unnecessarily. This is |
---|
31 | # a duplication of over 30 MBs of source for each of |
---|
32 | # the more than 10 targets it is possible to build. |
---|
33 | # |
---|
34 | # You can get them yourself from the Internet and copy them to |
---|
35 | # your /usr/src/redhat/SOURCES directory ($RPM_SOURCE_DIR). |
---|
36 | # Or you can try the ftp options of rpm :-) |
---|
37 | # |
---|
38 | NoSource: 0 |
---|
39 | NoSource: 1 |
---|
40 | |
---|
41 | %description |
---|
42 | RTEMS is an open source operating system for embedded systems. |
---|
43 | |
---|
44 | This is gcc's and newlib C Library's sources with patches for RTEMS. |
---|
45 | |
---|
46 | The original sources are not included in the source RPM. |
---|
47 | If we included them, then the source RPMs for each target |
---|
48 | would duplicate MBs of source unnecessarily. This is |
---|
49 | a duplication of over 30 MBs of source for each of |
---|
50 | the more than 10 targets it is possible to build. |
---|
51 | |
---|
52 | You can get them yourself from the Internet and copy them to |
---|
53 | your /usr/src/[redhat|packages]/SOURCES directory ($RPM_SOURCE_DIR). |
---|
54 | Or you can try the ftp options of rpm :-) |
---|
55 | |
---|
56 | %prep |
---|
57 | # untar the sources inside @target_alias@-gcc-newlib |
---|
58 | %setup -c -n @target_alias@-gcc-newlib -a 0 -a 1 |
---|
59 | |
---|
60 | %patch0 -p0 |
---|
61 | %patch1 -p0 |
---|
62 | |
---|
63 | # Copy the C library into gcc's source tree |
---|
64 | ln -s ../newlib-@newlib_version@/newlib gcc-@gcc_version@ |
---|
65 | test -d build || mkdir build |
---|
66 | |
---|
67 | %build |
---|
68 | cd build |
---|
69 | |
---|
70 | ../gcc-@gcc_version@/configure --target=@target_alias@ \ |
---|
71 | --with-gnu-as --with-gnu-ld --with-newlib --verbose \ |
---|
72 | --enable-threads --prefix=/opt/rtems @GCCLANGS@ |
---|
73 | |
---|
74 | make all |
---|
75 | make info |
---|
76 | |
---|
77 | %install |
---|
78 | cd build |
---|
79 | # Bug in gcc-2.95.1: It doesn't build this installation directory |
---|
80 | # If it doesn't find it, gcc doesn't install @target_alias@/bin/gcc |
---|
81 | ../gcc-@gcc_version@/mkinstalldirs \ |
---|
82 | $RPM_BUILD_ROOT/opt/rtems/@target_alias@/bin |
---|
83 | |
---|
84 | make prefix=$RPM_BUILD_ROOT/opt/rtems install |
---|
85 | cd @target_alias@/newlib |
---|
86 | make prefix=$RPM_BUILD_ROOT/opt/rtems install-info |
---|
87 | |
---|
88 | # cd back to build/ |
---|
89 | cd ../.. |
---|
90 | |
---|
91 | # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets. |
---|
92 | # Rename it to target_alias-cpp |
---|
93 | if test -f $RPM_BUILD_ROOT/opt/rtems/bin/cpp@exe_ext@; |
---|
94 | then |
---|
95 | mv $RPM_BUILD_ROOT/opt/rtems/bin/cpp@exe_ext@ \ |
---|
96 | $RPM_BUILD_ROOT/opt/rtems/bin/@target_alias@-cpp@exe_ext@ |
---|
97 | fi |
---|
98 | |
---|
99 | # gzip info files |
---|
100 | gzip -f $RPM_BUILD_ROOT/opt/rtems/info/*.info 2>/dev/null |
---|
101 | gzip -f $RPM_BUILD_ROOT/opt/rtems/info/*.info-? 2>/dev/null |
---|
102 | gzip -f $RPM_BUILD_ROOT/opt/rtems/info/*.info-?? 2>/dev/null |
---|
103 | |
---|
104 | rm -f dirs ; |
---|
105 | echo "%dir /opt/rtems/lib" >> dirs ; |
---|
106 | echo "%dir /opt/rtems/lib/gcc-lib" >> dirs ; |
---|
107 | echo "%dir /opt/rtems/lib/gcc-lib/@target_alias@" >> dirs ; |
---|
108 | |
---|
109 | # Collect multilib subdirectories |
---|
110 | TGTDIR="/opt/rtems/lib/gcc-lib/@target_alias@/@gcc_version@" |
---|
111 | f=`gcc/xgcc --print-multi-lib | sed -e 's,;.*$,,'` |
---|
112 | for i in $f; do |
---|
113 | case $i in |
---|
114 | \.) echo "%dir ${TGTDIR}" >> dirs |
---|
115 | ;; |
---|
116 | *) echo "%dir ${TGTDIR}/$i" >> dirs |
---|
117 | ;; |
---|
118 | esac |
---|
119 | done |
---|
120 | |
---|
121 | # Collect files to go into different packages |
---|
122 | cp dirs files.chill |
---|
123 | cp dirs files.gcc |
---|
124 | cp dirs files.g77 |
---|
125 | cp dirs files.objc |
---|
126 | cp dirs files.gcj |
---|
127 | |
---|
128 | f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`; |
---|
129 | for i in $f; do |
---|
130 | case $i in |
---|
131 | *chill*) echo "$i" >> files.chill ;; |
---|
132 | *f771) ;; |
---|
133 | *cc1obj) ;; |
---|
134 | *libobjc*) echo "$i" >> files.objc ;; |
---|
135 | *include/objc*) ;; |
---|
136 | *jc1) ;; |
---|
137 | *jvgenmain) ;; |
---|
138 | *) echo "$i" >> files.gcc ;; |
---|
139 | esac |
---|
140 | done |
---|
141 | |
---|
142 | %clean |
---|
143 | # let rpm --clean remove BuildRoot iif using the default BuildRoot |
---|
144 | test "$RPM_BUILD_ROOT" = "/tmp/@target_alias@-gcc-newlib" && \ |
---|
145 | rm -rf $RPM_BUILD_ROOT |
---|
146 | |
---|