1 Name: cross-arm-binutils
9 BuildRequires: glibc-devel-static
12 BuildRequires: makeinfo
13 BuildRequires: zlib-devel-static
18 %define run_tests %(test ! -f %_sourcedir/RUN_TESTS ; echo $?)
19 # check the vanilla binutils, with no patches applied
21 %define test_vanilla %(test ! -f %_sourcedir/TEST_VANILLA ; echo $?)
23 # handle test suite failures
25 %ifarch alpha %arm hppa mips sh4 %sparc
26 %define make_check_handling true
29 # XXX disabled because gold is seriously broken for now
30 %define make_check_handling true
32 # let make check fail anyway if RUN_TESTS was requested
34 %define make_check_handling false
36 # handle all binary object formats supported by SuSE (and a few more)
37 %ifarch %ix86 %arm ia64 ppc ppc64 s390 s390x x86_64
38 %define build_multitarget 1
40 %define build_multitarget 0
42 %define target_list alpha armv5l armv7l armv8l hppa hppa64 i686 ia64 m68k mips powerpc powerpc64 s390 s390x sh4 sparc sparc64 x86_64
46 Url: http://www.gnu.org/software/binutils/
47 %define binutils_version %(echo %version | sed 's/\\.[0-9]\\{8\\}$//')
49 License: GFDL-1.3 and GPL-3.0+
50 Group: Development/Tools/Building
51 Source: binutils-%{binutils_version}.tar.bz2
52 Source1: pre_checkin.sh
53 Source3: baselibs.conf
56 C compiler utilities: ar, as, gprof, ld, nm, objcopy, objdump, ranlib,
57 size, strings, and strip. These utilities are needed whenever you want
58 to compile a program or kernel.
62 Summary: The gold linker
64 Group: Development/Tools/Building
65 Requires: binutils = %{version}-%{release}
67 %define gold_archs %ix86 %arm x86_64 ppc ppc64 %sparc
71 gold is an ELF linker. It is intended to have complete support for ELF
72 and to run as fast as possible on modern systems. For normal use it is
73 a drop-in replacement for the older GNU linker.
77 Summary: GNU binutils (BFD development files)
79 Group: Development/Libraries/C and C++
80 Requires: binutils = %{version}-%{release}
82 Provides: binutils:/usr/include/bfd.h
85 This package includes header files and static libraries necessary to
86 build programs which use the GNU BFD library, which is part of
91 %define HOST %{_target_cpu}-tizen-linux-gnueabi
93 %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
95 %define DIST %(echo '%distribution' | sed 's/ (.*)//')
98 echo "make check will return with %{make_check_handling} in case of testsuite failures."
99 %setup -q -n binutils-%{binutils_version}
101 sed -i -e '/BFD_VERSION_DATE/s/$/-%(echo %release | sed 's/\.[0-9]*$//')/' bfd/version.h
103 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Wno-error"
104 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS |sed -e 's/atom/i686/g'`
106 # Building native binutils
107 echo "Building native binutils."
108 %if %build_multitarget
109 EXTRA_TARGETS="%(printf ,%%s-tizen-linux %target_list)"
110 EXTRA_TARGETS="$EXTRA_TARGETS,powerpc-macos,powerpc-macos10,spu-elf,x86_64-pep"
114 EXTRA_TARGETS="$EXTRA_TARGETS,sparc64-tizen-linux"
117 EXTRA_TARGETS="$EXTRA_TARGETS,powerpc64-tizen-linux"
120 EXTRA_TARGETS="$EXTRA_TARGETS,s390x-tizen-linux"
123 EXTRA_TARGETS="$EXTRA_TARGETS,s390-tizen-linux"
126 EXTRA_TARGETS="$EXTRA_TARGETS,x86_64-tizen-linux"
129 EXTRA_TARGETS="$EXTRA_TARGETS,spu-elf"
132 EXTRA_TARGETS="$EXTRA_TARGETS,arm-tizen-linux-gnueabi"
135 %define common_flags CFLAGS="${RPM_OPT_FLAGS}" CXXFLAGS="${RPM_OPT_FLAGS}" \\\
136 --prefix=%{_prefix} --libdir=%{_libdir} \\\
137 --infodir=%{_infodir} --mandir=%{_mandir} \\\
138 --with-bugurl=http://bugs.opensuse.org/ \\\
139 --with-pkgversion="GNU Binutils; %{DIST}" \\\
141 --with-separate-debug-dir=%{_prefix}/lib/debug \\\
142 --with-pic --build=%{HOST}
145 ../configure %common_flags \
146 ${EXTRA_TARGETS:+--enable-targets="${EXTRA_TARGETS#,}"} \
152 make %{?_smp_mflags} all-bfd TARGET-bfd=headers
153 # force reconfiguring (???)
158 # building cross-TARGET-binutils
159 echo "Building cross binutils."
163 %if "%{TARGET}" == "sparc"
164 EXTRA_TARGETS="$EXTRA_TARGETS,sparc64-tizen-linux"
166 %if "%{TARGET}" == "powerpc"
167 EXTRA_TARGETS="$EXTRA_TARGETS,powerpc64-tizen-linux"
169 %if "%{TARGET}" == "s390"
170 EXTRA_TARGETS="$EXTRA_TARGETS,s390x-tizen-linux"
172 %if "%{TARGET}" == "s390x"
173 EXTRA_TARGETS="$EXTRA_TARGETS,s390-tizen-linux"
175 %if "%{TARGET}" == "i586"
176 EXTRA_TARGETS="$EXTRA_TARGETS,x86_64-tizen-linux"
178 %if "%{TARGET}" == "hppa"
179 EXTRA_TARGETS="$EXTRA_TARGETS,hppa64-tizen-linux"
181 %if "%{TARGET}" == "arm"
182 EXTRA_TARGETS="$EXTRA_TARGETS,arm-tizen-linux-gnueabi"
184 %if "%{TARGET}" == "avr" || "%{TARGET}" == "spu"
187 %if "%{TARGET}" == "arm"
188 TARGET_OS=%{TARGET}-tizen-linux-gnueabi
190 TARGET_OS=%{TARGET}-tizen-linux
193 ../configure CFLAGS="${RPM_OPT_FLAGS}" \
194 --prefix=%{_prefix} \
195 --with-bugurl=http://bugs.opensuse.org/ \
196 --with-pkgversion="GNU Binutils; %{DIST}" \
198 --build=%{HOST} --target=$TARGET_OS \
199 %if "%{TARGET}" == "spu"
200 --with-sysroot=/usr/spu \
202 --with-sysroot=%{_prefix}/$TARGET_OS/sys-root \
204 ${EXTRA_TARGETS:+--enable-targets="${EXTRA_TARGETS#,}"}
205 make %{?_smp_mflags} all-bfd TARGET-bfd=headers
206 # force reconfiguring
209 %if "%{TARGET}" == "avr"
210 # build an extra nesC version because nesC requires $'s in identifiers
212 echo '#include "tc-%{TARGET}-nesc.h"' > gas-nesc/targ-cpu.h
213 make -C gas-nesc clean
214 make -C gas-nesc %{?_smp_mflags}
222 make -k check CFLAGS="-O2 -g" CXXFLAGS="-O2 -g" || %{make_check_handling}
224 make -k check CFLAGS="$RPM_OPT_FLAGS -Wno-unused -Wno-unprototyped-calls" || :
230 # installing native binutils
232 make DESTDIR=$RPM_BUILD_ROOT install-gold
233 ln -sf ld.gold $RPM_BUILD_ROOT%{_bindir}/gold
235 make DESTDIR=$RPM_BUILD_ROOT install-info install
236 make -C gas/doc DESTDIR=$RPM_BUILD_ROOT install-info-am install-am
237 make DESTDIR=$RPM_BUILD_ROOT install-bfd install-opcodes
239 if [ ! -f "%buildroot/%_bindir/ld.bfd" ]; then
240 mv "%buildroot/%_bindir"/{ld,ld.bfd};
242 rm -f "%buildroot/%_bindir/ld";
244 mkdir -p "%buildroot/%_sysconfdir/alternatives";
245 ln -s "%_bindir/ld" "%buildroot/%_sysconfdir/alternatives/ld";
246 ln -s "%_sysconfdir/alternatives/ld" "%buildroot/%_bindir/ld";
247 rm -rf $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
248 mkdir -p $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
249 ln -sf ../../bin/{ar,as,ld,nm,ranlib,strip} $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
251 #mv $RPM_BUILD_ROOT%{_prefix}/%{HOST}/lib/ldscripts $RPM_BUILD_ROOT%{_libdir}
252 #ln -sf ../../%{_lib}/ldscripts $RPM_BUILD_ROOT%{_prefix}/%{HOST}/lib/ldscripts
253 # Install header files
254 make -C libiberty install_to_libdir target_header_dir=/usr/include DESTDIR=$RPM_BUILD_ROOT
255 # We want the PIC libiberty.a
256 install -m 644 libiberty/pic/libiberty.a $RPM_BUILD_ROOT%{_libdir}
258 chmod a+x $RPM_BUILD_ROOT%{_libdir}/libbfd-*
259 chmod a+x $RPM_BUILD_ROOT%{_libdir}/libopcodes-*
260 # No shared linking outside binutils
261 rm $RPM_BUILD_ROOT%{_libdir}/lib{bfd,opcodes}.so
262 rm $RPM_BUILD_ROOT%{_libdir}/lib{bfd,opcodes}.la
263 # Remove unwanted files to shut up rpm
264 rm $RPM_BUILD_ROOT%{_infodir}/configure* $RPM_BUILD_ROOT%{_infodir}/standards.info*
265 rm $RPM_BUILD_ROOT%{_mandir}/man1/dlltool.1 $RPM_BUILD_ROOT%{_mandir}/man1/windres.1 $RPM_BUILD_ROOT%{_mandir}/man1/windmc.1
268 #%find_lang bfd binutils.lang
269 #%find_lang gas binutils.lang
270 #%find_lang ld binutils.lang
271 #%find_lang opcodes binutils.lang
272 #%find_lang gprof binutils.lang
274 #%find_lang gold binutils-gold.lang
276 mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}
277 install -m 644 binutils/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-binutils
278 install -m 644 gas/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-gas
279 install -m 644 ld/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-ld
281 # installing cross-TARGET-binutils and TARGET-binutils
282 make DESTDIR=$RPM_BUILD_ROOT install
283 # Replace hard links by symlinks, so that rpmlint doesn't complain
284 T=$(basename %buildroot/usr/%{TARGET}*)
285 for f in %buildroot/usr/$T/bin/* ; do
286 ln -sf /usr/bin/$T-$(basename $f) $f
288 %if "%{TARGET}" == "avr"
289 install -c gas-nesc/as-new $RPM_BUILD_ROOT%{_prefix}/bin/%{TARGET}-nesc-as
290 ln -sf ../../bin/%{TARGET}-nesc-as $RPM_BUILD_ROOT%{_prefix}/%{TARGET}/bin/nesc-as
292 rm -rf $RPM_BUILD_ROOT%{_mandir}
293 rm -rf $RPM_BUILD_ROOT%{_infodir}
294 rm -rf $RPM_BUILD_ROOT%{_prefix}/lib*
295 rm -rf $RPM_BUILD_ROOT%{_prefix}/include
296 rm -f $RPM_BUILD_ROOT%{_prefix}/bin/*-c++filt
299 cd $RPM_BUILD_DIR/binutils-%version
305 "%_sbindir/update-alternatives" --install \
306 "%_bindir/ld" ld "%_bindir/ld.bfd" 2
309 "%_sbindir/update-alternatives" --install \
310 "%_bindir/ld" ld "%_bindir/ld.gold" 1
314 if [ "$1" = 0 ]; then
315 "%_sbindir/update-alternatives" --remove ld "%_bindir/ld.bfd";
319 if [ "$1" = 0 ]; then
320 "%_sbindir/update-alternatives" --remove ld "%_bindir/ld.gold";
326 %defattr(-,root,root)
329 %{_prefix}/%{HOST}/bin/*
330 %{_prefix}/%{HOST}/lib/ldscripts
331 %ghost %_sysconfdir/alternatives/ld
332 #%{_libdir}/ldscripts
335 %exclude %{_bindir}/gold
336 %exclude %{_bindir}/ld.gold
338 %doc %{_infodir}/*.gz
339 %{_libdir}/lib*-%{version}*.so
341 %{_prefix}/%{TARGET}*
347 %defattr(-,root,root)
354 %defattr(-,root,root)
355 %{_prefix}/include/*.h