astyle.SlackBuild 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #!/bin/bash
  2. # Slackware build script for Artistic Style
  3. # Copyright 2020 B. Watson <urchlay@slackware.uk>
  4. # Copyright 2017,2018 Nate Bargmann <email removed>
  5. # Ryan P.C. McQuen | Everett, WA | <email removed>
  6. # Formerly maintained by Daniel Jordan <email removed>
  7. # - updated version number
  8. # - added default variable options
  9. # - auto detect ARCH
  10. # - build and install shared libraries [bkw: say what?]
  11. #
  12. # Originally by Dugan Chen <email removed>
  13. # This program is free software; you can redistribute it and/or modify
  14. # it under the terms of the GNU General Public License as published by
  15. # the Free Software Foundation; either version 2 of the License, or
  16. # (at your option) any later version, with the following exception:
  17. # the text of the GPL license may be omitted.
  18. # This program is distributed in the hope that it will be useful, but
  19. # without any warranty; without even the implied warranty of
  20. # merchantability or fitness for a particular purpose. Compiling,
  21. # interpreting, executing or merely reading the text of the program
  22. # may result in lapses of consciousness and/or very being, up to and
  23. # including the end of all existence and the Universe as we know it.
  24. # See the GNU General Public License for more details.
  25. # You may have received a copy of the GNU General Public License
  26. # along with this program (most likely, a file named COPYING). If
  27. # not, see <http://www.gnu.org/licenses/>.
  28. # 20200113 bkw:
  29. # - Take over maintenance.
  30. # - Add man page and privacy patch, BUILD=2.
  31. # - Get rid of "shared" from make command. We weren't installing the
  32. # shared library anyway, despite the comment above from Daniel
  33. # Jordan. The only thing that lists astyle as a dependency is ebe,
  34. # and that's a runtime dep (it executes the astyle command, doesn't
  35. # link the shared lib). If someone needs the shared lib, I can add
  36. # it to the build, but for now I'm leaving it alone because the
  37. # .so isn't versioned (upgrades may cause breakage).
  38. # - Simplify and tweak the script.
  39. cd $(dirname $0) ; CWD=$(pwd)
  40. PRGNAM=astyle
  41. VERSION=${VERSION:-3.1}
  42. BUILD=${BUILD:-2}
  43. TAG=${TAG:-_SBo}
  44. PKGTYPE=${PKGTYPE:-tgz}
  45. TARBALL="astyle_${VERSION}_linux.tar.gz"
  46. if [ -z "$ARCH" ]; then
  47. case "$( uname -m )" in
  48. i?86) ARCH=i586 ;;
  49. arm*) ARCH=arm ;;
  50. *) ARCH=$( uname -m ) ;;
  51. esac
  52. fi
  53. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  54. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  55. exit 0
  56. fi
  57. TMP=${TMP:-/tmp/SBo}
  58. PKG=$TMP/package-$PRGNAM
  59. OUTPUT=${OUTPUT:-/tmp}
  60. if [ "$ARCH" = "i586" ]; then
  61. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  62. LIBDIRSUFFIX=""
  63. elif [ "$ARCH" = "i686" ]; then
  64. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  65. LIBDIRSUFFIX=""
  66. elif [ "$ARCH" = "x86_64" ]; then
  67. SLKCFLAGS="-O2 -fPIC"
  68. LIBDIRSUFFIX="64"
  69. else
  70. SLKCFLAGS="-O2"
  71. LIBDIRSUFFIX=""
  72. fi
  73. set -e
  74. rm -rf $PKG
  75. mkdir -p $TMP $PKG $OUTPUT
  76. cd $TMP
  77. rm -rf $PRGNAM
  78. tar xvf $CWD/$TARBALL
  79. cd $PRGNAM
  80. chown -R root:root .
  81. # Don't change this back to template please. Every file in the tarball
  82. # is +x, and *none* of them need to be.
  83. find -L . -type d -a -exec chmod 755 {} \+ -o \
  84. -type f -a -exec chmod 644 {} \+
  85. DOCDIR=$PKG/usr/doc/$PRGNAM-$VERSION
  86. # This patch (from Debian) prevents the user's browser from trying to
  87. # load images from sourceforge, when viewing the *local* HTML docs in
  88. # a browser.
  89. patch -p1 < $CWD/privacy.patch
  90. CFLAGS="$SLKCFLAGS -Wl,-s" \
  91. CXXFLAGS="$SLKCFLAGS -Wl,-s" \
  92. make -C build/gcc release
  93. make -C build/gcc install prefix=$PKG/usr SYSCONF_PATH=$DOCDIR
  94. # Man page borrowed from Debian. It's kind of a placeholder, will
  95. # expand it someday.
  96. mkdir -p $PKG/usr/man/man1
  97. sed -e "s|@VERSION@|$VERSION|" \
  98. -e "s|@DATE@|$( date +"%B %e, %Y" )|" \
  99. $CWD/$PRGNAM.1 | \
  100. gzip -9c > $PKG/usr/man/man1/$PRGNAM.1.gz
  101. cp -a *.md file $DOCDIR
  102. sed -i 's,\r,,' $DOCDIR/file/*
  103. cat $CWD/$PRGNAM.SlackBuild > $DOCDIR/$PRGNAM.SlackBuild
  104. mkdir -p $PKG/install
  105. cat $CWD/slack-desc > $PKG/install/slack-desc
  106. cd $PKG
  107. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE