1 Name: cross-arm-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 -Wno-error"
110 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS |sed -e 's/atom/i686/g'`
112 # Building native binutils
113 echo "Building native binutils."
114 %if %build_multitarget
115 EXTRA_TARGETS="%(printf ,%%s-tizen-linux %target_list)"
116 EXTRA_TARGETS="$EXTRA_TARGETS,powerpc-macos,powerpc-macos10,spu-elf,x86_64-pep"
120 EXTRA_TARGETS="$EXTRA_TARGETS,sparc64-tizen-linux"
123 EXTRA_TARGETS="$EXTRA_TARGETS,powerpc64-tizen-linux"
126 EXTRA_TARGETS="$EXTRA_TARGETS,s390x-tizen-linux"
129 EXTRA_TARGETS="$EXTRA_TARGETS,s390-tizen-linux"
132 EXTRA_TARGETS="$EXTRA_TARGETS,x86_64-tizen-linux"
135 EXTRA_TARGETS="$EXTRA_TARGETS,spu-elf"
138 EXTRA_TARGETS="$EXTRA_TARGETS,arm-tizen-linux-gnueabi"
141 EXTRA_TARGETS="$EXTRA_TARGETS,aarch64-tizen-linux"
144 %define common_flags CFLAGS="${RPM_OPT_FLAGS}" CXXFLAGS="${RPM_OPT_FLAGS}" \\\
145 --prefix=%{_prefix} --libdir=%{_libdir} \\\
146 --infodir=%{_infodir} --mandir=%{_mandir} \\\
147 --with-bugurl=http://bugs.opensuse.org/ \\\
148 --with-pkgversion="GNU Binutils; %{DIST}" \\\
150 --with-separate-debug-dir=%{_prefix}/lib/debug \\\
151 --with-pic --build=%{HOST}
156 export CONFIG_SHELL="/bin/bash"
157 export SHELL="/bin/bash"
160 ../configure %common_flags \
161 ${EXTRA_TARGETS:+--enable-targets="${EXTRA_TARGETS#,}"} \
167 make %{?_smp_mflags} all-bfd TARGET-bfd=headers
168 # force reconfiguring (???)
173 # building cross-TARGET-binutils
174 echo "Building cross binutils."
178 %if "%{TARGET}" == "sparc"
179 EXTRA_TARGETS="$EXTRA_TARGETS,sparc64-tizen-linux"
181 %if "%{TARGET}" == "powerpc"
182 EXTRA_TARGETS="$EXTRA_TARGETS,powerpc64-tizen-linux"
184 %if "%{TARGET}" == "s390"
185 EXTRA_TARGETS="$EXTRA_TARGETS,s390x-tizen-linux"
187 %if "%{TARGET}" == "s390x"
188 EXTRA_TARGETS="$EXTRA_TARGETS,s390-tizen-linux"
190 %if "%{TARGET}" == "i586"
191 EXTRA_TARGETS="$EXTRA_TARGETS,x86_64-tizen-linux"
193 %if "%{TARGET}" == "hppa"
194 EXTRA_TARGETS="$EXTRA_TARGETS,hppa64-tizen-linux"
196 %if "%{TARGET}" == "arm"
197 EXTRA_TARGETS="$EXTRA_TARGETS,arm-tizen-linux-gnueabi"
199 %if "%{TARGET}" == "aarch64"
200 EXTRA_TARGETS="$EXTRA_TARGETS,aarch64-tizen-linux"
202 %if "%{TARGET}" == "avr" || "%{TARGET}" == "spu"
205 %if "%{TARGET}" == "arm"
206 TARGET_OS=%{TARGET}-tizen-linux-gnueabi
208 TARGET_OS=%{TARGET}-tizen-linux
211 ../configure CFLAGS="${RPM_OPT_FLAGS}" \
216 --prefix=%{_prefix} \
217 --with-bugurl=http://bugs.opensuse.org/ \
218 --with-pkgversion="GNU Binutils; %{DIST}" \
220 --build=%{HOST} --target=$TARGET_OS \
221 %if "%{TARGET}" == "spu"
222 --with-sysroot=/usr/spu \
224 --with-sysroot=%{_prefix}/$TARGET_OS/sys-root \
226 ${EXTRA_TARGETS:+--enable-targets="${EXTRA_TARGETS#,}"}
227 make %{?_smp_mflags} all-bfd TARGET-bfd=headers
228 # force reconfiguring
231 %if "%{TARGET}" == "avr"
232 # build an extra nesC version because nesC requires $'s in identifiers
234 echo '#include "tc-%{TARGET}-nesc.h"' > gas-nesc/targ-cpu.h
235 make -C gas-nesc clean
236 make -C gas-nesc %{?_smp_mflags}
244 make -k check CFLAGS="-O2 -g" CXXFLAGS="-O2 -g" || %{make_check_handling}
246 make -k check CFLAGS="$RPM_OPT_FLAGS -Wno-unused -Wno-unprototyped-calls" || :
252 # installing native binutils
254 make DESTDIR=$RPM_BUILD_ROOT install-gold
255 ln -sf ld.gold $RPM_BUILD_ROOT%{_bindir}/gold
258 make DESTDIR=$RPM_BUILD_ROOT install-info install
259 make -C gas/doc DESTDIR=$RPM_BUILD_ROOT install-info-am install-am
260 make DESTDIR=$RPM_BUILD_ROOT install-bfd install-opcodes
262 # We have gdb in separate package
263 rm -f %buildroot/%_bindir/gdb*
265 if [ ! -f "%buildroot/%_bindir/ld.bfd" ]; then
266 mv "%buildroot/%_bindir"/{ld,ld.bfd};
268 rm -f "%buildroot/%_bindir/ld";
270 mkdir -p "%buildroot/%_sysconfdir/alternatives";
271 ln -s "%_bindir/ld" "%buildroot/%_sysconfdir/alternatives/ld";
272 ln -s "%_sysconfdir/alternatives/ld" "%buildroot/%_bindir/ld";
273 rm -rf $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
274 mkdir -p $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
275 ln -sf ../../bin/{ar,as,ld,nm,ranlib,strip} $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
277 ln -sf ../../bin/ld.gold $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
280 mv $RPM_BUILD_ROOT%{_prefix}/%{HOST}/lib/ldscripts $RPM_BUILD_ROOT%{_libdir}
281 ln -sf ../../%{_lib}/ldscripts $RPM_BUILD_ROOT%{_prefix}/%{HOST}/lib/ldscripts
283 # Install header files
284 make -C libiberty install_to_libdir target_header_dir=/usr/include DESTDIR=$RPM_BUILD_ROOT
285 # We want the PIC libiberty.a
286 install -m 644 libiberty/pic/libiberty.a $RPM_BUILD_ROOT%{_libdir}
288 chmod a+x $RPM_BUILD_ROOT%{_libdir}/libbfd-*
289 chmod a+x $RPM_BUILD_ROOT%{_libdir}/libopcodes-*
290 # No shared linking outside binutils
291 rm -f $RPM_BUILD_ROOT%{_libdir}/lib{bfd,opcodes,inproctrace}.so
292 rm -f $RPM_BUILD_ROOT%{_libdir}/lib{bfd,opcodes}.la
293 # Remove unwanted files to shut up rpm
294 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/dlltool.1 $RPM_BUILD_ROOT%{_mandir}/man1/windres.1 $RPM_BUILD_ROOT%{_mandir}/man1/windmc.1
297 #%find_lang bfd binutils.lang
298 #%find_lang gas binutils.lang
299 #%find_lang ld binutils.lang
300 #%find_lang opcodes binutils.lang
301 #%find_lang gprof binutils.lang
303 #%find_lang gold binutils-gold.lang
305 mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}
306 install -m 644 binutils/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-binutils
307 install -m 644 gas/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-gas
308 install -m 644 ld/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-ld
310 # installing cross-TARGET-binutils and TARGET-binutils
311 make DESTDIR=$RPM_BUILD_ROOT install
312 # Replace hard links by symlinks, so that rpmlint doesn't complain
313 T=$(basename %buildroot/usr/%{TARGET}*)
314 for f in %buildroot/usr/$T/bin/* ; do
315 ln -sf /usr/bin/$T-$(basename $f) $f
317 %if "%{TARGET}" == "avr"
318 install -c gas-nesc/as-new $RPM_BUILD_ROOT%{_prefix}/bin/%{TARGET}-nesc-as
319 ln -sf ../../bin/%{TARGET}-nesc-as $RPM_BUILD_ROOT%{_prefix}/%{TARGET}/bin/nesc-as
321 rm -rf $RPM_BUILD_ROOT%{_mandir}
322 rm -rf $RPM_BUILD_ROOT%{_infodir}
323 rm -rf $RPM_BUILD_ROOT%{_prefix}/lib*
324 rm -rf $RPM_BUILD_ROOT%{_prefix}/include
325 rm -f $RPM_BUILD_ROOT%{_prefix}/bin/*-c++filt
327 # We have gdb in separate package
328 rm -f $RPM_BUILD_ROOT%{_bindir}/gdb*
329 rm -rf $RPM_BUILD_ROOT%{_datadir}/gdb
333 cd $RPM_BUILD_DIR/binutils-%version
339 "%_sbindir/update-alternatives" --install \
340 "%_bindir/ld" ld "%_bindir/ld.bfd" 1
343 "%_sbindir/update-alternatives" --install \
344 "%_bindir/ld" ld "%_bindir/ld.gold" 2
348 if [ "$1" = 0 ]; then
349 "%_sbindir/update-alternatives" --remove ld "%_bindir/ld.bfd";
353 if [ "$1" = 0 ]; then
354 "%_sbindir/update-alternatives" --remove ld "%_bindir/ld.gold";
360 %defattr(-,root,root)
363 %{_prefix}/%{HOST}/bin/*
364 %{_prefix}/%{HOST}/lib/ldscripts
365 %ghost %_sysconfdir/alternatives/ld
369 %exclude %{_bindir}/*gold
371 %doc %{_infodir}/*.gz
372 %{_libdir}/lib*-%{version}*.so
374 %{_prefix}/%{TARGET}*
380 %defattr(-,root,root)
383 %if "%{TARGET}" == "arm"
384 %{_prefix}/%{TARGET}-tizen-linux-gnueabi/bin/*gold
386 %{_prefix}/%{TARGET}-tizen-linux/bin/*gold
389 %{_prefix}/%{HOST}/bin/*gold
395 %defattr(-,root,root)
396 %{_prefix}/include/*.h
397 %{_prefix}/include/gdb/*.h