Fix wrong source file name of cross-arm-binutils.
[platform/upstream/binutils.git] / packaging / cross-i386-binutils.spec
index 0f1b7ae..37606a0 100644 (file)
@@ -1,23 +1,5 @@
-#
-# spec file for package cross-i386-binutils
-#
-# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
-#
-# All modifications and additions to the file contributed by third parties
-# remain the property of their copyright owners, unless otherwise agreed
-# upon. The license for this file, and modifications and additions to the
-# file, is the same license as for the pristine package itself (unless the
-# license for the pristine package is not an Open Source License, in which
-# case the license is the MIT License). An "Open Source License" is a
-# license that conforms to the Open Source Definition (Version 1.9)
-# published by the Open Source Initiative.
-
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
-#
-
-
-Name:           cross-i386-binutils
-ExcludeArch:    %ix86
+Name:         cross-i386-binutils
+ExcludeArch: %ix86
 %define cross 1
 %define TARGET i586
 BuildRequires:  bison
@@ -29,7 +11,8 @@ BuildRequires:  glibc-devel-static
 BuildRequires:  bc
 BuildRequires:  makeinfo
 BuildRequires:  zlib-devel-static
-Version:        2.22
+Requires(pre):  update-alternatives
+Version:        2.23.1
 Release:        0
 #
 # RUN_TESTS
@@ -62,32 +45,13 @@ Release:        0
 #
 #
 Url:            http://www.gnu.org/software/binutils/
-%define binutils_version %(echo %version | sed 's/\\.[0-9]\\{8\\}$//')
+#%define binutils_version %(echo %version | sed 's/\\.[0-9]\\{8\\}$//')
 Summary:        GNU Binutils
 License:        GFDL-1.3 and GPL-3.0+
 Group:          Development/Tools/Building
-Source:         binutils-%{binutils_version}.tar.bz2
+Source:         binutils-%{version}.tar.bz2
 Source1:        pre_checkin.sh
-Source2:        README.First-for.SuSE.packagers
 Source3:        baselibs.conf
-Patch3:         binutils-skip-rpaths.patch
-Patch4:         s390-biarch.diff
-Patch5:         x86-64-biarch.patch
-Patch6:         unit-at-a-time.patch
-Patch7:         ld-dtags.diff
-Patch8:         ld-relro.diff
-Patch9:         testsuite.diff
-Patch10:        enable-targets-gold.diff
-Patch11:        use-hashtype-both-by-default.diff
-Patch14:        binutils-build-as-needed.diff
-Patch15:        fixup-testcase-perturb.diff
-Patch18:        gold-depend-on-opcodes.diff
-Patch19:        bso12451.diff
-Patch20:        bso13449.diff
-Patch90:        cross-avr-nesc-as.patch
-Patch92:        cross-avr-omit_section_dynsym.patch
-Patch93:        avr-binutils-relocs.patch
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 
 %description
 C compiler utilities: ar, as, gprof, ld, nm, objcopy, objdump, ranlib,
@@ -133,35 +97,12 @@ binutils.
 
 %prep
 echo "make check will return with %{make_check_handling} in case of testsuite failures."
-%setup -q -n binutils-%{binutils_version}
-%if !%{test_vanilla}
-%patch3
-%patch4
-%patch5
-%patch6
-%patch7 -p1
-%patch8
-%patch9
-%patch10
-%patch11
-%patch14
-%patch15
-%patch18
-%patch19 -p1
-%patch20 -p1
-%if "%{TARGET}" == "avr"
-cp gas/config/tc-avr.h gas/config/tc-avr-nesc.h
-%patch90
-%patch92
-%patch93 -p1
-%endif
-#
-# test_vanilla
-%endif
-sed -i -e '/BFD_VERSION_DATE/s/$/-%(echo %release | sed 's/\.[0-9]*$//')/' bfd/version.h
+%setup -q -n binutils-%{version}
 
+sed -i -e '/BFD_VERSION_DATE/s/$/-%(echo %release | sed 's/\.[0-9]*$//')/' bfd/version.h
 %build
 RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Wno-error"
+RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS |sed -e 's/atom/i686/g'`
 %if 0%{!?cross:1}
 # Building native binutils
 echo "Building native binutils." 
@@ -295,16 +236,22 @@ ln -sf ld.gold $RPM_BUILD_ROOT%{_bindir}/gold
 make DESTDIR=$RPM_BUILD_ROOT install-info install
 make -C gas/doc DESTDIR=$RPM_BUILD_ROOT install-info-am install-am
 make DESTDIR=$RPM_BUILD_ROOT install-bfd install-opcodes
-# we could eventually use alternatives for /usr/bin/ld
-if test -f $RPM_BUILD_ROOT%{_bindir}/ld.bfd; then
-  rm $RPM_BUILD_ROOT%{_bindir}/ld
-  ln -sf ld.bfd $RPM_BUILD_ROOT%{_bindir}/ld;
+
+if [ ! -f "%buildroot/%_bindir/ld.bfd" ]; then
+  mv "%buildroot/%_bindir"/{ld,ld.bfd};
+else
+  rm -f "%buildroot/%_bindir/ld";
 fi
+mkdir -p "%buildroot/%_sysconfdir/alternatives";
+ln -s "%_bindir/ld" "%buildroot/%_sysconfdir/alternatives/ld";
+ln -s "%_sysconfdir/alternatives/ld" "%buildroot/%_bindir/ld";
 rm -rf $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
 mkdir -p $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
 ln -sf ../../bin/{ar,as,ld,nm,ranlib,strip} $RPM_BUILD_ROOT%{_prefix}/%{HOST}/bin
-#mv $RPM_BUILD_ROOT%{_prefix}/%{HOST}/lib/ldscripts $RPM_BUILD_ROOT%{_libdir}
-#ln -sf ../../%{_lib}/ldscripts $RPM_BUILD_ROOT%{_prefix}/%{HOST}/lib/ldscripts
+
+mv $RPM_BUILD_ROOT%{_prefix}/%{HOST}/lib/ldscripts $RPM_BUILD_ROOT%{_libdir}
+ln -sf ../../%{_lib}/ldscripts $RPM_BUILD_ROOT%{_prefix}/%{HOST}/lib/ldscripts
+
 # Install header files
 make -C libiberty install_to_libdir target_header_dir=/usr/include DESTDIR=$RPM_BUILD_ROOT
 # We want the PIC libiberty.a
@@ -353,11 +300,28 @@ rm -f $RPM_BUILD_ROOT%{_prefix}/bin/*-c++filt
 %endif
 cd $RPM_BUILD_DIR/binutils-%version
 
-%clean
-rm -rf $RPM_BUILD_ROOT
 
 %if 0%{!?cross:1}
 %docs_package
+%post
+"%_sbindir/update-alternatives" --install \
+    "%_bindir/ld" ld "%_bindir/ld.bfd" 1
+
+%post gold
+"%_sbindir/update-alternatives" --install \
+    "%_bindir/ld" ld "%_bindir/ld.gold" 2
+
+
+%preun
+if [ "$1" = 0 ]; then
+    "%_sbindir/update-alternatives" --remove ld "%_bindir/ld.bfd";
+fi;
+
+%preun gold
+if [ "$1" = 0 ]; then
+    "%_sbindir/update-alternatives" --remove ld "%_bindir/ld.gold";
+fi;
+
 %endif
 
 %files 
@@ -366,7 +330,8 @@ rm -rf $RPM_BUILD_ROOT
 %{_docdir}/%{name}
 %{_prefix}/%{HOST}/bin/*
 %{_prefix}/%{HOST}/lib/ldscripts
-#%{_libdir}/ldscripts
+%ghost %_sysconfdir/alternatives/ld
+%{_libdir}/ldscripts
 %{_bindir}/*
 %ifarch %gold_archs
 %exclude %{_bindir}/gold
@@ -382,7 +347,6 @@ rm -rf $RPM_BUILD_ROOT
 %ifarch %gold_archs
 %files gold 
 %defattr(-,root,root)
-%doc gold/NEWS gold/README
 %{_bindir}/gold
 %{_bindir}/ld.gold
 %endif