avr-gcc.SlackBuild 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. #!/bin/bash
  2. # Slackware build script for avr-gcc
  3. # Written by Marek Buras <cyfr0n (at) go2 !dot pl>
  4. # Now maintained by thorsten <thorsten (dot) johannvorderbrueggen (at) t-online (dot) de>
  5. # This file is placed in the public domain.
  6. cd $(dirname $0) ; CWD=$(pwd)
  7. PRGNAM=avr-gcc
  8. VERSION=${VERSION:-10.2.0}
  9. ISLVERSION=${ISLVERSION:-0.22}
  10. BUILD=${BUILD:-1}
  11. TAG=${TAG:-_SBo}
  12. PKGTYPE=${PKGTYPE:-tgz}
  13. if [ -z "$ARCH" ]; then
  14. case "$( uname -m )" in
  15. i?86) ARCH=i586 ;;
  16. arm*) ARCH=arm ;;
  17. *) ARCH=$( uname -m ) ;;
  18. esac
  19. fi
  20. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  21. # the name of the created package would be, and then exit. This information
  22. # could be useful to other scripts.
  23. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  24. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  25. exit 0
  26. fi
  27. TMP=${TMP:-/tmp/SBo}
  28. PKG=$TMP/package-$PRGNAM
  29. OUTPUT=${OUTPUT:-/tmp}
  30. if [ "$ARCH" = "i586" ]; then
  31. SLKCFLAGS="-O2 -pipe"
  32. LIBDIRSUFFIX=""
  33. elif [ "$ARCH" = "i686" ]; then
  34. SLKCFLAGS="-O2 -pipe"
  35. LIBDIRSUFFIX=""
  36. elif [ "$ARCH" = "x86_64" ]; then
  37. SLKCFLAGS="-O2 -fPIC"
  38. LIBDIRSUFFIX="64"
  39. else
  40. SLKCFLAGS="-O2"
  41. LIBDIRSUFFIX=""
  42. fi
  43. set -e
  44. rm -rf $PKG
  45. mkdir -p $TMP/$PRGNAM $PKG $OUTPUT
  46. cd $TMP/$PRGNAM
  47. rm -rf $TMP/$PRGNAM/*
  48. tar xvf $CWD/gcc-$VERSION.tar.xz
  49. tar xvf $CWD/isl-$ISLVERSION.tar.bz2
  50. find -L . \
  51. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  52. -o -perm 511 \) -exec chmod 755 {} \; -o \
  53. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  54. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  55. cd gcc-$VERSION
  56. ln -s ../isl-$ISLVERSION isl
  57. mkdir ../avr-gcc-build-$VERSION
  58. cd ../avr-gcc-build-$VERSION
  59. export CFLAGS_FOR_TARGET="$SLKCFLAGS"
  60. export CXXFLAGS_FOR_TARGET="$SLKCFLAGS"
  61. ../gcc-$VERSION/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-install-libiberty \
  69. --disable-libssp \
  70. --disable-libstdcxx-pch \
  71. --disable-libunwind-exceptions \
  72. --disable-linker-build-id \
  73. --disable-nls \
  74. --disable-werror \
  75. --disable-__cxa_atexit \
  76. --enable-checking=release \
  77. --enable-clocale=gnu \
  78. --enable-cloog-backend=isl \
  79. --enable-gnu-unique-object \
  80. --enable-gnu-indirect-function \
  81. --enable-gold \
  82. --enable-languages=c,c++ \
  83. --enable-ld=default \
  84. --enable-lto \
  85. --enable-plugin \
  86. --enable-shared \
  87. --target=avr \
  88. --with-as=/usr/bin/avr-as \
  89. --with-gnu-as \
  90. --with-gnu-ld \
  91. --with-ld=/usr/bin/avr-ld \
  92. --with-plugin-ld=ld.gold \
  93. --with-system-zlib \
  94. --with-dwarf2 \
  95. --with-isl \
  96. --program-prefix="avr-" \
  97. --program-suffix="" \
  98. --build=$ARCH-slackware-linux
  99. make || exit 1
  100. make -j1 install DESTDIR=$PKG || exit 1
  101. # Remove useless stuff
  102. rm -rf $PKG/usr/lib${LIBDIRSUFFIX}/libiberty.a
  103. rm -rf $PKG/usr/lib${LIBDIRSUFFIX}/libcc1.*
  104. rm -rf $PKG/usr/info
  105. rm -rf $PKG/usr/include
  106. rm -rf $PKG/usr/share
  107. rm -rf $PKG/usr/man/man7
  108. rm -rf $PKG/usr/libexec/gcc/avr/$VERSION/install-tools
  109. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  110. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  111. find $PKG/usr/man -type f -exec gzip -9 {} \;
  112. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  113. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  114. for file in COPYING* ChangeLog MAINTAINERS NEWS README*; do
  115. cp ../gcc-$VERSION/$file $PKG/usr/doc/$PRGNAM-$VERSION
  116. done
  117. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  118. mkdir -p $PKG/install
  119. cat $CWD/slack-desc > $PKG/install/slack-desc
  120. cd $PKG
  121. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE