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