b8c457fd37
Signed-off-by: Gwenhael Le moine <gwenhael.le.moine@gmail.com>
142 lines
4.5 KiB
Bash
Executable file
142 lines
4.5 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
# Copyright 2005-2009 Patrick J. Volkerding, Sebeka, Minnesota, USA
|
|
# Copyright 2010 Heinz Wiesinger, Amsterdam, The Netherlands
|
|
# All rights reserved.
|
|
#
|
|
# Redistribution and use of this script, with or without modification, is
|
|
# permitted provided that the following conditions are met:
|
|
#
|
|
# 1. Redistributions of this script must retain the above copyright
|
|
# notice, this list of conditions and the following disclaimer.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
SRCNAM=binutils
|
|
SRCVER=2.20.51.0.11
|
|
ARCH=${ARCH:-$(uname -m)}
|
|
CROSS=${CROSS:-armv5te}
|
|
BUILD=${BUILD:-1}
|
|
TAG=${TAG:-cyco}
|
|
|
|
PRGNAM=cross-$SRCNAM
|
|
VERSION=${SRCVER}_$CROSS
|
|
|
|
CWD=$(pwd)
|
|
TMP=${TMP:-/tmp/$TAG}
|
|
PKG=$TMP/package-$PRGNAM
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
if [ "$ARCH" = "i486" ]; then
|
|
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
|
|
LIBDIRSUFFIX=""
|
|
elif [ "$ARCH" = "s390" ]; then
|
|
SLKCFLAGS="-O2"
|
|
LIBDIRSUFFIX=""
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
SLKCFLAGS="-O2 -fPIC"
|
|
LIBDIRSUFFIX="64"
|
|
fi
|
|
|
|
set -e
|
|
|
|
rm -rf $PKG
|
|
mkdir -p $TMP $PKG
|
|
cd $TMP
|
|
rm -rf $SRCNAM-$SRCVER
|
|
tar xvf $CWD/$SRCNAM-$SRCVER.tar.?z*
|
|
cd $SRCNAM-$SRCVER
|
|
chown -R root:root .
|
|
find . \
|
|
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
|
-exec chmod 755 {} \; -o \
|
|
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
|
-exec chmod 644 {} \;
|
|
|
|
CFLAGS="$SLKCFLAGS" \
|
|
./configure \
|
|
--prefix=/opt/cross-$CROSS \
|
|
--libdir=/opt/cross-$CROSS/lib${LIBDIRSUFFIX} \
|
|
--mandir=/usr/man/ \
|
|
--with-docdir=/usr/doc/$PRGNAM-$VERSION \
|
|
--enable-shared \
|
|
--enable-multilib \
|
|
--enable-64-bit-bfd \
|
|
--enable-targets=$CROSS-slackware-linux \
|
|
--build=$ARCH-slackware-linux \
|
|
--target=$CROSS-slackware-linux
|
|
|
|
make clean
|
|
make
|
|
make install DESTDIR=$PKG
|
|
|
|
rm -fr $PKG/opt/cross-$CROSS/share/info
|
|
|
|
# "make install" skips this, but binutils.spec doesn't. Sneaky, huh?
|
|
cp -a include/libiberty.h \
|
|
$PKG/opt/cross-$CROSS/$ARCH-slackware-linux/$CROSS-slackware-linux/include/libiberty.h
|
|
|
|
## Differentiate between BSD strings and GNU strings
|
|
#mv $PKG/opt/cross-$CROSS/bin/$CROSS-slackware-linux-strings \
|
|
# $PKG/opt/cross-$CROSS/bin/$CROSS-slackware-linux-strings-GNU
|
|
#mv $PKG/usr/man/man1/$CROSS-slackware-linux-strings.1 \
|
|
# $PKG/usr/man/man1/$CROSS-slackware-linux-strings-GNU.1
|
|
|
|
# Move ldscripts to /usr/lib${LIBDIRSUFFIX}, and then put symlinks in place
|
|
mv $PKG/opt/cross-$CROSS/${CROSS}-slackware-linux/lib/ldscripts $PKG/opt/cross-$CROSS/lib${LIBDIRSUFFIX}
|
|
cd $PKG/opt/cross-$CROSS/${CROSS}-slackware-linux
|
|
ln -s /opt/cross-$CROSS/lib${LIBDIRSUFFIX}/ldscripts lib/ldscripts
|
|
for FILE in ar as ld nm objcopy objdump ranlib strip ; do
|
|
if [ -r "/opt/cross-$CROSS/bin/$FILE" ]; then
|
|
rm -f bin/$FILE
|
|
ln -s /opt/cross-$CROSS/bin/$CROSS-slackware-linux-$FILE bin/$FILE
|
|
fi
|
|
done
|
|
cd -
|
|
|
|
find $PKG | xargs file | grep -e "executable" -e "shared object" \
|
|
| grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
|
|
|
|
# Remove some unneeded man pages, and then compress the rest
|
|
rm -f $PKG/usr/man/man1/{dlltool,windres}.1
|
|
( cd $PKG/usr/man
|
|
find . -type f -exec gzip -9 {} \;
|
|
for i in $(find . -type l) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
|
|
)
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
|
cp \
|
|
$CWD/release.binutils-* \
|
|
COPYING* ChangeLog.linux MAI* README* \
|
|
$PKG/usr/doc/$PRGNAM-$VERSION
|
|
chown -R root:root $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
# Add slack-desc:
|
|
mkdir -p $PKG/install
|
|
cat <<EOF > $PKG/install/slack-desc
|
|
|-----handy-ruler------------------------------------------------------|
|
|
cross-binutils: cross-binutils ($CROSS cross compile binary development tools)
|
|
cross-binutils:
|
|
cross-binutils: This is a setup of binutils for cross compiling to $CROSS.
|
|
cross-binutils:
|
|
cross-binutils:
|
|
cross-binutils:
|
|
cross-binutils:
|
|
cross-binutils:
|
|
cross-binutils:
|
|
cross-binutils:
|
|
cross-binutils:
|
|
EOF
|
|
|
|
cd $PKG
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|
|
|