pd.SlackBuild 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #!/bin/bash
  2. # Slackware build script for Pure Data
  3. # Modified by by Ilya Dmitrichenko <errordeveloper-AT-gmail-DOT-com>
  4. # Modified by Robby Workman <rworkman@slackbuilds.org> with minor stuff:
  5. # -fix makefile patch to use DESTDIR correctly
  6. # -miscellanous script tweaks
  7. # No additional license terms
  8. # Modified by Michales Michaloudes <korgie@gmail.com> (2011)
  9. # - version bump
  10. # - desktop icon
  11. # - enable jack and portmidi
  12. # - include all .h files
  13. # - added SRCVERSION (2017)
  14. # - correct .desktop Exec (2017)
  15. cd $(dirname $0) ; CWD=$(pwd)
  16. PRGNAM=pd
  17. VERSION=${VERSION:-0.50_2}
  18. SRCVERSION=$(echo $VERSION | tr _ -)
  19. BUILD=${BUILD:-1}
  20. TAG=${TAG:-_SBo}
  21. PKGTYPE=${PKGTYPE:-tgz}
  22. if [ -z "$ARCH" ]; then
  23. case "$( uname -m )" in
  24. i?86) ARCH=i586 ;;
  25. arm*) ARCH=arm ;;
  26. *) ARCH=$( uname -m ) ;;
  27. esac
  28. fi
  29. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  30. # the name of the created package would be, and then exit. This information
  31. # could be useful to other scripts.
  32. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  33. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  34. exit 0
  35. fi
  36. TMP=${TMP:-/tmp/SBo}
  37. PKG=$TMP/package-$PRGNAM
  38. OUTPUT=${OUTPUT:-/tmp}
  39. if [ "$ARCH" = "i586" ]; then
  40. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  41. LIBDIRSUFFIX=""
  42. elif [ "$ARCH" = "i686" ]; then
  43. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  44. LIBDIRSUFFIX=""
  45. elif [ "$ARCH" = "x86_64" ]; then
  46. SLKCFLAGS="-O2 -fPIC"
  47. LIBDIRSUFFIX="64"
  48. else
  49. SLKCFLAGS="-O2"
  50. LIBDIRSUFFIX=""
  51. fi
  52. set -e
  53. rm -rf $PKG
  54. mkdir -p $TMP $PKG $OUTPUT
  55. cd $TMP
  56. rm -rf $PRGNAM-$SRCVERSION
  57. tar xvf $CWD/$PRGNAM-$SRCVERSION.src.tar.gz
  58. cd $PRGNAM-$SRCVERSION
  59. chown -R root:root .
  60. find -L . \
  61. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  62. -o -perm 511 \) -exec chmod 755 {} \; -o \
  63. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  64. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  65. ./autogen.sh
  66. CFLAGS="$SLKCFLAGS" \
  67. CXXFLAGS="$SLKCFLAGS" \
  68. ./configure \
  69. --prefix=/usr \
  70. --libdir=/usr/lib${LIBDIRSUFFIX} \
  71. --sysconfdir=/etc \
  72. --datadir=/usr/share/pd \
  73. --localstatedir=/var \
  74. --enable-alsa \
  75. --enable-setuid \
  76. --enable-jack \
  77. --disable-portaudio \
  78. --disable-portmidi
  79. make
  80. make install DESTDIR=$PKG
  81. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  82. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  83. # create and cp KDE desktop icon
  84. mkdir -p $PKG/usr/share/applications
  85. mkdir -p $PKG/usr/share/$PRGNAM
  86. # Change the .desktop to point in correct executable.
  87. sed "s+Exec=pd+Exec=/usr/lib${LIBDIRSUFFIX}/$PRGNAM/bin/$PRGNAM+" $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
  88. convert $TMP/$PRGNAM-$SRCVERSION/tcl/pd.ico $TMP/${PRGNAM}\_${SRCVERSION}.xpm
  89. cp $TMP/${PRGNAM}\_${SRCVERSION}-3.xpm $PKG/usr/share/$PRGNAM/${PRGNAM}\_${SRCVERSION}-3.xpm
  90. # copy all header files (for pd_mrpeach)
  91. cp -p $TMP/$PRGNAM-$SRCVERSION/src/*.h $PKG/usr/include/
  92. mv $PKG/usr/share/man $PKG/usr/man
  93. find $PKG/usr/man -type f -exec gzip -9 {} \;
  94. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  95. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  96. cp -a INSTALL.txt README.txt LICENSE.txt src/CHANGELOG.txt \
  97. $PKG/usr/doc/$PRGNAM-$VERSION
  98. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  99. # native documentation wants this
  100. ln -s /usr/lib/pd/doc/ $PKG/usr/doc/$PRGNAM-$VERSION/docs
  101. # pd-gui wants this:
  102. # Error in startup script: couldn't execute "/usr/lib64/pd/tcl/../bin/pd":
  103. # no such file or directory
  104. cd $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/bin/
  105. # remove bad (temp) link
  106. rm ./pd
  107. ln -s ../../../bin/$PRGNAM ./$PRGNAM
  108. mkdir -p $PKG/install
  109. cat $CWD/slack-desc > $PKG/install/slack-desc
  110. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  111. cd $PKG
  112. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE