mandoc.SlackBuild 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #!/bin/sh
  2. # Copyright (c) 2014-2017 LEVAI Daniel
  3. # Copyright 2017-2019 Hunter Sezen
  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
  8. # are met:
  9. # * Redistributions of source code must retain the above copyright notice
  10. # this list of conditions and the following disclaimer.
  11. # * Redistributions in binary form must reproduce the above copyright
  12. # notice, this list of conditions and the following disclaimer in the
  13. # documentation and/or other materials provided with the distribution.
  14. #
  15. # THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  16. # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17. # AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  18. # COPYRIGHT HOLDER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  19. # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  20. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  21. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  22. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  23. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  24. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. PRGNAM=mandoc
  26. VERSION=${VERSION:-1.14.5}
  27. BUILD=${BUILD:-1}
  28. TAG=${TAG:-_orb}
  29. if [ -z "$ARCH" ]; then
  30. case "$( uname -m )" in
  31. i?86) ARCH=i586 ;;
  32. arm*) ARCH=arm ;;
  33. *) ARCH=$( uname -m ) ;;
  34. esac
  35. fi
  36. CWD=$(pwd)
  37. TMP=${TMP:-/tmp/SBo}
  38. PKG=$TMP/package-$PRGNAM
  39. OUTPUT=${OUTPUT:-/tmp}
  40. if [ "$ARCH" = "i586" ]; then
  41. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  42. LIBDIRSUFFIX=""
  43. elif [ "$ARCH" = "i686" ]; then
  44. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  45. LIBDIRSUFFIX=""
  46. elif [ "$ARCH" = "x86_64" ]; then
  47. SLKCFLAGS="-O2 -fPIC"
  48. LIBDIRSUFFIX="64"
  49. else
  50. SLKCFLAGS="-O2"
  51. LIBDIRSUFFIX=""
  52. fi
  53. set -eu
  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.gz
  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 \
  63. -o -perm 511 \) -exec chmod 755 {} \; -o \
  64. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  65. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  66. cat > ./configure.local <<EOF
  67. MANPATH_DEFAULT="/usr/man:/usr/local/man"
  68. MANPATH_BASE="/usr/man"
  69. OSNAME="Slackware Linux"
  70. PREFIX="/usr"
  71. MANM_MAN="mandoc_man"
  72. MANM_MDOC="mandoc_mdoc"
  73. MANM_ROFF="mandoc_roff"
  74. BINM_SOELIM="msoelim"
  75. LN="ln -sf"
  76. CFLAGS="\${CFLAGS} $SLKCFLAGS"
  77. INSTALL_PROGRAM="\${INSTALL} -m 0755"
  78. INSTALL_LIB="\${INSTALL} -m 0644"
  79. INSTALL_MAN="\${INSTALL} -m 0644"
  80. INSTALL_DATA="\${INSTALL} -m 0644"
  81. EOF
  82. ./configure
  83. make
  84. make install \
  85. DESTDIR=$PKG \
  86. PREFIX=/usr \
  87. LIBDIR=/usr/lib${LIBDIRSUFFIX}
  88. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" |
  89. grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  90. find $PKG/usr/man -type f -exec gzip -9 {} \;
  91. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  92. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  93. cp -a TODO NEWS $PKG/usr/doc/$PRGNAM-$VERSION
  94. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  95. mkdir -p $PKG/install
  96. cat $CWD/slack-desc > $PKG/install/slack-desc
  97. cd $PKG
  98. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}