Jakub, please could we apply this patch to the binutils specfile? It provides an optional %{binutils_target} macro which, when defined, will generate a cross-binutils package. But when it's _not_ defined, as it won't be for your builds or in the build system, it just builds a native binutils as before. This will make it easier for people to build cross-binutils based exactly on the the Fedora binutils packages. We'll then want to look at how best to get a set of cross-binutils packages into Fedora, without adversely affecting your workflow on the native binutils. The naïve approach is just to _copy_ the binutils package to various new $ARCH-binutils packages. But hopefully the the infrastructure folks can come up with some trick in package CVS or in koji which will make it simpler than that. Index: binutils.spec =================================================================== RCS file: /cvs/pkgs/rpms/binutils/F-9/binutils.spec,v retrieving revision 1.132 diff -u -r1.132 binutils.spec --- binutils.spec 8 Apr 2008 14:06:03 -0000 1.132 +++ binutils.spec 5 Jul 2008 11:39:42 -0000 @@ -1,5 +1,13 @@ +%if "%{?binutils_target}" == "" +%define binutils_target %{_target_platform} +%define isnative 1 +%else +%define cross %{binutils_target}- +%define isnative 0 +%endif + Summary: A GNU collection of binary utilities. -Name: binutils +Name: %{?cross}binutils Version: 2.18.50.0.6 Release: 2 License: GPLv3+ @@ -54,7 +62,7 @@ to consider using libelf instead of BFD. %prep -%setup -q +%setup -q -n binutils-%{version} %patch1 -p0 -b .ltconfig-multilib~ %patch2 -p0 -b .ppc64-pie~ %patch3 -p0 -b .place-orphan~ @@ -68,7 +76,7 @@ %patch7 -p0 -b .version~ %patch8 -p0 -b .pclmul~ -# On ppc64 we might use 64K pages +# On ppc64 we might use 64KiB pages sed -i -e '/#define.*ELF_COMMONPAGESIZE/s/0x1000$/0x10000/' bfd/elf*ppc.c # LTP sucks perl -pi -e 's/i\[3-7\]86/i[34567]86/g' */conf* @@ -80,24 +88,37 @@ sed -i -e 's/^libopcodes_la_LDFLAGS = /&-Wl,-Bsymbolic-functions /' opcodes/Makefile.{am,in} fi touch */configure +sed -i -e 's/^ PACKAGE=/ PACKAGE=%{?cross}/' */configure %build -mkdir build-%{_target_platform} -cd build-%{_target_platform} +echo target is %{binutils_target} +mkdir build-%{binutils_target} +cd build-%{binutils_target} CARGS= -%ifarch sparc ppc s390 -CARGS=--enable-64-bit-bfd -%endif -%ifarch ia64 -CARGS=--enable-targets=i386-linux +case %{binutils_target} in + sparc*|ppc*|s390*) + CARGS=--enable-64-bit-bfd + ;; + ia64*) + CARGS=--enable-targets=i386-linux + ;; +esac +%if %isnative + SHAREDARGS=--enable-shared + TARGET=%{binutils_target} + SYSROOT= +%else + SHAREDARGS=--disable-shared + TARGET="--target %{binutils_target}" + SYSROOT="--with-sysroot=/usr/%{binutils_target}" %endif CC="gcc -L`pwd`/bfd/.libs/" CFLAGS="${CFLAGS:-%optflags}" ../configure \ - %{_target_platform} --prefix=%{_prefix} --exec-prefix=%{_exec_prefix} \ + $TARGET --prefix=%{_prefix} --exec-prefix=%{_exec_prefix} \ --bindir=%{_bindir} --sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} \ --datadir=%{_datadir} --includedir=%{_includedir} --libdir=%{_libdir} \ --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} \ --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} \ - --infodir=%{_infodir} --enable-shared $CARGS --disable-werror \ + --infodir=%{_infodir} $SHAREDARGS $CARGS --disable-werror \ --with-bugurl=http://bugzilla.redhat.com/bugzilla/ make %{_smp_mflags} tooldir=%{_prefix} all make %{_smp_mflags} tooldir=%{_prefix} info @@ -110,8 +131,9 @@ %install rm -rf %{buildroot} mkdir -p %{buildroot}%{_prefix} -cd build-%{_target_platform} +cd build-%{binutils_target} %makeinstall +%if %isnative make prefix=%{buildroot}%{_prefix} infodir=%{buildroot}%{_infodir} install-info gzip -q9f %{buildroot}%{_infodir}/*.info* @@ -133,10 +155,6 @@ # Remove libtool files, which reference the .so libs rm -f %{buildroot}%{_prefix}/%{_lib}/lib{bfd,opcodes}.la -# This one comes from gcc -rm -f %{buildroot}%{_infodir}/dir -rm -rf %{buildroot}%{_prefix}/%{_target_platform} - %ifarch %{ix86} x86_64 ppc ppc64 s390 s390x sparc sparc64 sed -i -e '/^#include "ansidecl.h"/{p;s~^.*$~#include <bits/wordsize.h>~;}' \ %ifarch %{ix86} x86_64 @@ -154,22 +172,36 @@ %endif touch -r ../bfd/bfd-in2.h %{buildroot}%{_prefix}/include/bfd.h +%else # native +# For cross-binutils we drop the documentation. +rm -rf %{buildroot}%{_infodir} +#rm -rf %{buildroot}%{_prefix}/share/locale +#rm -rf %{buildroot}%{_mandir} +rm -rf %{buildroot}%{_prefix}/%{_lib}/libiberty.a +%endif # native + +# This one comes from gcc +rm -f %{buildroot}%{_infodir}/dir +rm -rf %{buildroot}%{_prefix}/%{binutils_target} + + cd .. -%find_lang binutils -%find_lang opcodes -%find_lang bfd -%find_lang gas -%find_lang ld -%find_lang gprof -cat opcodes.lang >> binutils.lang -cat bfd.lang >> binutils.lang -cat gas.lang >> binutils.lang -cat ld.lang >> binutils.lang -cat gprof.lang >> binutils.lang +%find_lang %{?cross}binutils +%find_lang %{?cross}opcodes +%find_lang %{?cross}bfd +%find_lang %{?cross}gas +%find_lang %{?cross}ld +%find_lang %{?cross}gprof +cat %{?cross}opcodes.lang >> %{?cross}binutils.lang +cat %{?cross}bfd.lang >> %{?cross}binutils.lang +cat %{?cross}gas.lang >> %{?cross}binutils.lang +cat %{?cross}ld.lang >> %{?cross}binutils.lang +cat %{?cross}gprof.lang >> %{?cross}binutils.lang %clean rm -rf %{buildroot} +%if %isnative %post /sbin/ldconfig /sbin/install-info --info-dir=%{_infodir} %{_infodir}/as.info.gz @@ -200,12 +232,14 @@ if [ $1 = 0 ] ;then /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/bfd.info.gz || : fi +%endif # native -%files -f binutils.lang +%files -f %{?cross}binutils.lang %defattr(-,root,root) %doc README %{_prefix}/bin/* %{_mandir}/man1/* +%if %isnative %{_prefix}/%{_lib}/lib*.so %{_infodir}/[^b]*info* %{_infodir}/binutils*info* @@ -215,8 +249,12 @@ %{_prefix}/include/* %{_prefix}/%{_lib}/lib*.a %{_infodir}/bfd*info* +%endif # native %changelog +* Sat Jul 5 2008 David Woodhouse <david.woodhouse@xxxxxxxxx> 2.18.50.0.6-3 +- Add %%{binutils_target} macro to support building cross-binutils + * Tue Apr 8 2008 Jakub Jelinek <jakub@xxxxxxxxxx> 2.18.50.0.6-2 - backport .clmul -> .pclmul renaming -- dwmw2 @linux.intel.com -- fedora-devel-list mailing list fedora-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/fedora-devel-list