glyr.SlackBuild 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. #!/bin/bash
  2. # Slackware build script for glyr
  3. # Copyright 2015, Andrew Strong, Blue Mountains Australia.
  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. # Now maintained by B. Watson <urchlay@slackware.uk>
  23. # 20180904 bkw: BUILD=2, fix lyricswiki
  24. # 20170302 bkw: use long-format github URL
  25. # 20170121 bkw:
  26. # - update for 1.0.10
  27. # 20160817 bkw:
  28. # - take over maintenance
  29. # - update for 1.0.9
  30. # - i486 => i586
  31. # - fix SLKCFLAGS use
  32. # - add missing docs
  33. # - make install/strip
  34. cd $(dirname $0) ; CWD=$(pwd)
  35. PRGNAM=glyr
  36. VERSION=${VERSION:-1.0.10}
  37. BUILD=${BUILD:-2}
  38. TAG=${TAG:-_SBo}
  39. PKGTYPE=${PKGTYPE:-tgz}
  40. if [ -z "$ARCH" ]; then
  41. case "$( uname -m )" in
  42. i?86) ARCH=i586 ;;
  43. arm*) ARCH=arm ;;
  44. *) ARCH=$( uname -m ) ;;
  45. esac
  46. fi
  47. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  48. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  49. exit 0
  50. fi
  51. TMP=${TMP:-/tmp/SBo}
  52. PKG=$TMP/package-$PRGNAM
  53. OUTPUT=${OUTPUT:-/tmp}
  54. if [ "$ARCH" = "i586" ]; then
  55. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  56. LIBDIRSUFFIX=""
  57. elif [ "$ARCH" = "i686" ]; then
  58. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  59. LIBDIRSUFFIX=""
  60. elif [ "$ARCH" = "x86_64" ]; then
  61. SLKCFLAGS="-O2 -fPIC"
  62. LIBDIRSUFFIX="64"
  63. else
  64. SLKCFLAGS="-O2"
  65. LIBDIRSUFFIX=""
  66. fi
  67. set -e
  68. rm -rf $PKG
  69. mkdir -p $TMP $PKG $OUTPUT
  70. cd $TMP
  71. rm -rf $PRGNAM-$VERSION
  72. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  73. cd $PRGNAM-$VERSION
  74. chown -R root:root .
  75. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  76. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  77. # 20180904 bkw: fix from upstream git, for the lyricswiki provider.
  78. patch -p1 < $CWD/94967c3.diff
  79. # upstream places -Os after the flags we provide, which undoes our -O2.
  80. sed -i "s,-Os,," CMakeLists.txt
  81. mkdir -p build
  82. cd build
  83. cmake \
  84. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  85. -DCMAKE_INSTALL_PREFIX=/usr \
  86. -DLIB_SUFFIX=${LIBDIRSUFFIX} \
  87. -DBUILD_SHARED_LIBS:BOOL=ON \
  88. -DCMAKE_BUILD_TYPE=Release ..
  89. make #VERBOSE=1 # in case you need to see the compile commands
  90. make install/strip DESTDIR=$PKG
  91. cd ..
  92. # README.html was generated from upstream's README.textile. include
  93. # pre-generated html file in build to avoid a dependency on
  94. # Formatter::HTML::Textile perl module. I could have generated plain
  95. # text, but the URLs don't show up in it. I didn't build the API
  96. # docs, but README.html has a link to them on the author's site.
  97. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  98. cp -a AUTHORS CHANGELOG COPYING state_of_providers.txt \
  99. $PKG/usr/doc/$PRGNAM-$VERSION
  100. cat $CWD/README.html > $PKG/usr/doc/$PRGNAM-$VERSION/README.html
  101. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  102. mkdir -p $PKG/install
  103. cat $CWD/slack-desc > $PKG/install/slack-desc
  104. cd $PKG
  105. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE