- 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. 2 5 # 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 26 PKGNAM=binutils 27 VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} 28 BUILD=${BUILD:-1} 29 30 # Automatically determine the architecture we're building on: 31 MARCH=$( uname -m ) 32 if [ -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 40 fi 41 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.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 59 NO_INITFINI=" --disable-initfini-array " 60 61 if [ "$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="" 66 elif [ "$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="" 71 elif [ "$ARCH" = "s390" ]; then 72 SLKCFLAGS="-O2" 73 LIBDIRSUFFIX="" 74 elif [ "$ARCH" = "x86_64" ]; then 75 SLKCFLAGS="-O2 -fPIC" 76 LIBDIRSUFFIX="64" 77 elif [ "$ARCH" = "armv7hl" ]; then 78 SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16" 79 LIBDIRSUFFIX="" 80 else 81 SLKCFLAGS="-O2" 82 LIBDIRSUFFIX="" 83 fi 84 85 case "$ARCH" in 86 arm*) TARGET=$ARCH-slackware-linux-gnueabi ;; 87 *) TARGET=$ARCH-slackware-linux ;; 88 esac 89 90 CWD=$(pwd) 91 TMP=${TMP:-/tmp} 92 PKG=$TMP/package-binutils 93 94 rm -rf $PKG 95 mkdir -p $TMP $PKG 96 97 cd $TMP 98 rm -rf binutils-$VERSION 99 tar xvf $CWD/binutils-$VERSION.tar.xz || \ 100 tar xvf $CWD/binutils-$VERSION.tar.bz2 || exit 1 101 cd binutils-$VERSION 102 103 # Export the demangle.h header file: 104 zcat $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: 106 zcat $CWD/binutils.no-config-h-check.diff.gz | patch -p1 --verbose || exit 1 107 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 preparations 116 if echo "$*" | grep -qw -- --prep ; then 117 exit 0 118 fi 119 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 1 139 140 make clean || exit 1 141 make $NUMJOBS || make || exit 1 142 make install DESTDIR=$PKG || exit 1 143 144 # "make install" skips this, but binutils.spec doesn't. Sneaky, huh? 145 cp -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 152 mv $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. 165 if [ -r $PKG/usr/bin/$DEFAULT_LD ]; then 166 ( cd $PKG/usr/bin ; rm -f ld ; ln -sf $DEFAULT_LD ld ) 167 fi 168 169 find $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 173 rm -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 180 rm -f $PKG/usr/info/dir 181 gzip -9 $PKG/usr/info/* 182 183 mkdir -p $PKG/usr/doc/binutils-$VERSION 184 cp \ 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: 191 if [ -r ChangeLog ]; then 192 DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION) 193 cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog 194 touch -r ChangeLog $DOCSDIR/ChangeLog 195 fi 196 197 chown -R root:root $PKG/usr/doc/binutils-$VERSION 198 199 # Add slack-desc: 200 mkdir -p $PKG/install 201 cat $CWD/slack-desc > $PKG/install/slack-desc 202 203 cd $PKG 204 /sbin/makepkg -l y -c n $TMP/binutils-$VERSION-$ARCH-$BUILD.txz 205 206 cat << EOF 207 208 ############################# 209 oprofile links to libbfd so 210 be sure to recompile that 211 ############################# 212 213 EOF 13 214 14 215 ############ make syn3 packages 15 216 cd $CWD 16 217 for PKG in /tmp/package-*; do 17 NAME=`echo $PKG| sed 's/.*package-//'| sed 's/-/_/ g'`218 NAME=`echo $PKG| sed 's/.*package-//'| sed 's/-/_/'` 18 219 19 220 #seperate dev-package
Note: See TracChangeset
for help on using the changeset viewer.