File binutils.spec of Package binutils
#
# spec file for package binutils (version 2.20)
#
# Copyright (c) Lincom Software Team. All spec files
# are released under the CC-BY-NC-ND, version 3 United States.
#
#
# extra rpmbuild parameters
# --with debug: Build without optimizations and without splitting the debuginfo.
# --without testsuite: Do not run the testsuite. Default is to run it.
# --with testsuite: Run the testsuite. Default --with debug is not to run it.
# Basic Information
Name: binutils%{?_with_debug:-debug}
Version: 2.20.51.0.2
Release: 5%{?dist}
Summary: Collection of programming tools for manipulating object code
Group: Development/Tools
License: GNU GPL
URL: http://www.sourceware.org/binutils/
# Source Information
#Source0: http://ftp.gnu.org/gnu/binutils/binutils-2.20.tar.bz2
Source0: http://ftp.kernel.org/pub/linux/devel/binutils/binutils-%{version}.tar.bz2
# For multilib, forces binutils to look in both /lib and /lib64
Patch0: http://patches.cross-lfs.org/dev/binutils-2.19.51-genscripts_multilib-1.patch
# Patches from Fedora and sourceware
# FIXME PATCH 50: do we really need it?
Patch50: binutils-2.20.51.0.2-libtool-lib64.patch
# FIXME PATCH 52: do we really need it?
Patch52: binutils-2.20.51.0.2-ia64-lib64.patch
Patch53: binutils-2.20.51.0.2-set-long-long.patch
Patch54: binutils-2.20.51.0.2-build-id.patch
#Patch55: binutils-2.20.51.0.2-enable-gold.patch
# "gold" arches
%define gold_arches %ix86 x86_64
#%ifarch %gold_arches
#%define build_gold both
#%else
%define build_gold no
#%endif
# the debug option
%if 0%{?_with_debug:1}
# Define this if you want to skip the strip step and preserve debug info.
# Useful for testing.
%define __debug_install_post : > %{_builddir}/%{?buildsubdir}/debugfiles.list
%define debug_package %{nil}
%define run_testsuite 0%{?_with_testsuite:1}
%else
%define run_testsuite 0%{!?_without_testsuite:1}
%endif
# Build Information
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: texinfo gettext flex bison zlib-devel
#Conflicts: gcc-c++
%if %{run_testsuite}
#BuildRequires: zlib-static glibc-static
BuildRequires: dejagnu sharutils
%endif
Requires(post): /sbin/install-info
Requires(preun): /sbin/install-info
# The higher of these two numbers determines the default ld.
%{!?ld_bfd_priority: %define ld_bfd_priority 50}
%{!?ld_gold_priority:%define ld_gold_priority 30}
%if "%{build_gold}" == "both"
Requires(post): %{_sbindir}/alternatives
Requires(preun): %{_sbindir}/alternatives
%endif
%description
Binutils is a collection of binary utilities, including:
* ar: creating modifying and extracting from archives
* nm: for listing symbols from object files
* objcopy: for copying and translating object files
* objdump: for displaying information from object files
* ranlib: for generating an index for the contents of an archive
* size: for listing the section sizes of an object or archive file
* strings: for listing printable strings from files
* strip: for discarding symbols (a filter for demangling encoded C++ symbols
* addr2line: for converting addresses to file and line
* nlmconv: for converting object code into an NLM
%package devel
Summary: BFD and opcodes static libraries and header files
Group: System Environment/Libraries
Conflicts: binutils < 2.17.50.0.3-4
Requires(post): /sbin/install-info
Requires(preun): /sbin/install-info
Requires: zlib-devel
%description devel
This package contains BFD and opcodes static libraries and associated
header files. Only *.a libraries are included, because BFD doesn't
have a stable ABI. Developers starting new projects are strongly encouraged
to consider using libelf instead of BFD.
%prep
%setup -q -n binutils-%{version}
%patch0 -p1
%patch50 -p0 -b .libtool-lib64~
#%ifarch ia64
#%patch52 -p0 -b .ia64-lib64~
#%endif
%patch53 -p0 -b .set-long-long~
%patch54 -p0 -b .build-id~
#%patch55 -p0 -b .enable-gold~
%build
#echo target is %{binutils_target}
export CFLAGS="$RPM_OPT_FLAGS"
CARGS=
#case %{binutils_target} in i?86*)
CARGS="$CARGS --enable-64-bit-bfd"
# ;;
#esac
#
#case %{binutils_target} in ia64*)
# CARGS="$CARGS --enable-targets=i386-linux"
# ;;
#esac
%if 0%{?_with_debug:1}
CFLAGS="$CFLAGS -O0 -ggdb2"
%endif
%configure --prefix=/usr \
--build=%{_target_platform} --host=%{_target_platform} \
--enable-gold=%{build_gold} \
%if 0%{?_with_debug:1}
--disable-shared
%else
--enable-shared
%endif
make %{?_smp_mflags} tooldir=/usr all
# *rxu* should we substitute /usr with %{_prefix} like fedora?
make %{?_smp_mflags} tooldir=/usr info
# +++++++++++++++++FEDORA++++++++++++++++++
# Do not use %%check as it is run after %%install where libbfd.so is rebuild
# with -fvisibility=hidden no longer being usable in its shared form.
%if !%{run_testsuite}
echo ====================TESTSUITE DISABLED=========================
%else
make -k check < /dev/null || :
echo ====================TESTING=========================
cat {gas/testsuite/gas,ld/ld,binutils/binutils}.sum
echo ====================TESTING END=====================
for file in {gas/testsuite/gas,ld/ld,binutils/binutils}.{sum,log}
do
ln $file binutils-%{_target_platform}-$(basename $file) || :
done
tar cjf binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}-*.{sum,log}
uuencode binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}.tar.bz2
rm -f binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}-*.{sum,log}
%endif
# +++++++++++++++++++++END FEDORA++++++++++++++++++++
%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot} tooldir=/usr
#cp -v include/libiberty.h %{buildroot}/usr/include
# Rebuild libiberty.a with -fPIC.
# Future: Remove it together with its header file, projects should bundle it.
make -C libiberty clean
make CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C libiberty
# Rebuild libbfd.a with -fPIC.
# Without the hidden visibility the 3rd party shared libraries would export
# the bfd non-stable ABI.
make -C bfd clean
make CFLAGS="-g -fPIC $RPM_OPT_FLAGS -fvisibility=hidden" -C bfd
install -m 644 bfd/libbfd.a %{buildroot}%{_libdir}
install -m 644 libiberty/libiberty.a %{buildroot}%{_libdir}
install -m 644 include/libiberty.h %{buildroot}%{_prefix}/include
rm -f %{buildroot}%{_mandir}/man1/{dlltool,nlmconv,windres}*
#%if %{enable_shared}
#chmod +x %{buildroot}%{_libdir}/lib*.so*
#%endif
# Prevent programs from linking against libbfd and libopcodes
# dynamically, as they are change far too often.
rm -f %{buildroot}%{_libdir}/lib{bfd,opcodes}.so
# Remove libtool files, which reference the .so libs
rm -f %{buildroot}%{_libdir}/lib{bfd,opcodes}.la
# Sanity check --enable-64-bit-bfd really works.
# *rxu* This sanity check no longer works.
#grep '^#define BFD_ARCH_SIZE 64$' %{buildroot}%{_prefix}/include/bfd.h
# Fix multilib conflicts of generated values by __WORDSIZE-based expressions.
%ifarch %{ix86} x86_64
sed -i -e '/^#include "ansidecl.h"/{p;s~^.*$~#include <bits/wordsize.h>~;}' \
-e 's/^#define BFD_DEFAULT_TARGET_SIZE \(32\|64\) *$/#define BFD_DEFAULT_TARGET_SIZE __WORDSIZE/' \
-e 's/^#define BFD_HOST_64BIT_LONG [01] *$/#define BFD_HOST_64BIT_LONG (__WORDSIZE == 64)/' \
-e 's/^#define BFD_HOST_64_BIT \(long \)\?long *$/#if __WORDSIZE == 32\
#define BFD_HOST_64_BIT long long\
#else\
#define BFD_HOST_64_BIT long\
#endif/' \
-e 's/^#define BFD_HOST_U_64_BIT unsigned \(long \)\?long *$/#define BFD_HOST_U_64_BIT unsigned BFD_HOST_64_BIT/' \
%{buildroot}%{_prefix}/include/bfd.h
%endif
touch -r bfd/bfd-in2.h %{buildroot}%{_prefix}/include/bfd.h
%find_lang binutils
%find_lang opcodes
%find_lang bfd
%find_lang gas
%find_lang gprof
cat opcodes.lang >> binutils.lang
cat bfd.lang >> binutils.lang
cat gas.lang >> binutils.lang
cat gprof.lang >> binutils.lang
if [ -x ld/ld-new ]; then
%find_lang ld
cat ld.lang >> binutils.lang
fi
if [ -x gold/ld-new ]; then
%find_lang gold
cat gold.lang >> binutils.lang
fi
%clean
rm -rf %{buildroot}
%post
%if "%{build_gold}" == "both"
%__rm -f %{_bindir}/ld
%{_sbindir}/alternatives --install %{_bindir}/ld ld \
%{_bindir}/ld.bfd %{ld_bfd_priority}
%{_sbindir}/alternatives --install %{_bindir}/ld ld \
%{_bindir}/ld.gold %{ld_gold_priority}
%endif
/sbin/ldconfig
# For --excludedocs:
if [ -e %{_infodir}/binutils.info.gz ]
then
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/as.info.gz
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/binutils.info.gz
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/gprof.info.gz
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/ld.info.gz
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/standards.info.gz
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/configure.info.gz
fi
exit 0
%preun
%if "%{build_gold}" == "both"
if [ $1 = 0 ]; then
%{_sbindir}/alternatives --remove ld %{_bindir}/ld.bfd
%{_sbindir}/alternatives --remove ld %{_bindir}/ld.gold
fi
%endif
if [ $1 = 0 ]; then
if [ -e %{_infodir}/binutils.info.gz ]
then
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/as.info.gz
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/binutils.info.gz
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gprof.info.gz
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/ld.info.gz
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/standards.info.gz
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/configure.info.gz
fi
fi
exit 0
%postun -p /sbin/ldconfig
%post devel
if [ -e %{_infodir}/bfd.info.gz ]
then
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/bfd.info.gz
fi
exit 0
%preun devel
if [ $1 = 0 ]
then
if [ -e %{_infodir}/bfd.info.gz ]
then
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/bfd.info.gz
fi
fi
exit 0
%files -f binutils.lang
%defattr(-,root,root,-)
%doc README
%{_bindir}/[!l]*
%if "%{build_gold}" == "both"
%{_bindir}/ld.*
%ghost %{_bindir}/ld
%else
%{_bindir}/ld
%endif
%{_mandir}/man1/*
%{_libdir}/lib*.so
/usr/lib/ldscripts/*
%{_infodir}/[^b]*info*
%{_infodir}/binutils*info*
%files devel
%defattr(-,root,root,-)
%{_prefix}/include/*
%{_libdir}/lib*.a
%{_infodir}/bfd*info*
%changelog
* Sat Jan 09 2010 Robert Xu <robxu9@gmail.com> 2.20.51.0.2-5
- Modified files list to remove both %{_libdir}/libbfd.so and
- %{_libdir}/libopcodes.so
- I am forced to keep ldscripts in /usr/lib. Cheap fix for now...
* Tue Dec 29 2009 Robert Xu <robxu9@gmail.com> 2.20.51.0.2-2
- Removed gold... It does not build well, and would rather prefer gcc-c++
* Thu Dec 24 2009 Robert Xu <robxu9@gmail.com> 2.20.51.0.2-1
- COMPARISON with major distributions
- Added stuff, deleted stuff...
* Sun Nov 14 2009 Robert Xu <robxu9@gmail.com> 2.20-1
- Created Initial Spec File.