- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
npl/system/binutils/binutils.SlackBuild
rc5c522c raafe99e 1 #!/bin/sh 2 3 # Copyright 2005-2013 Patrick J. Volkerding, Sebeka, Minnesota, USA 4 # All rights reserved. 1 #!/bin/bash 5 2 # 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. 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 24 6 25 7 26 PKGNAM=binutils 27 VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} 28 BUILD=${BUILD:-1} 8 ########### source original slackbuild (hopefully we dont need to modify it) 9 CWD=`pwd` 10 set -e 11 source ./binutils.SlackBuild.orig 29 12 30 # Automatically determine the architecture we're building on:31 MARCH=$( uname -m )32 if [ -z "$ARCH" ]; then33 case "$MARCH" in34 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 esac40 fi41 42 NUMJOBS=${NUMJOBS:-" -j7 "}43 44 # Uncomment this to include the experimental gold linker:45 GOLD=" --enable-gold=yes --enable-ld=default "46 47 # Set to ld.gold or ld.bfd:48 DEFAULT_LD=ld.bfd49 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. There53 # is an upstream patch for glibc but it does not avoid all of the known54 # problems (and there may be some unknown ones, too), so we will avoid55 # introducing this feature for now.56 # References:57 # http://sourceware.org/bugzilla/show_bug.cgi?id=1234358 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=4677059 NO_INITFINI=" --disable-initfini-array "60 61 if [ "$ARCH" = "i486" ]; then62 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=""66 elif [ "$ARCH" = "i686" ]; then67 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=""71 elif [ "$ARCH" = "s390" ]; then72 SLKCFLAGS="-O2"73 LIBDIRSUFFIX=""74 elif [ "$ARCH" = "x86_64" ]; then75 SLKCFLAGS="-O2 -fPIC"76 LIBDIRSUFFIX="64"77 elif [ "$ARCH" = "armv7hl" ]; then78 SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16"79 LIBDIRSUFFIX=""80 else81 SLKCFLAGS="-O2"82 LIBDIRSUFFIX=""83 fi84 85 case "$ARCH" in86 arm*) TARGET=$ARCH-slackware-linux-gnueabi ;;87 *) TARGET=$ARCH-slackware-linux ;;88 esac89 90 CWD=$(pwd)91 TMP=${TMP:-/tmp}92 PKG=$TMP/package-binutils93 94 rm -rf $PKG95 mkdir -p $TMP $PKG96 97 cd $TMP98 rm -rf binutils-$VERSION99 tar xvf $CWD/binutils-$VERSION.tar.xz || \100 tar xvf $CWD/binutils-$VERSION.tar.bz2 || exit 1101 cd binutils-$VERSION102 103 # Export the demangle.h header file:104 zcat $CWD/binutils.export.demangle.h.diff.gz | patch -p1 --verbose || exit 1105 # Don't check to see if "config.h" was included in the installed headers:106 zcat $CWD/binutils.no-config-h-check.diff.gz | patch -p1 --verbose || exit 1107 108 chown -R root:root .109 find . \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 preparations116 if echo "$*" | grep -qw -- --prep ; then117 exit 0118 fi119 120 # Build for an x86 glibc2-based Linux system:121 CFLAGS="$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 1139 140 make clean || exit 1141 make $NUMJOBS || make || exit 1142 make install DESTDIR=$PKG || exit 1143 144 # "make install" skips this, but binutils.spec doesn't. Sneaky, huh?145 cp -a include/libiberty.h $PKG/usr/include/libiberty.h146 147 # Differentiate between BSD strings and GNU strings148 ( 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 place152 mv $PKG/usr/${TARGET}/lib/ldscripts $PKG/usr/lib${LIBDIRSUFFIX}153 ( cd $PKG/usr/${TARGET}154 ln -s /usr/lib${LIBDIRSUFFIX}/ldscripts lib/ldscripts155 for FILE in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip ; do156 if [ -r "/usr/bin/$FILE" ]; then157 rm -f bin/$FILE158 ln -s /usr/bin/$FILE bin/$FILE159 fi160 done161 )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.165 if [ -r $PKG/usr/bin/$DEFAULT_LD ]; then166 ( cd $PKG/usr/bin ; rm -f ld ; ln -sf $DEFAULT_LD ld )167 fi168 169 find $PKG | xargs file | grep -e "executable" -e "shared object" \170 | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null171 172 # Remove some unneeded man pages, and then compress the rest173 rm -f $PKG/usr/man/man1/{dlltool,windres}.1174 ( cd $PKG/usr/man175 find . -type f -exec gzip -9 {} \;176 for i in $(find . -type l) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done177 )178 179 # Compress info pages180 rm -f $PKG/usr/info/dir181 gzip -9 $PKG/usr/info/*182 183 mkdir -p $PKG/usr/doc/binutils-$VERSION184 cp \185 $CWD/release.binutils-* \186 COPYING* ChangeLog.linux MAI* README* \187 $PKG/usr/doc/binutils-$VERSION188 189 # If there's a ChangeLog, installing at least part of the recent history190 # is useful, but don't let it get totally out of control:191 if [ -r ChangeLog ]; then192 DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION)193 cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog194 touch -r ChangeLog $DOCSDIR/ChangeLog195 fi196 197 chown -R root:root $PKG/usr/doc/binutils-$VERSION198 199 # Add slack-desc:200 mkdir -p $PKG/install201 cat $CWD/slack-desc > $PKG/install/slack-desc202 203 cd $PKG204 /sbin/makepkg -l y -c n $TMP/binutils-$VERSION-$ARCH-$BUILD.txz205 206 cat << EOF207 208 #############################209 oprofile links to libbfd so210 be sure to recompile that211 #############################212 213 EOF214 13 215 14 ############ make syn3 packages 216 15 cd $CWD 217 16 for PKG in /tmp/package-*; do 218 NAME=`echo $PKG| sed 's/.*package-//'| sed 's/-/_/ '`17 NAME=`echo $PKG| sed 's/.*package-//'| sed 's/-/_/g'` 219 18 220 19 #seperate dev-package
Note: See TracChangeset
for help on using the changeset viewer.