6 BuildRequires: glibc-devel-static
9 BuildRequires: makeinfo
10 BuildRequires: zlib-devel-static
11 Requires(pre): update-alternatives
16 %define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
17 # check the vanilla binutils, with no patches applied
19 %define test_vanilla %(test ! -f %_sourcedir/TEST_VANILLA ; echo $?)
21 # handle test suite failures
23 %ifarch alpha %arm aarch64 hppa mips sh4 %sparc
24 %define make_check_handling true
27 # XXX disabled because gold is seriously broken for now
28 %define make_check_handling true
30 # let make check fail anyway if RUN_TESTS was requested
32 %define make_check_handling false
34 # handle all binary object formats supported by SuSE (and a few more)
35 %ifarch %ix86 %arm aarch64 ia64 ppc ppc64 s390 s390x x86_64
36 %define build_multitarget 1
38 %define build_multitarget 0
40 %define target_list aarch64 alpha armv5l armv7l armv8l hppa hppa64 i686 ia64 m68k mips powerpc powerpc64 s390 s390x sh4 sparc sparc64 x86_64
44 Url: http://www.gnu.org/software/binutils/
45 #%define binutils_version %(echo %version | sed 's/\\.[0-9]\\{8\\}$//')
47 License: GFDL-1.3 and GPL-3.0+
48 Group: Development/Building
49 Source: binutils-%{version}.tar.bz2
50 Source1: pre_checkin.sh
51 Source3: baselibs.conf
52 Source1001: binutils.manifest
55 C compiler utilities: ar, as, gprof, ld, nm, objcopy, objdump, ranlib,
56 size, strings, and strip. These utilities are needed whenever you want
57 to compile a program or kernel.
61 Summary: The gold linker
63 Group: Development/Building
64 Requires: binutils = %{version}-%{release}
66 %define gold_archs %ix86 %arm aarch64 x86_64 ppc ppc64 %sparc
70 gold is an ELF linker. It is intended to have complete support for ELF
71 and to run as fast as possible on modern systems. For normal use it is
72 a drop-in replacement for the older GNU linker.
76 Summary: GNU binutils (BFD development files)
78 Group: Development/Building
79 Requires: binutils = %{version}-%{release}
81 Provides: binutils:/usr/include/bfd.h
84 This package includes header files and static libraries necessary to
85 build programs which use the GNU BFD library, which is part of
90 %define HOST %{_target_cpu}-tizen-linux-gnueabi
92 %define HOST %(echo %{_target_cpu} | sed -e "s/parisc/hppa/" -e "s/i.86/i586/" -e "s/ppc/powerpc/" -e "s/sparc64v.*/sparc64/" -e "s/sparcv.*/sparc/")-tizen-linux
94 %define DIST %(echo '%distribution' | sed 's/ (.*)//')
97 echo "make check will return with %{make_check_handling} in case of testsuite failures."
98 %setup -q -n binutils-%{version}
108 sed -i -e '/BFD_VERSION_DATE/s/$/-%(echo %release | sed 's/\.[0-9]*$//')/' bfd/version.h
110 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Wno-error"
111 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS |sed -e 's/atom/i686/g'`
113 # Building native binutils
114 echo "Building native binutils."
115 %if %build_multitarget
116 EXTRA_TARGETS="%(printf ,%%s-tizen-linux %target_list)"
117 EXTRA_TARGETS="$EXTRA_TARGETS,powerpc-macos,powerpc-macos10,spu-elf,x86_64-pep"
121 EXTRA_TARGETS="$EXTRA_TARGETS,sparc64-tizen-linux"
124 EXTRA_TARGETS="$EXTRA_TARGETS,powerpc64-tizen-linux"
127 EXTRA_TARGETS="$EXTRA_TARGETS,s390x-tizen-linux"
130 EXTRA_TARGETS="$EXTRA_TARGETS,s390-tizen-linux"
133 EXTRA_TARGETS="$EXTRA_TARGETS,x86_64-tizen-linux"
136 EXTRA_TARGETS="$EXTRA_TARGETS,spu-elf"
139 EXTRA_TARGETS="$EXTRA_TARGETS,arm-tizen-linux-gnueabi"
142 EXTRA_TARGETS="$EXTRA_TARGETS,aarch64-tizen-linux"
145 %define common_flags CFLAGS="${RPM_OPT_FLAGS}" CXXFLAGS="${RPM_OPT_FLAGS}" \\\
146 --prefix=%{_prefix} --libdir=%{_libdir} \\\
147 --infodir=%{_infodir} --mandir=%{_mandir} \\\
148 --with-bugurl=http://bugs.opensuse.org/ \\\
149 --with-pkgversion="GNU Binutils; %{DIST}" \\\
151 --with-separate-debug-dir=%{_prefix}/lib/debug \\\
152 --with-pic --build=%{HOST}
157 export CONFIG_SHELL="/bin/bash"
158 export SHELL="/bin/bash"
161 ../configure %common_flags \
162 ${EXTRA_TARGETS:+--enable-targets="${EXTRA_TARGETS#,}"} \
168 make %{?_smp_mflags} all-bfd TARGET-bfd=headers
169 # force reconfiguring (???)
174 # building cross-TARGET-binutils
175 echo "Building cross binutils."
179 %if "%{TARGET}" == "sparc"
180 EXTRA_TARGETS="$EXTRA_TARGETS,sparc64-tizen-linux"
182 %if "%{TARGET}" == "powerpc"
183 EXTRA_TARGETS="$EXTRA_TARGETS,powerpc64-tizen-linux"
185 %if "%{TARGET}" == "s390"
186 EXTRA_TARGETS="$EXTRA_TARGETS,s390x-tizen-linux"
188 %if "%{TARGET}" == "s390x"
189 EXTRA_TARGETS="$EXTRA_TARGETS,s390-tizen-linux"
191 %if "%{TARGET}" == "i586"
192 EXTRA_TARGETS="$EXTRA_TARGETS,x86_64-tizen-linux"
194 %if "%{TARGET}" == "hppa"
195 EXTRA_TARGETS="$EXTRA_TARGETS,hppa64-tizen-linux"
197 %if "%{TARGET}" == "arm"
198 EXTRA_TARGETS="$EXTRA_TARGETS,arm-tizen-linux-gnueabi"
200 %if "%{TARGET}" == "aarch64"
201 EXTRA_TARGETS="$EXTRA_TARGETS,aarch64-tizen-linux"
203 %if "%{TARGET}" == "avr" || "%{TARGET}" == "spu"
206 %if "%{TARGET}" == "arm"
207 TARGET_OS=%{TARGET}-tizen-linux-gnueabi
209 TARGET_OS=%{TARGET}-tizen-linux
212 ../configure CFLAGS="${RPM_OPT_FLAGS}" \
213 --prefix=%{_prefix} \
214 --with-bugurl=http://bugs.opensuse.org/ \
215 --with-pkgversion="GNU Binutils; %{DIST}" \
217 --build=%{HOST} --target=$TARGET_OS \
218 %if "%{TARGET}" == "spu"
219 --with-sysroot=/usr/spu \
221 --with-sysroot=%{_prefix}/$TARGET_OS/sys-root \
223 ${EXTRA_TARGETS:+--enable-targets="${EXTRA_TARGETS#,}"}
224 make %{?_smp_mflags} all-bfd TARGET-bfd=headers
225 # force reconfiguring
228 %if "%{TARGET}" == "avr"
229 # build an extra nesC version because nesC requires $'s in identifiers
231 echo '#include "tc-%{TARGET}-nesc.h"' > gas-nesc/targ-cpu.h
232 make -C gas-nesc clean
233 make -C gas-nesc %{?_smp_mflags}
241 make -k check CFLAGS="-O2 -g" CXXFLAGS="-O2 -g" || %{make_check_handling}
243 make -k check CFLAGS="$RPM_OPT_FLAGS -Wno-unused -Wno-unprototyped-calls" || :
249 # installing native binutils
251 make DESTDIR=$RPM_BUILD_ROOT install-gold
252 ln -sf ld.gold $RPM_BUILD_ROOT%{_bindir}/gold
254 make DESTDIR=$RPM_BUILD_ROOT install-info install
255 make -C gas/doc DESTDIR=$RPM_BUILD_ROOT install-info-am install-am
256 make DESTDIR=$RPM_BUILD_ROOT install-bfd install-opcodes
258 if [ ! -f "%buildroot/%_bindir/ld.bfd" ]; then
259 mv "%buildroot/%_bindir"/{ld,ld.bfd};
261 rm -f "%buildroot/%_bindir/ld";
263 mkdir -p "%buildroot/%_sysconfdir/alternatives";
264 ln -s "%_bindir/ld" "%buildroot/%_sysconfdir/alternatives/ld";
265 ln -s "%_sysconfdir/alternatives/ld" "%buildroot/%_bindir/ld";
266 rm -rf $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
267 mkdir -p $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
268 ln -sf ../../bin/{ar,as,ld,nm,ranlib,strip} $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
270 mv $RPM_BUILD_ROOT%{_prefix}/%{HOST}/lib/ldscripts $RPM_BUILD_ROOT%{_libdir}
271 ln -sf ../../%{_lib}/ldscripts $RPM_BUILD_ROOT%{_prefix}/%{HOST}/lib/ldscripts
273 # Install header files
274 make -C libiberty install_to_libdir target_header_dir=/usr/include DESTDIR=$RPM_BUILD_ROOT
275 # We want the PIC libiberty.a
276 install -m 644 libiberty/pic/libiberty.a $RPM_BUILD_ROOT%{_libdir}
278 chmod a+x $RPM_BUILD_ROOT%{_libdir}/libbfd-*
279 chmod a+x $RPM_BUILD_ROOT%{_libdir}/libopcodes-*
280 # No shared linking outside binutils
281 rm $RPM_BUILD_ROOT%{_libdir}/lib{bfd,opcodes}.so
282 rm $RPM_BUILD_ROOT%{_libdir}/lib{bfd,opcodes}.la
283 # Remove unwanted files to shut up rpm
284 rm $RPM_BUILD_ROOT%{_mandir}/man1/dlltool.1 $RPM_BUILD_ROOT%{_mandir}/man1/windres.1 $RPM_BUILD_ROOT%{_mandir}/man1/windmc.1
287 #%find_lang bfd binutils.lang
288 #%find_lang gas binutils.lang
289 #%find_lang ld binutils.lang
290 #%find_lang opcodes binutils.lang
291 #%find_lang gprof binutils.lang
293 #%find_lang gold binutils-gold.lang
295 mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}
296 install -m 644 binutils/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-binutils
297 install -m 644 gas/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-gas
298 install -m 644 ld/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-ld
300 # installing cross-TARGET-binutils and TARGET-binutils
301 make DESTDIR=$RPM_BUILD_ROOT install
302 # Replace hard links by symlinks, so that rpmlint doesn't complain
303 T=$(basename %buildroot/usr/%{TARGET}*)
304 for f in %buildroot/usr/$T/bin/* ; do
305 ln -sf /usr/bin/$T-$(basename $f) $f
307 %if "%{TARGET}" == "avr"
308 install -c gas-nesc/as-new $RPM_BUILD_ROOT%{_prefix}/bin/%{TARGET}-nesc-as
309 ln -sf ../../bin/%{TARGET}-nesc-as $RPM_BUILD_ROOT%{_prefix}/%{TARGET}/bin/nesc-as
311 rm -rf $RPM_BUILD_ROOT%{_mandir}
312 rm -rf $RPM_BUILD_ROOT%{_infodir}
313 rm -rf $RPM_BUILD_ROOT%{_prefix}/lib*
314 rm -rf $RPM_BUILD_ROOT%{_prefix}/include
315 rm -f $RPM_BUILD_ROOT%{_prefix}/bin/*-c++filt
318 cd $RPM_BUILD_DIR/binutils-%version
324 "%_sbindir/update-alternatives" --install \
325 "%_bindir/ld" ld "%_bindir/ld.bfd" 1
328 "%_sbindir/update-alternatives" --install \
329 "%_bindir/ld" ld "%_bindir/ld.gold" 2
333 if [ "$1" = 0 ]; then
334 "%_sbindir/update-alternatives" --remove ld "%_bindir/ld.bfd";
338 if [ "$1" = 0 ]; then
339 "%_sbindir/update-alternatives" --remove ld "%_bindir/ld.gold";
345 %manifest %{name}.manifest
346 %defattr(-,root,root)
349 %{_prefix}/%{HOST}/bin/*
350 %{_prefix}/%{HOST}/lib/ldscripts
351 %ghost %_sysconfdir/alternatives/ld
355 %exclude %{_bindir}/gold
356 %exclude %{_bindir}/ld.gold
358 %doc %{_infodir}/*.gz
359 %{_libdir}/lib*-%{version}*.so
361 %{_prefix}/%{TARGET}*
367 %manifest %{name}.manifest
368 %defattr(-,root,root)
375 %manifest %{name}.manifest
376 %defattr(-,root,root)
377 %{_prefix}/include/*.h