1 Name: cross-i386-binutils
2 ExclusiveArch: %{ix86} x86_64
9 BuildRequires: glibc-devel-static
12 BuildRequires: makeinfo ncurses-devel
13 BuildRequires: zlib-devel-static
14 Requires(pre): update-alternatives
19 %define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
20 # check the vanilla binutils, with no patches applied
22 %define test_vanilla %(test ! -f %_sourcedir/TEST_VANILLA ; echo $?)
24 # handle test suite failures
26 %ifarch alpha %arm aarch64 hppa mips sh4 %sparc
27 %define make_check_handling true
30 # XXX disabled because gold is seriously broken for now
31 %define make_check_handling true
33 # let make check fail anyway if RUN_TESTS was requested
35 %define make_check_handling false
37 # handle all binary object formats supported by SuSE (and a few more)
38 %ifarch %ix86 %arm aarch64 ia64 ppc ppc64 s390 s390x x86_64
39 %define build_multitarget 1
41 %define build_multitarget 0
43 %define target_list aarch64 alpha armv5l armv7l armv8l hppa hppa64 i686 ia64 m68k mips powerpc powerpc64 s390 s390x sh4 sparc sparc64 x86_64
47 Url: http://www.gnu.org/software/binutils/
48 #%define binutils_version %(echo %version | sed 's/\\.[0-9]\\{8\\}$//')
50 License: GFDL-1.3 and GPL-3.0+
51 Group: Development/Building
52 Source: binutils-%{version}.tar.bz2
53 Source1: pre_checkin.sh
54 Source3: baselibs.conf
57 C compiler utilities: ar, as, gprof, ld, nm, objcopy, objdump, ranlib,
58 size, strings, and strip. These utilities are needed whenever you want
59 to compile a program or kernel.
63 Summary: The gold linker
65 Group: Development/Building
66 Requires: %{name} = %{version}-%{release}
67 %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}
107 sed -i -e '/BFD_VERSION_DATE/s/$/-%(echo %release | sed 's/\.[0-9]*$//')/' bfd/version.h
109 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -DBFD_PLUGIN_LTO_NAME=liblto_plugin_%{_arch}.so"
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}" \
217 --prefix=%{_prefix} \
218 --with-bugurl=http://bugs.opensuse.org/ \
219 --with-pkgversion="GNU Binutils; %{DIST}" \
221 --build=%{HOST} --target=$TARGET_OS \
222 %if "%{TARGET}" == "spu"
223 --with-sysroot=/usr/spu \
225 --with-sysroot=%{_prefix}/$TARGET_OS/sys-root \
227 ${EXTRA_TARGETS:+--enable-targets="${EXTRA_TARGETS#,}"}
228 make %{?_smp_mflags} all-bfd TARGET-bfd=headers
229 # force reconfiguring
232 %if "%{TARGET}" == "avr"
233 # build an extra nesC version because nesC requires $'s in identifiers
235 echo '#include "tc-%{TARGET}-nesc.h"' > gas-nesc/targ-cpu.h
236 make -C gas-nesc clean
237 make -C gas-nesc %{?_smp_mflags}
245 make -k check CFLAGS="-O2 -g" CXXFLAGS="-O2 -g" || %{make_check_handling}
247 make -k check CFLAGS="$RPM_OPT_FLAGS -Wno-unused -Wno-unprototyped-calls" || :
253 # installing native binutils
255 make DESTDIR=$RPM_BUILD_ROOT install-gold
256 ln -sf ld.gold $RPM_BUILD_ROOT%{_bindir}/gold
259 make DESTDIR=$RPM_BUILD_ROOT install-info install
260 make -C gas/doc DESTDIR=$RPM_BUILD_ROOT install-info-am install-am
261 make DESTDIR=$RPM_BUILD_ROOT install-bfd install-opcodes
263 # We have gdb in separate package
264 rm -f %buildroot/%_bindir/gdb*
265 rm -f %buildroot/%_bindir/gcore*
267 if [ ! -f "%buildroot/%_bindir/ld.bfd" ]; then
268 mv "%buildroot/%_bindir"/{ld,ld.bfd};
270 rm -f "%buildroot/%_bindir/ld";
272 mkdir -p "%buildroot/%_sysconfdir/alternatives";
273 ln -s "%_bindir/ld" "%buildroot/%_sysconfdir/alternatives/ld";
274 ln -s "%_sysconfdir/alternatives/ld" "%buildroot/%_bindir/ld";
275 rm -rf $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
276 mkdir -p $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
277 ln -sf ../../bin/{ar,as,ld,nm,ranlib,strip} $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
279 ln -sf ../../bin/ld.gold $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
282 mv $RPM_BUILD_ROOT%{_prefix}/%{HOST}/lib/ldscripts $RPM_BUILD_ROOT%{_libdir}
283 ln -sf ../../%{_lib}/ldscripts $RPM_BUILD_ROOT%{_prefix}/%{HOST}/lib/ldscripts
285 # Install header files
286 make -C libiberty install_to_libdir target_header_dir=/usr/include DESTDIR=$RPM_BUILD_ROOT
287 # We want the PIC libiberty.a
288 install -m 644 libiberty/pic/libiberty.a $RPM_BUILD_ROOT%{_libdir}
290 chmod a+x $RPM_BUILD_ROOT%{_libdir}/libbfd-*
291 chmod a+x $RPM_BUILD_ROOT%{_libdir}/libopcodes-*
292 # No shared linking outside binutils
293 rm -f $RPM_BUILD_ROOT%{_libdir}/lib{bfd,opcodes,inproctrace}.so
294 rm -f $RPM_BUILD_ROOT%{_libdir}/lib{bfd,opcodes}.la
295 # Remove unwanted files to shut up rpm
296 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/dlltool.1 $RPM_BUILD_ROOT%{_mandir}/man1/windres.1 $RPM_BUILD_ROOT%{_mandir}/man1/windmc.1
299 #%find_lang bfd binutils.lang
300 #%find_lang gas binutils.lang
301 #%find_lang ld binutils.lang
302 #%find_lang opcodes binutils.lang
303 #%find_lang gprof binutils.lang
305 #%find_lang gold binutils-gold.lang
307 mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}
308 install -m 644 binutils/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-binutils
309 install -m 644 gas/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-gas
310 install -m 644 ld/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-ld
312 # installing cross-TARGET-binutils and TARGET-binutils
313 make DESTDIR=$RPM_BUILD_ROOT install
314 # Replace hard links by symlinks, so that rpmlint doesn't complain
315 T=$(basename %buildroot/usr/%{TARGET}*)
316 for f in %buildroot/usr/$T/bin/* ; do
317 ln -sf /usr/bin/$T-$(basename $f) $f
319 %if "%{TARGET}" == "avr"
320 install -c gas-nesc/as-new $RPM_BUILD_ROOT%{_prefix}/bin/%{TARGET}-nesc-as
321 ln -sf ../../bin/%{TARGET}-nesc-as $RPM_BUILD_ROOT%{_prefix}/%{TARGET}/bin/nesc-as
323 rm -rf $RPM_BUILD_ROOT%{_mandir}
324 rm -rf $RPM_BUILD_ROOT%{_infodir}
325 rm -rf $RPM_BUILD_ROOT%{_prefix}/lib*
326 rm -rf $RPM_BUILD_ROOT%{_prefix}/include
327 rm -f $RPM_BUILD_ROOT%{_prefix}/bin/*-c++filt
329 # We have gdb in separate package
330 rm -f $RPM_BUILD_ROOT%{_bindir}/gdb*
331 rm -f $RPM_BUILD_ROOT%{_bindir}/gcore*
332 rm -rf $RPM_BUILD_ROOT%{_datadir}/gdb
336 cd $RPM_BUILD_DIR/binutils-%version
342 "%_sbindir/update-alternatives" --install \
343 "%_bindir/ld" ld "%_bindir/ld.bfd" 1
346 "%_sbindir/update-alternatives" --install \
347 "%_bindir/ld" ld "%_bindir/ld.gold" 2
351 if [ "$1" = 0 ]; then
352 "%_sbindir/update-alternatives" --remove ld "%_bindir/ld.bfd";
356 if [ "$1" = 0 ]; then
357 "%_sbindir/update-alternatives" --remove ld "%_bindir/ld.gold";
363 %defattr(-,root,root)
366 %{_prefix}/%{HOST}/bin/*
367 %{_prefix}/%{HOST}/lib/ldscripts
368 %ghost %_sysconfdir/alternatives/ld
372 %exclude %{_bindir}/*gold
374 %doc %{_infodir}/*.gz
375 %{_libdir}/lib*-%{version}*.so
377 %{_prefix}/%{TARGET}*
383 %defattr(-,root,root)
386 %if "%{TARGET}" == "arm"
387 %{_prefix}/%{TARGET}-tizen-linux-gnueabi/bin/*gold
389 %{_prefix}/%{TARGET}-tizen-linux/bin/*gold
392 %{_prefix}/%{HOST}/bin/*gold
398 %defattr(-,root,root)
399 %{_prefix}/include/*.h
400 %{_prefix}/include/gdb/*.h