Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • npl/system/binutils/binutils.SlackBuild

    raafe99e rc5c522c  
    1 #!/bin/bash
     1#!/bin/sh
     2
     3# Copyright 2005-2013  Patrick J. Volkerding, Sebeka, Minnesota, USA
     4# All rights reserved.
    25#
    3 # Automaticly created by importpackage v1.0
    4 # Imported from: http://mirrors.slackware.com/slackware/slackware-current/source/d/binutils/
    5 # Created at Tue Jan 31 22:11:28 CET 2017
    6 
    7 
    8 ########### source original slackbuild (hopefully we dont need to modify it)
    9 CWD=`pwd`
    10 set -e
    11 source ./binutils.SlackBuild.orig
    12 
     6# Redistribution and use of this script, with or without modification, is
     7# permitted provided that the following conditions are met:
     8#
     9# 1. Redistributions of this script must retain the above copyright
     10#    notice, this list of conditions and the following disclaimer.
     11#
     12#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
     13#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     14#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
     15#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     16#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     17#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     18#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     19#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     20#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
     21#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     22
     23# Modified 2011 by Eric Hameleers <alien at slackware.com> for ARM port.
     24
     25
     26PKGNAM=binutils
     27VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
     28BUILD=${BUILD:-1}
     29
     30# Automatically determine the architecture we're building on:
     31MARCH=$( uname -m )
     32if [ -z "$ARCH" ]; then
     33  case "$MARCH" in
     34    i?86)    export ARCH=i486 ;;
     35    armv7hl) export ARCH=$MARCH ;;
     36    arm*)    export ARCH=arm ;;
     37    # Unless $ARCH is already set, use uname -m for all other archs:
     38    *)       export ARCH=$MARCH ;;
     39  esac
     40fi
     41
     42NUMJOBS=${NUMJOBS:-" -j7 "}
     43
     44# Uncomment this to include the experimental gold linker:
     45GOLD=" --enable-gold=yes --enable-ld=default "
     46
     47# Set to ld.gold or ld.bfd:
     48DEFAULT_LD=ld.bfd
     49
     50# The --enable-initfini-array option was added in binutils-2.21.51.0.3.
     51# This option currently causes a world of hurt trying to compile glibc,
     52# and might break static libraries or cause other ill effects.  There
     53# is an upstream patch for glibc but it does not avoid all of the known
     54# problems (and there may be some unknown ones, too), so we will avoid
     55# introducing this feature for now.
     56# References:
     57# http://sourceware.org/bugzilla/show_bug.cgi?id=12343
     58# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46770
     59NO_INITFINI=" --disable-initfini-array "
     60
     61if [ "$ARCH" = "i486" ]; then
     62  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
     63  # The config option below is currently needed to compile on x86:
     64  WERROR="--enable-werror=no"
     65  LIBDIRSUFFIX=""
     66elif [ "$ARCH" = "i686" ]; then
     67  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
     68  # The config option below is currently needed to compile on x86:
     69  WERROR="--enable-werror=no"
     70  LIBDIRSUFFIX=""
     71elif [ "$ARCH" = "s390" ]; then
     72  SLKCFLAGS="-O2"
     73  LIBDIRSUFFIX=""
     74elif [ "$ARCH" = "x86_64" ]; then
     75  SLKCFLAGS="-O2 -fPIC"
     76  LIBDIRSUFFIX="64"
     77elif [ "$ARCH" = "armv7hl" ]; then
     78  SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16"
     79  LIBDIRSUFFIX=""
     80else
     81  SLKCFLAGS="-O2"
     82  LIBDIRSUFFIX=""
     83fi
     84
     85case "$ARCH" in
     86    arm*) TARGET=$ARCH-slackware-linux-gnueabi ;;
     87    *)    TARGET=$ARCH-slackware-linux ;;
     88esac
     89
     90CWD=$(pwd)
     91TMP=${TMP:-/tmp}
     92PKG=$TMP/package-binutils
     93
     94rm -rf $PKG
     95mkdir -p $TMP $PKG
     96
     97cd $TMP
     98rm -rf binutils-$VERSION
     99tar xvf $CWD/binutils-$VERSION.tar.xz || \
     100  tar xvf $CWD/binutils-$VERSION.tar.bz2 || exit 1
     101cd binutils-$VERSION
     102
     103# Export the demangle.h header file:
     104zcat $CWD/binutils.export.demangle.h.diff.gz | patch -p1 --verbose || exit 1
     105# Don't check to see if "config.h" was included in the installed headers:
     106zcat $CWD/binutils.no-config-h-check.diff.gz | patch -p1 --verbose || exit 1
     107
     108chown -R root:root .
     109find . \
     110  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
     111  -exec chmod 755 {} \; -o \
     112  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
     113  -exec chmod 644 {} \;
     114
     115# End of preparations
     116if echo "$*" | grep -qw -- --prep ; then
     117  exit 0
     118fi
     119
     120# Build for an x86 glibc2-based Linux system:
     121CFLAGS="$SLKCFLAGS" \
     122./configure \
     123  --prefix=/usr \
     124  --libdir=/usr/lib${LIBDIRSUFFIX} \
     125  --mandir=/usr/man \
     126  --infodir=/usr/info \
     127  --with-docdir=/usr/doc/binutils-$VERSION \
     128  --enable-shared \
     129  --enable-multilib \
     130  --enable-64-bit-bfd \
     131  --enable-plugins \
     132  --enable-threads \
     133  --enable-targets=i386-efi-pe,${TARGET},x86_64-slackware-linux \
     134  $GOLD \
     135  $NO_INITFINI \
     136  $WERROR \
     137  --build=$TARGET \
     138  || exit 1
     139
     140make clean || exit 1
     141make $NUMJOBS || make || exit 1
     142make install DESTDIR=$PKG || exit 1
     143
     144# "make install" skips this, but binutils.spec doesn't.  Sneaky, huh?
     145cp -a include/libiberty.h $PKG/usr/include/libiberty.h
     146
     147# Differentiate between BSD strings and GNU strings
     148( cd $PKG/usr/bin ; mv strings strings-GNU )
     149( cd $PKG/usr/man/man1 ; mv strings.1 strings-GNU.1 )
     150
     151# Move ldscripts to /usr/lib${LIBDIRSUFFIX}, and then put symlinks in place
     152mv $PKG/usr/${TARGET}/lib/ldscripts $PKG/usr/lib${LIBDIRSUFFIX}
     153( cd $PKG/usr/${TARGET}
     154  ln -s /usr/lib${LIBDIRSUFFIX}/ldscripts lib/ldscripts
     155  for FILE in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip ; do
     156    if [ -r "/usr/bin/$FILE" ]; then
     157      rm -f bin/$FILE
     158      ln -s /usr/bin/$FILE bin/$FILE
     159    fi
     160  done
     161)
     162
     163# If the requested default linker is present, make it the default:
     164# Set the link differently on the system to change the default at runtime.
     165if [ -r $PKG/usr/bin/$DEFAULT_LD ]; then
     166  ( cd $PKG/usr/bin ; rm -f ld ; ln -sf $DEFAULT_LD ld )
     167fi
     168     
     169find $PKG | xargs file | grep -e "executable" -e "shared object" \
     170  | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
     171
     172# Remove some unneeded man pages, and then compress the rest
     173rm -f $PKG/usr/man/man1/{dlltool,windres}.1
     174( cd $PKG/usr/man
     175  find . -type f -exec gzip -9 {} \;
     176  for i in $(find . -type l) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
     177)
     178
     179# Compress info pages
     180rm -f $PKG/usr/info/dir
     181gzip -9 $PKG/usr/info/*
     182
     183mkdir -p $PKG/usr/doc/binutils-$VERSION
     184cp \
     185  $CWD/release.binutils-* \
     186  COPYING* ChangeLog.linux MAI* README* \
     187  $PKG/usr/doc/binutils-$VERSION
     188
     189# If there's a ChangeLog, installing at least part of the recent history
     190# is useful, but don't let it get totally out of control:
     191if [ -r ChangeLog ]; then
     192  DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION)
     193  cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
     194  touch -r ChangeLog $DOCSDIR/ChangeLog
     195fi
     196
     197chown -R root:root $PKG/usr/doc/binutils-$VERSION
     198
     199# Add slack-desc:
     200mkdir -p $PKG/install
     201cat $CWD/slack-desc > $PKG/install/slack-desc
     202
     203cd $PKG
     204/sbin/makepkg -l y -c n $TMP/binutils-$VERSION-$ARCH-$BUILD.txz
     205
     206cat << EOF
     207
     208#############################
     209oprofile links to libbfd so
     210be sure to recompile that
     211#############################
     212
     213EOF
    13214
    14215############ make syn3 packages
    15216cd $CWD
    16217for PKG in /tmp/package-*; do
    17         NAME=`echo $PKG| sed 's/.*package-//'| sed 's/-/_/g'`
     218        NAME=`echo $PKG| sed 's/.*package-//'| sed 's/-/_/'`
    18219
    19220        #seperate dev-package
Note: See TracChangeset for help on using the changeset viewer.