josm.SlackBuild 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/bin/bash
  2. # Slackware java packaging script for josm
  3. #
  4. # Michales - clavisound - Michaloudes korgie@gmail.com <2012-2017>
  5. #
  6. # For latest verion download
  7. # http://josm.openstreetmap.de/download/josm-tested.jar
  8. # execute the script with VERSION=tested
  9. cd $(dirname $0) ; CWD=$(pwd)
  10. PRGNAM=josm
  11. VERSION=${VERSION:-12450}
  12. BUILD=${BUILD:-1}
  13. TAG=${TAG:-_SBo}
  14. PKGTYPE=${PKGTYPE:-tgz}
  15. if [ -z "$ARCH" ]; then
  16. case "$( uname -m )" in
  17. i?86) ARCH=i586 ;;
  18. arm*) ARCH=arm ;;
  19. *) ARCH=$( uname -m ) ;;
  20. esac
  21. fi
  22. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  23. # the name of the created package would be, and then exit. This information
  24. # could be useful to other scripts.
  25. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  26. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  27. exit 0
  28. fi
  29. TMP=${TMP:-/tmp/SBo}
  30. PKG=$TMP/package-$PRGNAM
  31. OUTPUT=${OUTPUT:-/tmp}
  32. if [ "$ARCH" = "i586" ]; then
  33. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  34. LIBDIRSUFFIX=""
  35. elif [ "$ARCH" = "i686" ]; then
  36. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  37. LIBDIRSUFFIX=""
  38. elif [ "$ARCH" = "x86_64" ]; then
  39. SLKCFLAGS="-O2 -fPIC"
  40. LIBDIRSUFFIX="64"
  41. else
  42. SLKCFLAGS="-O2"
  43. LIBDIRSUFFIX=""
  44. fi
  45. set -e
  46. rm -rf $PKG
  47. mkdir -p $TMP $PKG $OUTPUT
  48. if [ "$VERSION" = "tested" ]; then
  49. SRCVER=tested
  50. VERSION=$(java -jar $CWD/$PRGNAM-tested.jar --version | sed -e 's/.*(//' -e 's/ .*//')
  51. else
  52. SRCVER=snapshot-$VERSION
  53. fi
  54. mkdir -p $PKG/opt/$PRGNAM
  55. cp $CWD/$PRGNAM-$SRCVER.jar $PKG/opt/$PRGNAM/$PRGNAM.jar
  56. mkdir -p $PKG/usr/bin
  57. cat > $PKG/usr/bin/$PRGNAM << EOF
  58. #!/bin/bash
  59. java -jar /opt/$PRGNAM/$PRGNAM.jar
  60. EOF
  61. chmod 755 $PKG/usr/bin/$PRGNAM
  62. chmod 755 $PKG/opt/$PRGNAM/$PRGNAM.jar
  63. # cp KDE desktop icon
  64. mkdir -p $PKG/usr/share/applications
  65. mkdir -p $PKG/usr/share/$PRGNAM
  66. cp $CWD/$PRGNAM.desktop $PKG/usr/share/applications
  67. mkdir -p $PKG/usr/share/icons/hicolor/160x160/apps/$PRGNAM/
  68. mkdir -p $PKG/usr/share/icons/hicolor/64x64/apps/$PRGNAM/
  69. cp $CWD/$PRGNAM\_160.xpm $PKG/usr/share/icons/hicolor/160x160/apps/$PRGNAM/$PRGNAM.xpm
  70. cp $CWD/$PRGNAM\_64.xpm $PKG/usr/share/icons/hicolor/64x64/apps/$PRGNAM/$PRGNAM.xpm
  71. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  72. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  73. mkdir -p $PKG/install
  74. cat $CWD/slack-desc > $PKG/install/slack-desc
  75. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  76. cd $PKG
  77. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE