binutils/binutils.spec

Tue, 29 Mar 2011 20:04:34 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 29 Mar 2011 20:04:34 +0200
changeset 334
4a34d7a82eab
parent 69
84180bd0cb45
child 425
7543b0b3134d
permissions
-rw-r--r--

Rework package yet again, correcting and introducing new buildconf logic:
Conditionally disable bootstrap stage comparison correctly, correct
english grammar, better find system as(1) and ld(1), indotruce detailed
optimization option messages, more completely guess cpu types, allow
profiled bootstrapping without a preinstalled GCC because many other
compilers have long since implemented 64-bit arithmetic, instruct make
to build sequentially (not in sparallel) when building a profiled
bootstrap as GCC online documents recommend, and generally improve
comment blocks.

The single most important correction in this changeset relates to the
GCC changed optimization policy since at least GCC 4.5, in which -march
is always passed and not always correctly guessed. In the case of this
package, allowing GCC to guess the architecture leads to wild build
errors at various subcomponents (zlib, libgcc, libiberty...) and
bootstrap stages. It seems quite platform specific, and the safest
approach to correcting this seems to be explicitly always specifying the
-march argument when bootstrapping GCC. Because the best choice 'native'
is not available when bootstrapping using a foreign (non GCC) compiler,
a guess is made according to rpmmacros l_platform in that case.

It is questionable as to whether these recent optimization changes
on the part of GCC or this package are compatible with each other,
or if either are complete or correct at all. At least applying these
corrections allows this package to build again in most cases test.

michael@68 1 ##
michael@68 2 ## binutils.spec -- OpenPKG RPM Package Specification
michael@331 3 ## Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/>
michael@68 4 ##
michael@68 5 ## Permission to use, copy, modify, and distribute this software for
michael@68 6 ## any purpose with or without fee is hereby granted, provided that
michael@68 7 ## the above copyright notice and this permission notice appear in all
michael@68 8 ## copies.
michael@68 9 ##
michael@68 10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@68 11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@68 12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@68 13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@68 14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@68 15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@68 16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@68 17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@68 18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@68 19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@68 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@68 21 ## SUCH DAMAGE.
michael@68 22 ##
michael@68 23
michael@68 24 # package information
michael@68 25 Name: binutils
michael@68 26 Summary: GNU Binary Utilities
michael@68 27 URL: http://sources.redhat.com/binutils/
michael@68 28 Vendor: Free Software Foundation
michael@68 29 Packager: OpenPKG Foundation e.V.
michael@68 30 Distribution: OpenPKG Community
michael@68 31 Class: CORE
michael@68 32 Group: Compiler
michael@68 33 License: GPL
michael@331 34 Version: 2.21
michael@331 35 Release: 20101212
michael@68 36
michael@68 37 # list of sources
michael@68 38 Source0: ftp://sources.redhat.com/pub/binutils/releases/binutils-%{version}.tar.bz2
michael@68 39 Patch0: binutils.patch
michael@68 40
michael@68 41 # build information
michael@68 42 Prefix: %{l_prefix}
michael@68 43 BuildRoot: %{l_buildroot}
michael@331 44 BuildPreReq: OpenPKG, openpkg >= 20060823, make
michael@331 45 PreReq: OpenPKG, openpkg >= 20060823
michael@68 46 AutoReq: no
michael@68 47 AutoReqProv: no
michael@68 48
michael@68 49 %description
michael@68 50 Binutils is a collection of binary utilities. It includes: ld
michael@68 51 (the GNU linker), addr2line (converts addresses into filenames
michael@68 52 and line numbers), as (the portable GNU assembler), ar (a utility
michael@68 53 for creating, modifying and extracting from archives), nm (lists
michael@68 54 symbols from object files), objcopy (copys and translates object
michael@68 55 files), objdump (displays information from object files), ranlib
michael@68 56 (generates an index to the contents of an archive), readelf
michael@68 57 (displays information from any ELF format object file), size (lists
michael@68 58 the section sizes of an object or archive file), strings (lists
michael@68 59 printable strings from files), strip (discards symbols) and gprof
michael@68 60 (displays profiling information).
michael@68 61
michael@68 62 %track
michael@68 63 prog binutils = {
michael@68 64 version = %{version}
michael@68 65 url = ftp://sources.redhat.com/pub/binutils/releases/
michael@68 66 regex = binutils-(__VER__)\.tar\.bz2
michael@68 67 }
michael@68 68
michael@68 69 %prep
michael@68 70 %setup -q
michael@68 71 %patch -p0
michael@68 72
michael@68 73 %build
michael@68 74 # configure package
michael@68 75 CC="%{l_cc}"; export CC
michael@68 76 CFLAGS="%{l_cflags}"; export CFLAGS
michael@68 77 ARGS=""
michael@68 78 case "%{l_platform -t}" in
michael@68 79 *-freebsd* ) CFLAGS="$CFLAGS -DOPENPKG_OS_FREEBSD" ;;
michael@68 80 *-linux* ) CFLAGS="$CFLAGS -DOPENPKG_OS_LINUX" ;;
michael@68 81 *-sunos* ) CFLAGS="$CFLAGS -DOPENPKG_OS_SOLARIS" ;;
michael@68 82 *-aix* ) ARGS="$ARGS --without-gnu-as --without-gnu-ld" ;;
michael@68 83 *-darwin* ) ARGS="$ARGS --without-gnu-as --without-gnu-ld" ;;
michael@68 84 esac
michael@68 85 case "%{l_platform -t}" in
michael@68 86 amd64-sunos* ) ARGS="$ARGS --enable-64-bit-bdf" ;;
michael@68 87 esac
michael@68 88 ( echo "#!/bin/sh"
michael@68 89 echo "touch lex.yy.c"
michael@68 90 echo "echo 'lex.sh:WARNING: local Lex wrapper unexpectedly called.' 1>&2"
michael@68 91 ) >lex.sh && chmod a+x lex.sh
michael@68 92 echo "ac_cv_prog_LEX=`pwd`/lex.sh" >ld/config.cache
michael@68 93 INSTALL="%{l_shtool} install -c" \
michael@68 94 AR="%{l_ar}" \
michael@68 95 MAKE="%{l_make}" \
michael@68 96 CONFIG_SHELL="%{l_bash}" \
michael@68 97 ./configure \
michael@68 98 --prefix=%{l_prefix} \
michael@331 99 --mandir=%{l_prefix}/man \
michael@331 100 --infodir=%{l_prefix}/info \
michael@68 101 --includedir=%{l_prefix}/include/binutils \
michael@68 102 --libdir=%{l_prefix}/lib/binutils \
michael@68 103 --disable-werror \
michael@68 104 --disable-nls \
michael@68 105 $ARGS
michael@68 106
michael@68 107 # build package
michael@331 108 %{l_make} %{l_mflags} GREP="grep"
michael@68 109
michael@68 110 %install
michael@68 111 rm -rf $RPM_BUILD_ROOT
michael@68 112
michael@68 113 # build package
michael@68 114 %{l_make} %{l_mflags} install \
michael@68 115 prefix=$RPM_BUILD_ROOT%{l_prefix} \
michael@68 116 exec_prefix=$RPM_BUILD_ROOT%{l_prefix} \
michael@331 117 mandir=$RPM_BUILD_ROOT%{l_prefix}/man \
michael@331 118 infodir=$RPM_BUILD_ROOT%{l_prefix}/info \
michael@68 119 includedir=$RPM_BUILD_ROOT%{l_prefix}/include/binutils \
michael@68 120 libdir=$RPM_BUILD_ROOT%{l_prefix}/lib/binutils
michael@68 121
michael@68 122 # platform specific stripping down of installation:
michael@68 123 # o GNU binutils strip(1) is broken on AIX, use of OS supplied
michael@68 124 # /usr/bin/strip from bos.rte.bind_cmds is mandatory.
michael@68 125 # o GNU binutils strip(1), ar(1) and ranlib(1) do not work under
michael@68 126 # Mac OS X (aka Darwin), system versions have to be used.
michael@68 127 case "%{l_platform -t}" in
michael@68 128 *-aix* )
michael@68 129 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/strip \
michael@68 130 $RPM_BUILD_ROOT%{l_prefix}/man/man1/strip.1
michael@68 131 ;;
michael@68 132 *-darwin* )
michael@68 133 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/strip \
michael@68 134 $RPM_BUILD_ROOT%{l_prefix}/man/man1/strip.1
michael@68 135 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/ar \
michael@68 136 $RPM_BUILD_ROOT%{l_prefix}/man/man1/ar.1
michael@68 137 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/ranlib \
michael@68 138 $RPM_BUILD_ROOT%{l_prefix}/man/man1/ranlib.1
michael@68 139 ;;
michael@68 140 esac
michael@68 141
michael@68 142 # strip down installation
michael@68 143 rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
michael@68 144 rm -f $RPM_BUILD_ROOT%{l_prefix}/info/standards.info
michael@68 145 rm -f $RPM_BUILD_ROOT%{l_prefix}/info/configure.info*
michael@68 146 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/c++filt.1
michael@68 147 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/dlltool.1
michael@68 148 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/nlmconv.1
michael@68 149 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/windres.1
michael@331 150 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/windmc.1
michael@68 151 rm -rf $RPM_BUILD_ROOT%{l_prefix}/*-*-*
michael@68 152 rm -rf $RPM_BUILD_ROOT%{l_prefix}/bin/c++filt
michael@68 153 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
michael@68 154
michael@68 155 # determine installation files
michael@68 156 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
michael@68 157
michael@68 158 %files -f files
michael@68 159
michael@68 160 %clean
michael@68 161 rm -rf $RPM_BUILD_ROOT
michael@68 162

mercurial