1 | # |
---|
2 | # Please send bugfixes or comments to |
---|
3 | # http://www.rtems.org/bugzilla |
---|
4 | # |
---|
5 | |
---|
6 | %define _prefix /opt/rtems-4.9 |
---|
7 | %define _infodir %{_prefix}/info |
---|
8 | %define _mandir %{_prefix}/man |
---|
9 | |
---|
10 | %ifos cygwin cygwin32 mingw mingw32 |
---|
11 | %define _exeext .exe |
---|
12 | %else |
---|
13 | %define _exeext %{nil} |
---|
14 | %endif |
---|
15 | |
---|
16 | %define binutils_pkgvers 2.18 |
---|
17 | %define binutils_version 2.18 |
---|
18 | %define binutils_rpmvers %{expand:%(echo "2.18" | tr - _ )} |
---|
19 | |
---|
20 | Name: rtems-4.9-powerpc-rtems4.9-binutils |
---|
21 | Summary: Binutils for target powerpc-rtems4.9 |
---|
22 | Group: Development/Tools |
---|
23 | Version: %{binutils_rpmvers} |
---|
24 | Release: 4%{?dist} |
---|
25 | License: GPL/LGPL |
---|
26 | URL: http://sources.redhat.com/binutils |
---|
27 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) |
---|
28 | |
---|
29 | %if "%{binutils_version}" >= "2.18" |
---|
30 | # Bug in bfd: Doesn't build without texinfo installed |
---|
31 | BuildRequires: texinfo >= 4.2 |
---|
32 | %else |
---|
33 | # Required for building the infos |
---|
34 | BuildRequires: /sbin/install-info |
---|
35 | BuildRequires: texinfo >= 4.2 |
---|
36 | %endif |
---|
37 | BuildRequires: flex |
---|
38 | BuildRequires: bison |
---|
39 | |
---|
40 | Requires: rtems-4.9-binutils-common |
---|
41 | |
---|
42 | Source0: ftp://ftp.gnu.org/pub/gnu/binutils/binutils-%{binutils_pkgvers}.tar.bz2 |
---|
43 | %{?_without_sources:NoSource: 0} |
---|
44 | %if "%{binutils_version}" == "2.18" |
---|
45 | Patch0: binutils-2.18-rtems4.9-20080211.diff |
---|
46 | %endif |
---|
47 | |
---|
48 | %description |
---|
49 | Cross binutils for target powerpc-rtems4.9 |
---|
50 | %prep |
---|
51 | %setup -q -c -T -n %{name}-%{version} |
---|
52 | |
---|
53 | %setup -q -D -T -n %{name}-%{version} -a0 |
---|
54 | cd binutils-%{binutils_pkgvers} |
---|
55 | %{?PATCH0:%patch0 -p1} |
---|
56 | cd .. |
---|
57 | |
---|
58 | %build |
---|
59 | %if "powerpc-rtems4.9" == "i686-pc-cygwin" |
---|
60 | # The cygwin sources are leaking memory |
---|
61 | RPM_OPT_FLAGS="$(echo "$RPM_OPT_FLAGS"|sed -e 's; -Wp,-D_FORTIFY_SOURCE=2;;')" |
---|
62 | %endif |
---|
63 | mkdir -p build |
---|
64 | cd build |
---|
65 | CFLAGS="$RPM_OPT_FLAGS" \ |
---|
66 | ../binutils-%{binutils_pkgvers}/configure \ |
---|
67 | --build=%_build --host=%_host \ |
---|
68 | --target=powerpc-rtems4.9 \ |
---|
69 | --verbose --disable-nls \ |
---|
70 | --without-included-gettext \ |
---|
71 | --disable-win32-registry \ |
---|
72 | --disable-werror \ |
---|
73 | --prefix=%{_prefix} --bindir=%{_bindir} \ |
---|
74 | --exec-prefix=%{_exec_prefix} \ |
---|
75 | --includedir=%{_includedir} --libdir=%{_libdir} \ |
---|
76 | --mandir=%{_mandir} --infodir=%{_infodir} |
---|
77 | |
---|
78 | make %{?_smp_mflags} all |
---|
79 | make info |
---|
80 | cd .. |
---|
81 | |
---|
82 | %install |
---|
83 | rm -rf $RPM_BUILD_ROOT |
---|
84 | |
---|
85 | cd build |
---|
86 | make DESTDIR=$RPM_BUILD_ROOT install |
---|
87 | |
---|
88 | make prefix=$RPM_BUILD_ROOT%{_prefix} \ |
---|
89 | bindir=$RPM_BUILD_ROOT%{_bindir} \ |
---|
90 | includedir=$RPM_BUILD_ROOT%{_includedir} \ |
---|
91 | libdir=$RPM_BUILD_ROOT%{_libdir} \ |
---|
92 | infodir=$RPM_BUILD_ROOT%{_infodir} \ |
---|
93 | mandir=$RPM_BUILD_ROOT%{_mandir} \ |
---|
94 | exec_prefix=$RPM_BUILD_ROOT%{_exec_prefix} \ |
---|
95 | install-info |
---|
96 | |
---|
97 | # Dropped in FSF-binutils-2.9.5, but Cygwin still ships it. |
---|
98 | rm -rf $RPM_BUILD_ROOT%{_infodir}/configure.info* |
---|
99 | |
---|
100 | rm -f $RPM_BUILD_ROOT%{_infodir}/dir |
---|
101 | touch $RPM_BUILD_ROOT%{_infodir}/dir |
---|
102 | |
---|
103 | # binutils does not install share/locale, however it uses it |
---|
104 | mkdir -p $RPM_BUILD_ROOT%{_prefix}/share/locale |
---|
105 | |
---|
106 | # We don't ship host files |
---|
107 | rm -f ${RPM_BUILD_ROOT}%{_libdir}/libiberty* |
---|
108 | |
---|
109 | # manpages without corresponding tools |
---|
110 | if test ! -f ${RPM_BUILD_ROOT}%{_bindir}/powerpc-rtems4.9-dlltool%{_exeext}; then |
---|
111 | rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/powerpc-rtems4.9-dlltool* |
---|
112 | fi |
---|
113 | if test ! -f ${RPM_BUILD_ROOT}%{_bindir}/powerpc-rtems4.9-nlmconv%{_exeext}; then |
---|
114 | rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/powerpc-rtems4.9-nlmconv* |
---|
115 | fi |
---|
116 | if test ! -f ${RPM_BUILD_ROOT}%{_bindir}/powerpc-rtems4.9-windres%{_exeext}; then |
---|
117 | rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/powerpc-rtems4.9-windres* |
---|
118 | fi |
---|
119 | |
---|
120 | cd .. |
---|
121 | |
---|
122 | # Extract %%__os_install_post into os_install_post~ |
---|
123 | cat << \EOF > os_install_post~ |
---|
124 | %__os_install_post |
---|
125 | EOF |
---|
126 | |
---|
127 | # Generate customized brp-*scripts |
---|
128 | cat os_install_post~ | while read a x y; do |
---|
129 | case $a in |
---|
130 | # Prevent brp-strip* from trying to handle foreign binaries |
---|
131 | */brp-strip*) |
---|
132 | b=$(basename $a) |
---|
133 | sed -e 's,find $RPM_BUILD_ROOT,find $RPM_BUILD_ROOT%_bindir $RPM_BUILD_ROOT%_libexecdir,' $a > $b |
---|
134 | chmod a+x $b |
---|
135 | ;; |
---|
136 | # Fix up brp-compress to handle %%_prefix != /usr |
---|
137 | */brp-compress*) |
---|
138 | b=$(basename $a) |
---|
139 | sed -e 's,\./usr/,.%{_prefix}/,g' < $a > $b |
---|
140 | chmod a+x $b |
---|
141 | ;; |
---|
142 | esac |
---|
143 | done |
---|
144 | |
---|
145 | sed -e 's,^[ ]*/usr/lib/rpm.*/brp-strip,./brp-strip,' \ |
---|
146 | -e 's,^[ ]*/usr/lib/rpm.*/brp-compress,./brp-compress,' \ |
---|
147 | < os_install_post~ > os_install_post |
---|
148 | %define __os_install_post . ./os_install_post |
---|
149 | |
---|
150 | %clean |
---|
151 | rm -rf $RPM_BUILD_ROOT |
---|
152 | |
---|
153 | # ============================================================== |
---|
154 | # powerpc-rtems4.9-binutils |
---|
155 | # ============================================================== |
---|
156 | # %package -n rtems-4.9-powerpc-rtems4.9-binutils |
---|
157 | # Summary: rtems binutils for powerpc-rtems4.9 |
---|
158 | # Group: Development/Tools |
---|
159 | # %if %build_infos |
---|
160 | # Requires: rtems-4.9-binutils-common |
---|
161 | # %endif |
---|
162 | |
---|
163 | %description -n rtems-4.9-powerpc-rtems4.9-binutils |
---|
164 | |
---|
165 | GNU binutils targetting powerpc-rtems4.9. |
---|
166 | |
---|
167 | %files -n rtems-4.9-powerpc-rtems4.9-binutils |
---|
168 | %defattr(-,root,root) |
---|
169 | %dir %{_mandir} |
---|
170 | %dir %{_mandir}/man1 |
---|
171 | %{_mandir}/man1/powerpc-rtems4.9-*.1* |
---|
172 | |
---|
173 | %dir %{_bindir} |
---|
174 | %{_bindir}/powerpc-rtems4.9-* |
---|
175 | |
---|
176 | %dir %{_exec_prefix}/powerpc-rtems4.9 |
---|
177 | %dir %{_exec_prefix}/powerpc-rtems4.9/bin |
---|
178 | %{_exec_prefix}/powerpc-rtems4.9/bin/* |
---|
179 | |
---|
180 | %dir %{_exec_prefix}/powerpc-rtems4.9/lib |
---|
181 | %{_exec_prefix}/powerpc-rtems4.9/lib/ldscripts |
---|
182 | # ============================================================== |
---|
183 | # rtems-4.9-binutils-common |
---|
184 | # ============================================================== |
---|
185 | %package -n rtems-4.9-binutils-common |
---|
186 | Summary: Base package for RTEMS binutils |
---|
187 | Group: Development/Tools |
---|
188 | Requires(post): /sbin/install-info |
---|
189 | Requires(preun): /sbin/install-info |
---|
190 | |
---|
191 | %description -n rtems-4.9-binutils-common |
---|
192 | |
---|
193 | RTEMS is an open source operating system for embedded systems. |
---|
194 | |
---|
195 | This is the base for binutils regardless of target CPU. |
---|
196 | |
---|
197 | %post -n rtems-4.9-binutils-common |
---|
198 | /sbin/install-info --info-dir=%{_infodir} %{_infodir}/as.info.gz || : |
---|
199 | /sbin/install-info --info-dir=%{_infodir} %{_infodir}/bfd.info.gz || : |
---|
200 | /sbin/install-info --info-dir=%{_infodir} %{_infodir}/binutils.info.gz || : |
---|
201 | /sbin/install-info --info-dir=%{_infodir} %{_infodir}/ld.info.gz || : |
---|
202 | /sbin/install-info --info-dir=%{_infodir} %{_infodir}/standards.info.gz || : |
---|
203 | %if "%{binutils_version}" > "2.17" |
---|
204 | /sbin/install-info --info-dir=%{_infodir} %{_infodir}/gprof.info.gz || : |
---|
205 | %endif |
---|
206 | |
---|
207 | %preun -n rtems-4.9-binutils-common |
---|
208 | if [ $1 -eq 0 ]; then |
---|
209 | /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/as.info.gz || : |
---|
210 | /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/bfd.info.gz || : |
---|
211 | /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/binutils.info.gz || : |
---|
212 | /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/ld.info.gz || : |
---|
213 | /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/standards.info.gz || : |
---|
214 | %if "%{binutils_version}" > "2.17" |
---|
215 | /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gprof.info.gz || : |
---|
216 | %endif |
---|
217 | fi |
---|
218 | |
---|
219 | %files -n rtems-4.9-binutils-common |
---|
220 | %defattr(-,root,root) |
---|
221 | %dir %{_infodir} |
---|
222 | %ghost %{_infodir}/dir |
---|
223 | %{_infodir}/as.info* |
---|
224 | %{_infodir}/bfd.info* |
---|
225 | %{_infodir}/binutils.info* |
---|
226 | %{_infodir}/ld.info* |
---|
227 | %{_infodir}/standards.info* |
---|
228 | %if "%{binutils_version}" > "2.17" |
---|
229 | %{_infodir}/gprof.info* |
---|
230 | %endif |
---|
231 | |
---|
232 | %dir %{_prefix}/share |
---|
233 | %dir %{_prefix}/share/locale |
---|
234 | |
---|