JSampler.SlackBuild 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #!/bin/bash
  2. # Slackware build script for JSampler
  3. # Copyright 2012 Klaatu klaatu@member.fsf.org
  4. #
  5. # GNU All-Permissive License
  6. #
  7. # Copying and distribution of this file, with or without modification,
  8. # are permitted in any medium without royalty provided the copyright
  9. # notice and this notice are preserved. This file is offered as-is,
  10. # without any warranty.
  11. # 20220331 bkw: Modified by SlackBuilds.org, BUILD=2:
  12. # - abort if JAVA_HOME not set and can't be set from /etc/profile.d.
  13. # this avoids creating a /jre in the package root.
  14. # - include an icon in the package, since there's a .desktop file.
  15. # - add a doinst.sh, needed for the icon and .desktop.
  16. # - include a wrapper script to launch from the command line.
  17. # Note: this really should be noarch, and should install the .jar file
  18. # to /usr/share/$PRGNAM. I don't have time to test such changes right now.
  19. cd $(dirname $0) ; CWD=$(pwd)
  20. PRGNAM=JSampler
  21. VERSION=${VERSION:-0.9}
  22. BUILD=${BUILD:-2}
  23. TAG=${TAG:-_SBo}
  24. PKGTYPE=${PKGTYPE:-tgz}
  25. if [ -z "$ARCH" ]; then
  26. case "$( uname -m )" in
  27. i?86) ARCH=i586 ;;
  28. arm*) ARCH=arm ;;
  29. *) ARCH=$( uname -m ) ;;
  30. esac
  31. fi
  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. THEME=${THEME:-fantasia}
  53. set -e
  54. rm -rf $PKG
  55. mkdir -p $TMP $PKG $OUTPUT
  56. cd $TMP
  57. rm -rf $PRGNAM-$VERSION
  58. tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
  59. cd $PRGNAM-$VERSION
  60. chown -R root:root .
  61. find -L . \
  62. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  63. -exec chmod 755 {} \+ -o \
  64. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  65. -exec chmod 644 {} \+
  66. if [ -z "$JAVA_HOME" ]; then
  67. source /etc/profile.d/zulu-openjdk8.sh
  68. fi
  69. if [ -z "$JAVA_HOME" ]; then
  70. cat <<EOF
  71. *** No JDK found. Install zulu-openjdk8 or another *jdk package and
  72. *** try again.
  73. EOF
  74. exit 1
  75. fi
  76. # make sure destdir exists
  77. mkdir -p $PKG/$JAVA_HOME/jre/bin/
  78. # does user have ant installed
  79. # if so then build from source. if not use prebuilt.
  80. if test -x != $(which ant)
  81. then ant build-$THEME
  82. cp dist/*-$VERSION.jar $PKG/$JAVA_HOME/jre/bin/
  83. else cp dist/Fantasia-$VERSION.jar $PKG/$JAVA_HOME/jre/bin/
  84. fi
  85. # create a .desktop file
  86. install -D -m 0644 $CWD/$PRGNAM.desktop \
  87. $PKG/usr/share/applications/$PRGNAM-$THEME.desktop
  88. echo -e "\nExec=java -jar $JAVA_HOME/jre/bin/$(echo "${THEME[@]^}")-0.9.jar" \
  89. >> $PKG/usr/share/applications/$PRGNAM-$THEME.desktop
  90. # 20220331 bkw: for those of us who don't use KDE or XFCE or want to:
  91. mkdir -p $PKG/usr/bin
  92. cat > $PKG/usr/bin/$PRGNAM <<EOF
  93. #!/bin/sh
  94. exec java -jar $JAVA_HOME/jre/bin/$(echo "${THEME[@]^}")-0.9.jar
  95. EOF
  96. chmod 0755 $PKG/usr/bin/$PRGNAM
  97. # 20220331 bkw: icon. should be multiple sizes in /usr/share/icons...
  98. mkdir -p $PKG/usr/share/pixmaps
  99. cat res/fantasia/icons/LinuxSampler-logo.png > $PKG/usr/share/pixmaps/$PRGNAM.png
  100. # docs
  101. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  102. cp -ar \
  103. licenses manual/html README \
  104. ChangeLog AUTHORS \
  105. $PKG/usr/doc/$PRGNAM-$VERSION
  106. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  107. mkdir -p $PKG/install
  108. cat $CWD/slack-desc > $PKG/install/slack-desc
  109. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  110. cd $PKG
  111. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE