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 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 ia64 ppc ppc64 s390 s390x x86_64
39 %define build_multitarget 1
41 %define build_multitarget 0
43 %define target_list 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/Tools/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/Tools/Building
66 Requires: binutils = %{version}-%{release}
68 %define gold_archs %ix86 %arm 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/Libraries/C and C++
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}
102 sed -i -e '/BFD_VERSION_DATE/s/$/-%(echo %release | sed 's/\.[0-9]*$//')/' bfd/version.h
104 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Wno-error"
105 RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS |sed -e 's/atom/i686/g'`
107 # Building native binutils
108 echo "Building native binutils."
109 %if %build_multitarget
110 EXTRA_TARGETS="%(printf ,%%s-tizen-linux %target_list)"
111 EXTRA_TARGETS="$EXTRA_TARGETS,powerpc-macos,powerpc-macos10,spu-elf,x86_64-pep"
115 EXTRA_TARGETS="$EXTRA_TARGETS,sparc64-tizen-linux"
118 EXTRA_TARGETS="$EXTRA_TARGETS,powerpc64-tizen-linux"
121 EXTRA_TARGETS="$EXTRA_TARGETS,s390x-tizen-linux"
124 EXTRA_TARGETS="$EXTRA_TARGETS,s390-tizen-linux"
127 EXTRA_TARGETS="$EXTRA_TARGETS,x86_64-tizen-linux"
130 EXTRA_TARGETS="$EXTRA_TARGETS,spu-elf"
133 EXTRA_TARGETS="$EXTRA_TARGETS,arm-tizen-linux-gnueabi"
136 %define common_flags CFLAGS="${RPM_OPT_FLAGS}" CXXFLAGS="${RPM_OPT_FLAGS}" \\\
137 --prefix=%{_prefix} --libdir=%{_libdir} \\\
138 --infodir=%{_infodir} --mandir=%{_mandir} \\\
139 --with-bugurl=http://bugs.opensuse.org/ \\\
140 --with-pkgversion="GNU Binutils; %{DIST}" \\\
142 --with-separate-debug-dir=%{_prefix}/lib/debug \\\
143 --with-pic --build=%{HOST}
146 ../configure %common_flags \
147 ${EXTRA_TARGETS:+--enable-targets="${EXTRA_TARGETS#,}"} \
153 make %{?_smp_mflags} all-bfd TARGET-bfd=headers
154 # force reconfiguring (???)
159 # building cross-TARGET-binutils
160 echo "Building cross binutils."
164 %if "%{TARGET}" == "sparc"
165 EXTRA_TARGETS="$EXTRA_TARGETS,sparc64-tizen-linux"
167 %if "%{TARGET}" == "powerpc"
168 EXTRA_TARGETS="$EXTRA_TARGETS,powerpc64-tizen-linux"
170 %if "%{TARGET}" == "s390"
171 EXTRA_TARGETS="$EXTRA_TARGETS,s390x-tizen-linux"
173 %if "%{TARGET}" == "s390x"
174 EXTRA_TARGETS="$EXTRA_TARGETS,s390-tizen-linux"
176 %if "%{TARGET}" == "i586"
177 EXTRA_TARGETS="$EXTRA_TARGETS,x86_64-tizen-linux"
179 %if "%{TARGET}" == "hppa"
180 EXTRA_TARGETS="$EXTRA_TARGETS,hppa64-tizen-linux"
182 %if "%{TARGET}" == "arm"
183 EXTRA_TARGETS="$EXTRA_TARGETS,arm-tizen-linux-gnueabi"
185 %if "%{TARGET}" == "avr" || "%{TARGET}" == "spu"
188 %if "%{TARGET}" == "arm"
189 TARGET_OS=%{TARGET}-tizen-linux-gnueabi
191 TARGET_OS=%{TARGET}-tizen-linux
194 ../configure CFLAGS="${RPM_OPT_FLAGS}" \
195 --prefix=%{_prefix} \
196 --with-bugurl=http://bugs.opensuse.org/ \
197 --with-pkgversion="GNU Binutils; %{DIST}" \
199 --build=%{HOST} --target=$TARGET_OS \
200 %if "%{TARGET}" == "spu"
201 --with-sysroot=/usr/spu \
203 --with-sysroot=%{_prefix}/$TARGET_OS/sys-root \
205 ${EXTRA_TARGETS:+--enable-targets="${EXTRA_TARGETS#,}"}
206 make %{?_smp_mflags} all-bfd TARGET-bfd=headers
207 # force reconfiguring
210 %if "%{TARGET}" == "avr"
211 # build an extra nesC version because nesC requires $'s in identifiers
213 echo '#include "tc-%{TARGET}-nesc.h"' > gas-nesc/targ-cpu.h
214 make -C gas-nesc clean
215 make -C gas-nesc %{?_smp_mflags}
223 make -k check CFLAGS="-O2 -g" CXXFLAGS="-O2 -g" || %{make_check_handling}
225 make -k check CFLAGS="$RPM_OPT_FLAGS -Wno-unused -Wno-unprototyped-calls" || :
231 # installing native binutils
233 make DESTDIR=$RPM_BUILD_ROOT install-gold
234 ln -sf ld.gold $RPM_BUILD_ROOT%{_bindir}/gold
236 make DESTDIR=$RPM_BUILD_ROOT install-info install
237 make -C gas/doc DESTDIR=$RPM_BUILD_ROOT install-info-am install-am
238 make DESTDIR=$RPM_BUILD_ROOT install-bfd install-opcodes
240 if [ ! -f "%buildroot/%_bindir/ld.bfd" ]; then
241 mv "%buildroot/%_bindir"/{ld,ld.bfd};
243 rm -f "%buildroot/%_bindir/ld";
245 mkdir -p "%buildroot/%_sysconfdir/alternatives";
246 ln -s "%_bindir/ld" "%buildroot/%_sysconfdir/alternatives/ld";
247 ln -s "%_sysconfdir/alternatives/ld" "%buildroot/%_bindir/ld";
248 rm -rf $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
249 mkdir -p $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
250 ln -sf ../../bin/{ar,as,ld,nm,ranlib,strip} $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
252 mv $RPM_BUILD_ROOT%{_prefix}/%{HOST}/lib/ldscripts $RPM_BUILD_ROOT%{_libdir}
253 ln -sf ../../%{_lib}/ldscripts $RPM_BUILD_ROOT%{_prefix}/%{HOST}/lib/ldscripts
255 # Install header files
256 make -C libiberty install_to_libdir target_header_dir=/usr/include DESTDIR=$RPM_BUILD_ROOT
257 # We want the PIC libiberty.a
258 install -m 644 libiberty/pic/libiberty.a $RPM_BUILD_ROOT%{_libdir}
260 chmod a+x $RPM_BUILD_ROOT%{_libdir}/libbfd-*
261 chmod a+x $RPM_BUILD_ROOT%{_libdir}/libopcodes-*
262 # No shared linking outside binutils
263 rm $RPM_BUILD_ROOT%{_libdir}/lib{bfd,opcodes}.so
264 rm $RPM_BUILD_ROOT%{_libdir}/lib{bfd,opcodes}.la
265 # Remove unwanted files to shut up rpm
266 rm $RPM_BUILD_ROOT%{_infodir}/configure* $RPM_BUILD_ROOT%{_infodir}/standards.info*
267 rm $RPM_BUILD_ROOT%{_mandir}/man1/dlltool.1 $RPM_BUILD_ROOT%{_mandir}/man1/windres.1 $RPM_BUILD_ROOT%{_mandir}/man1/windmc.1
270 #%find_lang bfd binutils.lang
271 #%find_lang gas binutils.lang
272 #%find_lang ld binutils.lang
273 #%find_lang opcodes binutils.lang
274 #%find_lang gprof binutils.lang
276 #%find_lang gold binutils-gold.lang
278 mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}
279 install -m 644 binutils/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-binutils
280 install -m 644 gas/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-gas
281 install -m 644 ld/NEWS $RPM_BUILD_ROOT%{_docdir}/%{name}/NEWS-ld
283 # installing cross-TARGET-binutils and TARGET-binutils
284 make DESTDIR=$RPM_BUILD_ROOT install
285 # Replace hard links by symlinks, so that rpmlint doesn't complain
286 T=$(basename %buildroot/usr/%{TARGET}*)
287 for f in %buildroot/usr/$T/bin/* ; do
288 ln -sf /usr/bin/$T-$(basename $f) $f
290 %if "%{TARGET}" == "avr"
291 install -c gas-nesc/as-new $RPM_BUILD_ROOT%{_prefix}/bin/%{TARGET}-nesc-as
292 ln -sf ../../bin/%{TARGET}-nesc-as $RPM_BUILD_ROOT%{_prefix}/%{TARGET}/bin/nesc-as
294 rm -rf $RPM_BUILD_ROOT%{_mandir}
295 rm -rf $RPM_BUILD_ROOT%{_infodir}
296 rm -rf $RPM_BUILD_ROOT%{_prefix}/lib*
297 rm -rf $RPM_BUILD_ROOT%{_prefix}/include
298 rm -f $RPM_BUILD_ROOT%{_prefix}/bin/*-c++filt
301 cd $RPM_BUILD_DIR/binutils-%version
307 "%_sbindir/update-alternatives" --install \
308 "%_bindir/ld" ld "%_bindir/ld.bfd" 1
311 "%_sbindir/update-alternatives" --install \
312 "%_bindir/ld" ld "%_bindir/ld.gold" 2
316 if [ "$1" = 0 ]; then
317 "%_sbindir/update-alternatives" --remove ld "%_bindir/ld.bfd";
321 if [ "$1" = 0 ]; then
322 "%_sbindir/update-alternatives" --remove ld "%_bindir/ld.gold";
328 %defattr(-,root,root)
331 %{_prefix}/%{HOST}/bin/*
332 %{_prefix}/%{HOST}/lib/ldscripts
333 %ghost %_sysconfdir/alternatives/ld
337 %exclude %{_bindir}/gold
338 %exclude %{_bindir}/ld.gold
340 %doc %{_infodir}/*.gz
341 %{_libdir}/lib*-%{version}*.so
343 %{_prefix}/%{TARGET}*
349 %defattr(-,root,root)
356 %defattr(-,root,root)
357 %{_prefix}/include/*.h