avr-binutils.SlackBuild 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #!/bin/bash
  2. # Slackware build script for avr-binutils
  3. # Written by Marek Buras <cyfr0n (at) go2 !dot pl>
  4. # Previously maintained by Vliegendehuiskat <vliegendehuiskat [at] gmail [dot] com>
  5. # Previously maintained by Claudio Henrique Fortes Felix <felix.claudio [at] gmail [dot] com>
  6. # Now maintained by Heiko Rosemann <heiko [dot] rosemann [at] web [dot] de>
  7. # This file is placed in the public domain.
  8. cd $(dirname $0) ; CWD=$(pwd)
  9. PRGNAM=avr-binutils
  10. VERSION=${VERSION:-2.38}
  11. BUILD=${BUILD:-1}
  12. TAG=${TAG:-_SBo}
  13. PKGTYPE=${PKGTYPE:-tgz}
  14. if [ -z "$ARCH" ]; then
  15. case "$( uname -m )" in
  16. i?86) ARCH=i586 ;;
  17. arm*) ARCH=arm ;;
  18. *) ARCH=$( uname -m ) ;;
  19. esac
  20. fi
  21. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  22. # the name of the created package would be, and then exit. This information
  23. # could be useful to other scripts.
  24. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  25. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  26. exit 0
  27. fi
  28. TMP=${TMP:-/tmp/SBo}
  29. PKG=$TMP/package-$PRGNAM
  30. OUTPUT=${OUTPUT:-/tmp}
  31. if [ "$ARCH" = "i586" ]; then
  32. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  33. LIBDIRSUFFIX=""
  34. elif [ "$ARCH" = "i686" ]; then
  35. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  36. LIBDIRSUFFIX=""
  37. elif [ "$ARCH" = "x86_64" ]; then
  38. SLKCFLAGS="-O2 -fPIC"
  39. LIBDIRSUFFIX="64"
  40. else
  41. SLKCFLAGS="-O2"
  42. LIBDIRSUFFIX=""
  43. fi
  44. set -e
  45. rm -rf $PKG
  46. mkdir -p $TMP $PKG $OUTPUT
  47. cd $TMP
  48. rm -rf binutils-$VERSION
  49. tar xvf $CWD/binutils-$VERSION.tar.?z*
  50. cd binutils-$VERSION
  51. chown -R root:root .
  52. find -L . \
  53. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  54. -o -perm 511 \) -exec chmod 755 {} \; -o \
  55. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  56. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  57. # Apply patch for AVR specific output of 'size' (avr-size)
  58. patch -p1 < $CWD/avr-size.patch
  59. CFLAGS="$SLKCFLAGS" \
  60. CXXFLAGS="$SLKCFLAGS" \
  61. ./configure \
  62. --prefix=/usr \
  63. --libdir=/usr/lib${LIBDIRSUFFIX} \
  64. --sysconfdir=/etc \
  65. --localstatedir=/var \
  66. --infodir=/usr/info \
  67. --mandir=/usr/man \
  68. --disable-nls \
  69. --disable-werror \
  70. --target=avr \
  71. --with-gnu-ld \
  72. --with-gnu-as \
  73. --with-dwarf2 \
  74. --enable-install-libbfd \
  75. --enable-ld=default \
  76. --enable-gold \
  77. --enable-plugins \
  78. --enable-threads \
  79. --with-pic \
  80. --enable-shared \
  81. --disable-multilib \
  82. --program-prefix="avr-" \
  83. --program-suffix="" \
  84. --build=$ARCH-slackware-linux
  85. make
  86. make install DESTDIR=$PKG
  87. # Remove useless stuff
  88. rm -rf $PKG/usr/lib${LIBDIRSUFFIX}
  89. rm -rf $PKG/usr/info
  90. rm -f $PKG/usr/man/man1/avr-dlltool.1
  91. rm -f $PKG/usr/man/man1/avr-nlmconv.1
  92. rm -f $PKG/usr/man/man1/avr-windres.1
  93. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  94. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  95. find $PKG/usr/man -type f -exec gzip -9 {} \;
  96. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  97. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  98. cp -a COPYING* ChangeLog MAINTAINERS README* \
  99. $PKG/usr/doc/$PRGNAM-$VERSION
  100. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  101. mkdir -p $PKG/install
  102. cat $CWD/slack-desc > $PKG/install/slack-desc
  103. cd $PKG
  104. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE