1 Name: cross-arm-binutils
9 BuildRequires: glibc-devel-static
12 BuildRequires: makeinfo
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: binutils = %{version}-%{release}
68 %define gold_archs %ix86 %arm aarch64 x86_64 ppc ppc64 %sparc
72 gold is an ELF linker. It is intended to have complete support for ELF
73 and to run as fast as possible on modern systems. For normal use it is
74 a drop-in replacement for the older GNU linker.
78 Summary: GNU binutils (BFD development files)
80 Group: Development/Building
81 Requires: binutils = %{version}-%{release}
83 Provides: binutils:/usr/include/bfd.h
86 This package includes header files and static libraries necessary to
87 build programs which use the GNU BFD library, which is part of
92 %define HOST %{_target_cpu}-tizen-linux-gnueabi
94 %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
96 %define DIST %(echo '%distribution' | sed 's/ (.*)//')
99 echo "make check will return with %{make_check_handling} in case of testsuite failures."
100 %setup -q -n binutils-%{version}
109 sed -i -e '/BFD_VERSION_DATE/s/$/-%(echo %release | sed 's/\.[0-9]*$//')/' bfd/version.h
111 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Wno-error"
112 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS |sed -e 's/atom/i686/g'`
114 # Building native binutils
115 echo "Building native binutils."
116 %if %build_multitarget
117 EXTRA_TARGETS="%(printf ,%%s-tizen-linux %target_list)"
118 EXTRA_TARGETS="$EXTRA_TARGETS,powerpc-macos,powerpc-macos10,spu-elf,x86_64-pep"
122 EXTRA_TARGETS="$EXTRA_TARGETS,sparc64-tizen-linux"
125 EXTRA_TARGETS="$EXTRA_TARGETS,powerpc64-tizen-linux"
128 EXTRA_TARGETS="$EXTRA_TARGETS,s390x-tizen-linux"
131 EXTRA_TARGETS="$EXTRA_TARGETS,s390-tizen-linux"
134 EXTRA_TARGETS="$EXTRA_TARGETS,x86_64-tizen-linux"
137 EXTRA_TARGETS="$EXTRA_TARGETS,spu-elf"
140 EXTRA_TARGETS="$EXTRA_TARGETS,arm-tizen-linux-gnueabi"
143 EXTRA_TARGETS="$EXTRA_TARGETS,aarch64-tizen-linux"
146 %define common_flags CFLAGS="${RPM_OPT_FLAGS}" CXXFLAGS="${RPM_OPT_FLAGS}" \\\
147 --prefix=%{_prefix} --libdir=%{_libdir} \\\
148 --infodir=%{_infodir} --mandir=%{_mandir} \\\
149 --with-bugurl=http://bugs.opensuse.org/ \\\
150 --with-pkgversion="GNU Binutils; %{DIST}" \\\
152 --with-separate-debug-dir=%{_prefix}/lib/debug \\\
153 --with-pic --build=%{HOST}
158 export CONFIG_SHELL="/bin/bash"
159 export SHELL="/bin/bash"
162 ../configure %common_flags \
163 ${EXTRA_TARGETS:+--enable-targets="${EXTRA_TARGETS#,}"} \
169 make %{?_smp_mflags} all-bfd TARGET-bfd=headers
170 # force reconfiguring (???)
175 # building cross-TARGET-binutils
176 echo "Building cross binutils."
180 %if "%{TARGET}" == "sparc"
181 EXTRA_TARGETS="$EXTRA_TARGETS,sparc64-tizen-linux"
183 %if "%{TARGET}" == "powerpc"
184 EXTRA_TARGETS="$EXTRA_TARGETS,powerpc64-tizen-linux"
186 %if "%{TARGET}" == "s390"
187 EXTRA_TARGETS="$EXTRA_TARGETS,s390x-tizen-linux"
189 %if "%{TARGET}" == "s390x"
190 EXTRA_TARGETS="$EXTRA_TARGETS,s390-tizen-linux"
192 %if "%{TARGET}" == "i586"
193 EXTRA_TARGETS="$EXTRA_TARGETS,x86_64-tizen-linux"
195 %if "%{TARGET}" == "hppa"
196 EXTRA_TARGETS="$EXTRA_TARGETS,hppa64-tizen-linux"
198 %if "%{TARGET}" == "arm"
199 EXTRA_TARGETS="$EXTRA_TARGETS,arm-tizen-linux-gnueabi"
201 %if "%{TARGET}" == "aarch64"
202 EXTRA_TARGETS="$EXTRA_TARGETS,aarch64-tizen-linux"
204 %if "%{TARGET}" == "avr" || "%{TARGET}" == "spu"
207 %if "%{TARGET}" == "arm"
208 TARGET_OS=%{TARGET}-tizen-linux-gnueabi
210 TARGET_OS=%{TARGET}-tizen-linux
213 ../configure CFLAGS="${RPM_OPT_FLAGS}" \
214 --prefix=%{_prefix} \
215 --with-bugurl=http://bugs.opensuse.org/ \
216 --with-pkgversion="GNU Binutils; %{DIST}" \
218 --build=%{HOST} --target=$TARGET_OS \
219 %if "%{TARGET}" == "spu"
220 --with-sysroot=/usr/spu \
222 --with-sysroot=%{_prefix}/$TARGET_OS/sys-root \
224 ${EXTRA_TARGETS:+--enable-targets="${EXTRA_TARGETS#,}"}
225 make %{?_smp_mflags} all-bfd TARGET-bfd=headers
226 # force reconfiguring
229 %if "%{TARGET}" == "avr"
230 # build an extra nesC version because nesC requires $'s in identifiers
232 echo '#include "tc-%{TARGET}-nesc.h"' > gas-nesc/targ-cpu.h
233 make -C gas-nesc clean
234 make -C gas-nesc %{?_smp_mflags}
242 make -k check CFLAGS="-O2 -g" CXXFLAGS="-O2 -g" || %{make_check_handling}
244 make -k check CFLAGS="$RPM_OPT_FLAGS -Wno-unused -Wno-unprototyped-calls" || :
250 # installing native binutils
252 make DESTDIR=$RPM_BUILD_ROOT install-gold
253 ln -sf ld.gold $RPM_BUILD_ROOT%{_bindir}/gold
255 make DESTDIR=$RPM_BUILD_ROOT install-info install
256 make -C gas/doc DESTDIR=$RPM_BUILD_ROOT install-info-am install-am
257 make DESTDIR=$RPM_BUILD_ROOT install-bfd install-opcodes
259 if [ ! -f "%buildroot/%_bindir/ld.bfd" ]; then
260 mv "%buildroot/%_bindir"/{ld,ld.bfd};
262 rm -f "%buildroot/%_bindir/ld";
264 mkdir -p "%buildroot/%_sysconfdir/alternatives";
265 ln -s "%_bindir/ld" "%buildroot/%_sysconfdir/alternatives/ld";
266 ln -s "%_sysconfdir/alternatives/ld" "%buildroot/%_bindir/ld";
267 rm -rf $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
268 mkdir -p $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
269 ln -sf ../../bin/{ar,as,ld,nm,ranlib,strip} $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
271 mv $RPM_BUILD_ROOT%{_prefix}/%{HOST}/lib/ldscripts $RPM_BUILD_ROOT%{_libdir}
272 ln -sf ../../%{_lib}/ldscripts $RPM_BUILD_ROOT%{_prefix}/%{HOST}/lib/ldscripts
274 # Install header files
275 make -C libiberty install_to_libdir target_header_dir=/usr/include DESTDIR=$RPM_BUILD_ROOT
276 # We want the PIC libiberty.a
277 install -m 644 libiberty/pic/libiberty.a $RPM_BUILD_ROOT%{_libdir}
279 chmod a+x $RPM_BUILD_ROOT%{_libdir}/libbfd-*
280 chmod a+x $RPM_BUILD_ROOT%{_libdir}/libopcodes-*
281 # No shared linking outside binutils
282 rm $RPM_BUILD_ROOT%{_libdir}/lib{bfd,opcodes}.so
283 rm $RPM_BUILD_ROOT%{_libdir}/lib{bfd,opcodes}.la
284 # Remove unwanted files to shut up rpm
285 rm $RPM_BUILD_ROOT%{_mandir}/man1/dlltool.1 $RPM_BUILD_ROOT%{_mandir}/man1/windres.1 $RPM_BUILD_ROOT%{_mandir}/man1/windmc.1
288 #%find_lang bfd binutils.lang
289 #%find_lang gas binutils.lang
290 #%find_lang ld binutils.lang
291 #%find_lang opcodes binutils.lang
292 #%find_lang gprof binutils.lang
294 #%find_lang gold binutils-gold.lang
296 mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}
297 install -m 644 binutils/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-binutils
298 install -m 644 gas/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-gas
299 install -m 644 ld/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-ld
301 # installing cross-TARGET-binutils and TARGET-binutils
302 make DESTDIR=$RPM_BUILD_ROOT install
303 # Replace hard links by symlinks, so that rpmlint doesn't complain
304 T=$(basename %buildroot/usr/%{TARGET}*)
305 for f in %buildroot/usr/$T/bin/* ; do
306 ln -sf /usr/bin/$T-$(basename $f) $f
308 %if "%{TARGET}" == "avr"
309 install -c gas-nesc/as-new $RPM_BUILD_ROOT%{_prefix}/bin/%{TARGET}-nesc-as
310 ln -sf ../../bin/%{TARGET}-nesc-as $RPM_BUILD_ROOT%{_prefix}/%{TARGET}/bin/nesc-as
312 rm -rf $RPM_BUILD_ROOT%{_mandir}
313 rm -rf $RPM_BUILD_ROOT%{_infodir}
314 rm -rf $RPM_BUILD_ROOT%{_prefix}/lib*
315 rm -rf $RPM_BUILD_ROOT%{_prefix}/include
316 rm -f $RPM_BUILD_ROOT%{_prefix}/bin/*-c++filt
319 cd $RPM_BUILD_DIR/binutils-%version
325 "%_sbindir/update-alternatives" --install \
326 "%_bindir/ld" ld "%_bindir/ld.bfd" 1
329 "%_sbindir/update-alternatives" --install \
330 "%_bindir/ld" ld "%_bindir/ld.gold" 2
334 if [ "$1" = 0 ]; then
335 "%_sbindir/update-alternatives" --remove ld "%_bindir/ld.bfd";
339 if [ "$1" = 0 ]; then
340 "%_sbindir/update-alternatives" --remove ld "%_bindir/ld.gold";
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 %defattr(-,root,root)
374 %defattr(-,root,root)
375 %{_prefix}/include/*.h