eclipse-java.SlackBuild 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #!/bin/bash
  2. # Slackware build script for eclipse-java
  3. # Copyright (c) 2008-2010, Antonio Hernández Blas <hba.nihilismus@gmail.com>
  4. # All rights reserved.
  5. #
  6. # Redistribution and use in source and binary forms, with or without
  7. # modification, are permitted provided that the following conditions are met:
  8. # 1.- Redistributions of source code must retain the above copyright
  9. # notice, this list of conditions and the following disclaimer.
  10. #
  11. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
  12. # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  13. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  14. # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  15. # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  16. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  17. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  19. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  20. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  21. # Update by: Andre Barboza <bmg.andre@gmail.com>
  22. # Update by: Andrew Clemons <andrew.clemons@gmail.com>
  23. # Modified from classical eclipse slackbuild
  24. # This script is just a binary repackaging.
  25. cd $(dirname $0) ; CWD=$(pwd)
  26. PRGNAM=eclipse-java
  27. VERSION=${VERSION:-4.23}
  28. SRCVERSION=${SRCVERSION:-2022-03-R}
  29. BUILD=${BUILD:-1}
  30. TAG=${TAG:-_SBo}
  31. PKGTYPE=${PKGTYPE:-tgz}
  32. if [ -z "$ARCH" ]; then
  33. case "$( uname -m )" in
  34. i?86) ARCH=i586 ;;
  35. arm*) ARCH=arm ;;
  36. *) ARCH=$( uname -m ) ;;
  37. esac
  38. fi
  39. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  40. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  41. exit 0
  42. fi
  43. TMP=${TMP:-/tmp/SBo}
  44. PKG=$TMP/package-$PRGNAM
  45. OUTPUT=${OUTPUT:-/tmp}
  46. set -e
  47. rm -rf $PKG
  48. mkdir -p $TMP $PKG/opt/$PRGNAM $OUTPUT
  49. cd $PKG/opt/$PRGNAM
  50. # Untar source code tarball according with ARCH value
  51. # ARCH can only be 'x86_64'
  52. if [ "$ARCH" = "x86_64" ]; then
  53. tar --strip-components=1 -xvf $CWD/$PRGNAM-$SRCVERSION-linux-gtk-$ARCH.tar.gz
  54. else
  55. printf "$ARCH is not supported...\n"
  56. exit 1
  57. fi
  58. chown -R root:root .
  59. find -L . \
  60. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  61. -o -perm 511 \) -exec chmod 755 {} \; -o \
  62. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  63. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  64. # Add a wrapper to run eclipse in /usr/bin
  65. # Its going to change the working directory to $HOME, so when you import/export
  66. # into/from eclipse $HOME is going to be the default directory, rather than
  67. # /opt/eclipse.
  68. mkdir -p $PKG/usr/bin
  69. cat << EOF > $PKG/usr/bin/$PRGNAM
  70. #!/bin/sh
  71. cd \$HOME
  72. /opt/$PRGNAM/eclipse \$@
  73. EOF
  74. chmod 0755 $PKG/usr/bin/$PRGNAM
  75. # Add eclipse to KDE/GNOME/XFCE menu and install an icon for them
  76. install -D -m 0644 $CWD/$PRGNAM.desktop $PKG/usr/share/applications/$PRGNAM.desktop
  77. ECLIPSE_ICON=$(find . -name "*eclipse48.png" | grep "org.eclipse.platform")
  78. install -D -m 0644 "$PKG/opt/$PRGNAM/${ECLIPSE_ICON}" \
  79. $PKG/usr/share/pixmaps/$PRGNAM.png
  80. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  81. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  82. # Don't clobber any existing config file
  83. mv $PKG/opt/$PRGNAM/configuration/config.ini $PKG/opt/$PRGNAM/configuration/config.ini.new
  84. mv $PKG/opt/$PRGNAM/eclipse.ini $PKG/opt/$PRGNAM/eclipse.ini.new
  85. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  86. cd $PKG/opt/$PRGNAM
  87. cp -a readme/*.html $PKG/usr/doc/$PRGNAM-$VERSION
  88. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  89. mkdir -p $PKG/install
  90. cat $CWD/slack-desc > $PKG/install/slack-desc
  91. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  92. cd $PKG
  93. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE