manaplus.SlackBuild 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #!/bin/sh
  2. # Slackware build script for manaplus
  3. # Copyright 2018 Jefferson Rocha <lrcjefferson@gmail.com>
  4. # All rights reserved.
  5. #
  6. # Redistribution and use of this script, with or without modification, is
  7. # permitted provided that the following conditions are met:
  8. #
  9. # 1. Redistributions of this script must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. #
  12. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  13. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  15. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  17. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  18. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  19. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  20. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  21. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. PRGNAM=manaplus # replace with name of program
  23. VERSION=${VERSION:-1.8.9.1} # replace with version of program
  24. BUILD=${BUILD:-1}
  25. TAG=${TAG:-_SBo} # the "_SBo" is required
  26. EXTENSION='xz' # Extension source.
  27. # Automatically determine the architecture we're building on:
  28. if [ -z "$ARCH" ]; then
  29. case "$( uname -m )" in
  30. i?86) ARCH=i586 ;;
  31. arm*) ARCH=arm ;;
  32. # Unless $ARCH is already set, use uname -m for all other archs:
  33. *) ARCH=$( uname -m ) ;;
  34. esac
  35. fi
  36. CWD=$(pwd)
  37. TMP=${TMP:-/tmp/SBo} # For consistency's sake, use this
  38. PKG=$TMP/package-$PRGNAM
  39. OUTPUT=${OUTPUT:-/tmp} # Drop the package in /tmp
  40. # Select System Architecture.
  41. case "$ARCH" in
  42. i586)
  43. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  44. LIBDIRSUFFIX=""
  45. ;;
  46. i686)
  47. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  48. LIBDIRSUFFIX=""
  49. ;;
  50. x86_64)
  51. SLKCFLAGS="-O2 -fPIC"
  52. LIBDIRSUFFIX="64"
  53. ;;
  54. *)
  55. SLKCFLAGS="-O2"
  56. LIBDIRSUFFIX=""
  57. ;;
  58. esac
  59. # Exit on most errors
  60. set -e
  61. rm -rf $PKG
  62. mkdir -p $TMP $PKG $OUTPUT
  63. cd $TMP
  64. rm -rf $PRGNAM-
  65. tar xvf $CWD/$PRGNAM.tar.${EXTENSION}
  66. cd $PRGNAM-$VERSION
  67. chown -R root:root .
  68. find -L . \
  69. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  70. -o -perm 511 \) -exec chmod 755 {} \; -o \
  71. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  72. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  73. CFLAGS="$SLKCFLAGS" \
  74. CXXFLAGS="$SLKCFLAGS" \
  75. ./configure \
  76. --prefix=/usr \
  77. --libdir=/usr/lib${LIBDIRSUFFIX} \
  78. --sysconfdir=/etc \
  79. --localstatedir=/var \
  80. --mandir=/usr/man \
  81. --docdir=/usr/doc/$PRGNAM-$VERSION \
  82. --build=$ARCH-slackware-linux
  83. # Compile the application and install it into the $PKG directory
  84. make
  85. make install-strip DESTDIR=${PKG}
  86. # Compress man pages
  87. # If the man pages are installed to /usr/share/man instead, you'll need to either
  88. # add the --mandir=/usr/man flag to configure or move them manually after the
  89. # make install process is run.
  90. find $PKG/usr/man -type f -exec gzip -9 {} \;
  91. for i in $( find $PKG/usr/man -type l ) ; do
  92. ln -s $( readlink $i ).gz $i.gz
  93. rm $i
  94. done
  95. # Compress info pages and remove the package's dir file
  96. # If no info pages are installed by the software, don't leave this in the script
  97. rm -f $PKG/usr/info/dir
  98. # Remove perllocal.pod and other special files that don't need to be installed,
  99. # as they will overwrite what's already on the system. If this is not needed,
  100. # remove it from the script.
  101. # Remove 'special' files
  102. find $PKG -name perllocal.pod \
  103. -o -name ".packlist" \
  104. -o -name "*.bs" \
  105. | xargs rm -f
  106. # Documents
  107. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  108. cp -a AUTHORS COPYING README $PKG/usr/doc/$PRGNAM-$VERSION
  109. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  110. # Copy the slack-desc (and a custom doinst.sh if necessary) into ./install
  111. mkdir -p $PKG/install
  112. cat $CWD/slack-desc > $PKG/install/slack-desc
  113. cd $PKG
  114. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}