elixir.SlackBuild 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #!/bin/bash
  2. ## Copyright (C) 2016 Ryan S. Northrup <northrup@yellowapple.us>
  3. ## Permission is hereby granted, free of charge, to any person
  4. ## obtaining a copy of this software and associated documentation
  5. ## files (the "Software"), to deal in the Software without
  6. ## restriction, including without limitation the rights to use, copy,
  7. ## modify, merge, publish, distribute, sublicense, and/or sell copies
  8. ## of the Software, and to permit persons to whom the Software is
  9. ## furnished to do so, subject to the following conditions:
  10. ## The above copyright notice and this permission notice shall be
  11. ## included in all copies or substantial portions of the Software.
  12. ## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13. ## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14. ## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  15. ## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  16. ## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  17. ## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  18. ## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  19. ## SOFTWARE.
  20. ## Based on erlang-otp.SlackBuild, which was written by halflife
  21. ## (vzdorovenco@yahoo.com). Please **DO NOT** email halflife about
  22. ## this SlackBuild.
  23. cd $(dirname $0) ; CWD=$(pwd)
  24. PRGNAM=elixir
  25. VERSION=${VERSION:-1.11.3}
  26. BUILD=${BUILD:-1}
  27. TAG=${TAG:-_SBo}
  28. PKGTYPE=${PKGTYPE:-tgz}
  29. SRC_NAME_VERSION=elixir-${VERSION}
  30. if [ -z "$ARCH" ]; then
  31. case "$( uname -m )" in
  32. i?86) ARCH=i586 ;;
  33. arm*) ARCH=arm ;;
  34. *) ARCH=$( uname -m ) ;;
  35. esac
  36. fi
  37. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  38. # the name of the created package would be, and then exit. This information
  39. # could be useful to other scripts.
  40. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  41. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  42. exit 0
  43. fi
  44. TMP=${TMP:-/tmp/SBo}
  45. PKG=${PKG:-$TMP/package-$PRGNAM}
  46. OUTPUT=${OUTPUT:-/tmp}
  47. if [ "$ARCH" = "x86_64" ]; then
  48. LIBDIRSUFFIX="64"
  49. else
  50. LIBDIRSUFFIX=""
  51. fi
  52. set -e
  53. rm -rf $PKG
  54. mkdir -p $TMP $PKG $OUTPUT
  55. cd $TMP
  56. rm -rf $SRC_NAME_VERSION
  57. tar xvf $CWD/$SRC_NAME_VERSION.tar.gz
  58. cd $SRC_NAME_VERSION
  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. make
  66. make DESTDIR=$PKG PREFIX=/usr LIBDIR=lib${LIBDIRSUFFIX} install
  67. cd $PKG/usr/bin
  68. for file in elixir elixirc iex mix ; do
  69. rm -f $file
  70. ln -s ../lib${LIBDIRSUFFIX}/elixir/bin/$file .
  71. done
  72. cd -
  73. chown -R root:root $PKG/usr/lib${LIBDIRSUFFIX}/elixir
  74. chmod -R u+w,go+r-w,a-s $PKG/usr/lib${LIBDIRSUFFIX}/elixir
  75. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  76. for file in CHANGELOG.md CODE_OF_CONDUCT.md LICENSE \
  77. NOTICE README.md RELEASE.md SECURITY.md VERSION ; do
  78. cp $file $PKG/usr/doc/$PRGNAM-$VERSION
  79. done
  80. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  81. mv $PKG/usr/share/man $PKG/usr/man
  82. rmdir $PKG/usr/share
  83. find $PKG/usr/man -type f -exec gzip -9 {} \;
  84. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  85. mkdir -p $PKG/install
  86. cat $CWD/slack-desc > $PKG/install/slack-desc
  87. cd $PKG
  88. /sbin/makepkg -l y -c n -p $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE