1 |
1026 |
ivang |
#
|
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.bz2
|
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 -T -n %{name} -a0 -a1
|
64 |
|
|
|
65 |
|
|
@PATCH2@
|
66 |
|
|
@PATCH4@
|
67 |
|
|
|
68 |
|
|
# Fix timestamps
|
69 |
|
|
cd gcc-@gcc_version@
|
70 |
|
|
contrib/gcc_update --touch
|
71 |
|
|
cd ..
|
72 |
|
|
|
73 |
|
|
# Copy the C library into gcc's source tree
|
74 |
|
|
ln -s ../newlib-@newlib_version@/newlib gcc-@gcc_version@
|
75 |
|
|
test -d build || mkdir build
|
76 |
|
|
|
77 |
|
|
%build
|
78 |
|
|
cd build
|
79 |
|
|
|
80 |
|
|
# HACK: This should be %{target} != %{build}, but SuSE's rpm screws it.
|
81 |
|
|
# %if "%{_target_os}" != "%{_build_os}"
|
82 |
|
|
# CONFIGURE_ARGS="--build=%{_build} --host=%{_target}"
|
83 |
|
|
# %endif
|
84 |
|
|
|
85 |
|
|
../gcc-@gcc_version@/configure $CONFIGURE_ARGS --target=@target_alias@ \
|
86 |
|
|
--with-gnu-as --with-gnu-ld --with-newlib --verbose \
|
87 |
|
|
--with-system-zlib --disable-nls \
|
88 |
|
|
--enable-version-specific-runtime-libs \
|
89 |
|
|
--enable-threads=rtems --prefix=%{_prefix} @GCCLANGS@
|
90 |
|
|
make all
|
91 |
|
|
make info
|
92 |
|
|
|
93 |
|
|
%install
|
94 |
|
|
cd build
|
95 |
|
|
# # Bug in gcc-2.95.1: It doesn't build this installation directory
|
96 |
|
|
# # If it doesn't find it, gcc doesn't install @target_alias@/bin/gcc
|
97 |
|
|
# ../gcc-@gcc_version@/mkinstalldirs \
|
98 |
|
|
# $RPM_BUILD_ROOT%{_prefix}/@target_alias@/bin
|
99 |
|
|
#
|
100 |
|
|
|
101 |
|
|
make prefix=$RPM_BUILD_ROOT%{_prefix} install
|
102 |
|
|
cd @target_alias@/newlib
|
103 |
|
|
make prefix=$RPM_BUILD_ROOT%{_prefix} install-info
|
104 |
|
|
# cd back to build/
|
105 |
|
|
cd ../..
|
106 |
|
|
|
107 |
|
|
# Bug in gcc-3.0.x: It puts the build dirs into *.la files
|
108 |
|
|
files=`find ${RPM_BUILD_ROOT}%{_prefix}/@target_alias@/lib -name '*.la'`
|
109 |
|
|
test -n "$files" && for i in $files; do
|
110 |
|
|
rm -f $i
|
111 |
|
|
done
|
112 |
|
|
|
113 |
|
|
# Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
|
114 |
|
|
# Rename it to target_alias-cpp
|
115 |
|
|
# if test -f $RPM_BUILD_ROOT%{_prefix}/bin/cpp@exe_ext@;
|
116 |
|
|
# then
|
117 |
|
|
# mv $RPM_BUILD_ROOT%{_prefix}/bin/cpp@exe_ext@ \
|
118 |
|
|
# $RPM_BUILD_ROOT%{_prefix}/bin/@target_alias@-cpp@exe_ext@
|
119 |
|
|
# fi
|
120 |
|
|
|
121 |
|
|
# gzip info files
|
122 |
|
|
gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info 2>/dev/null
|
123 |
|
|
gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-? 2>/dev/null
|
124 |
|
|
gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-?? 2>/dev/null
|
125 |
|
|
|
126 |
|
|
rm -f dirs ;
|
127 |
|
|
echo "%dir %{_prefix}/lib" >> dirs ;
|
128 |
|
|
echo "%dir %{_prefix}/lib/gcc-lib" >> dirs ;
|
129 |
|
|
echo "%dir %{_prefix}/lib/gcc-lib/@target_alias@" >> dirs ;
|
130 |
|
|
|
131 |
|
|
# Collect multilib subdirectories
|
132 |
|
|
f=`gcc/xgcc -Bgcc/ --print-multi-lib | sed -e 's,;.*$,,'`
|
133 |
|
|
|
134 |
|
|
TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@"
|
135 |
|
|
for i in $f; do
|
136 |
|
|
case $i in
|
137 |
|
|
\.) echo "%dir ${TGTDIR}" >> dirs
|
138 |
|
|
;;
|
139 |
|
|
*) echo "%dir ${TGTDIR}/$i" >> dirs
|
140 |
|
|
;;
|
141 |
|
|
esac
|
142 |
|
|
done
|
143 |
|
|
|
144 |
|
|
TGTDIR="%{_prefix}/@target_alias@/lib"
|
145 |
|
|
for i in $f; do
|
146 |
|
|
case $i in
|
147 |
|
|
\.) echo "%dir ${TGTDIR}" >> dirs
|
148 |
|
|
;;
|
149 |
|
|
*) echo "%dir ${TGTDIR}/$i" >> dirs
|
150 |
|
|
;;
|
151 |
|
|
esac
|
152 |
|
|
done
|
153 |
|
|
|
154 |
|
|
# Collect files to go into different packages
|
155 |
|
|
cp dirs files.gcc
|
156 |
|
|
cp dirs files.g77
|
157 |
|
|
cp dirs files.objc
|
158 |
|
|
cp dirs files.gcj
|
159 |
|
|
cp dirs files.g++
|
160 |
|
|
|
161 |
|
|
TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@"
|
162 |
|
|
f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
|
163 |
|
|
for i in $f; do
|
164 |
|
|
case $i in
|
165 |
|
|
*lib*.la);; # ignore: gcc produces bogus libtool libs
|
166 |
|
|
*f771) ;;
|
167 |
|
|
*cc1obj) ;;
|
168 |
|
|
*libobjc*) echo "$i" >> files.objc ;;
|
169 |
|
|
*include/objc*) ;;
|
170 |
|
|
*include/g++*);;
|
171 |
|
|
*jc1) ;;
|
172 |
|
|
*jvgenmain) ;;
|
173 |
|
|
*libstdc++.a) echo "$i" >> files.g++ ;;
|
174 |
|
|
*libsupc++.a) echo "$i" >> files.g++ ;;
|
175 |
|
|
*) echo "$i" >> files.gcc ;;
|
176 |
|
|
esac
|
177 |
|
|
done
|
178 |
|
|
|
179 |
|
|
TGTDIR="%{_prefix}/@target_alias@/lib"
|
180 |
|
|
f=`find ${RPM_BUILD_ROOT}${TGTDIR} ! -type d -print | sed -e "s,^$RPM_BUILD_ROOT,,g"`;
|
181 |
|
|
for i in $f; do
|
182 |
|
|
case $i in
|
183 |
|
|
*lib*.la);; # ignore - gcc produces bogus libtool libs
|
184 |
|
|
*libiberty.a) ;; # ignore - GPL'ed
|
185 |
|
|
# all other files belong to gcc
|
186 |
|
|
*) echo "$i" >> files.gcc ;;
|
187 |
|
|
esac
|
188 |
|
|
done
|
189 |
|
|
|
190 |
|
|
%clean
|
191 |
|
|
# let rpm --clean remove BuildRoot iif using the default BuildRoot
|
192 |
|
|
test "$RPM_BUILD_ROOT" = "%{_tmppath}/%{name}" && \
|
193 |
|
|
rm -rf $RPM_BUILD_ROOT
|