avr-gdb.SlackBuild 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. #!/bin/bash
  2. # Slackware build script for avr-gdb
  3. # Written by thorsten
  4. cd $(dirname $0) ; CWD=$(pwd)
  5. PRGNAM=avr-gdb
  6. VERSION=${VERSION:-10.1}
  7. BUILD=${BUILD:-1}
  8. TAG=${TAG:-_SBo}
  9. PKGTYPE=${PKGTYPE:-tgz}
  10. if [ -z "$ARCH" ]; then
  11. case "$( uname -m )" in
  12. i?86) ARCH=i586 ;;
  13. arm*) ARCH=arm ;;
  14. *) ARCH=$( uname -m ) ;;
  15. esac
  16. fi
  17. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  18. # the name of the created package would be, and then exit. This information
  19. # could be useful to other scripts.
  20. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  21. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  22. exit 0
  23. fi
  24. TMP=${TMP:-/tmp/SBo}
  25. PKG=$TMP/package-$PRGNAM
  26. OUTPUT=${OUTPUT:-/tmp}
  27. if [ "$ARCH" = "i586" ]; then
  28. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  29. LIBDIRSUFFIX=""
  30. elif [ "$ARCH" = "i686" ]; then
  31. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  32. LIBDIRSUFFIX=""
  33. elif [ "$ARCH" = "x86_64" ]; then
  34. SLKCFLAGS="-O2 -fPIC"
  35. LIBDIRSUFFIX="64"
  36. else
  37. SLKCFLAGS="-O2"
  38. LIBDIRSUFFIX=""
  39. fi
  40. set -e
  41. rm -rf $PKG
  42. mkdir -p $TMP $PKG $OUTPUT
  43. cd $TMP
  44. rm -rf gdb-$VERSION avr-gdb-build-$VERSION
  45. tar xvf $CWD/gdb-$VERSION.tar.xz
  46. mkdir avr-gdb-build-$VERSION
  47. cd avr-gdb-build-$VERSION
  48. chown -R root:root .
  49. find -L . \
  50. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  51. -o -perm 511 \) -exec chmod 755 {} \; -o \
  52. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  53. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  54. CFLAGS_FOR_BUILD="$SLKCFLAGS" \
  55. CXXFLAGS_FOR_BUILD="$SLKCFLAGS" \
  56. ../gdb-$VERSION/configure \
  57. --prefix=/usr \
  58. --libdir=/usr/lib${LIBDIRSUFFIX} \
  59. --sysconfdir=/etc \
  60. --localstatedir=/var \
  61. --infodir=/usr/info \
  62. --mandir=/usr/man \
  63. --target=avr \
  64. --disable-nls \
  65. --enable-languages=c,c++ \
  66. --with-python=/usr/bin/python3 \
  67. --with-guile=guile-2.2 \
  68. --with-system-readline \
  69. --with-system-gdbinit=/etc/gdb/gdbinit \
  70. --program-prefix="avr-" \
  71. --program-suffix="" \
  72. --build=$ARCH-slackware-linux
  73. make
  74. make install DESTDIR=$PKG
  75. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  76. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  77. find $PKG/usr/man -type f -exec gzip -9 {} \;
  78. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  79. rm -f $PKG/usr/info/dir
  80. ( cd $PKG/usr/info
  81. for i in *; do mv $i avr-$i; gzip -9 avr-$i; done )
  82. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  83. for file in COPYING* ChangeLog MAINTAINERS README*; do
  84. cp ../gdb-$VERSION/$file $PKG/usr/doc/$PRGNAM-$VERSION
  85. done
  86. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  87. # Remove useless stuff
  88. rm -rf $PKG/usr/lib${LIBDIRSUFFIX}/libiberty.a
  89. rm -rf $PKG/usr/include/gdb
  90. rm -rf $PKG/usr/share/gdb
  91. rm -rf $PKG/usr/share/info
  92. rm -rf $PKG/usr/share/man
  93. mkdir -p $PKG/install
  94. cat $CWD/slack-desc > $PKG/install/slack-desc
  95. cd $PKG
  96. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE