biblesync.SlackBuild 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #!/bin/bash
  2. # Slackware build script for biblesync
  3. # Copyright (c) 2015/2020 Tim Dickson <dickson.tim@googlemail.com>
  4. #
  5. # Redistribution and use in source and binary forms, with or without
  6. # modification, are permitted provided that the following conditions are
  7. # met:
  8. #
  9. # * Redistributions of source code must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. # * Redistributions in binary form must reproduce the above
  12. # copyright notice, this list of conditions and the following disclaimer
  13. # in the documentation and/or other materials provided with the
  14. # distribution.
  15. # * Neither the name of the {company} nor the names of its
  16. # contributors may be used to endorse or promote products derived from
  17. # this software without specific prior written permission.
  18. #
  19. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  22. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  23. # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  24. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  25. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  27. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. cd $(dirname $0) ; CWD=$(pwd)
  31. PRGNAM=biblesync
  32. VERSION=${VERSION:-2.1.0}
  33. BUILD=${BUILD:-1}
  34. TAG=${TAG:-_SBo}
  35. PKGTYPE=${PKGTYPE:-tgz}
  36. if [ -z "$ARCH" ]; then
  37. case "$( uname -m )" in
  38. i?86) ARCH=i586 ;;
  39. arm*) ARCH=arm ;;
  40. *) ARCH=$( uname -m ) ;;
  41. esac
  42. fi
  43. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  44. # the name of the created package would be, and then exit. This information
  45. # could be useful to other scripts.
  46. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  47. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  48. exit 0
  49. fi
  50. TMP=${TMP:-/tmp/SBo}
  51. PKG=$TMP/package-$PRGNAM
  52. OUTPUT=${OUTPUT:-/tmp}
  53. DOCS="AUTHORS ChangeLog COPYING LICENSE README.md INSTALL WIRESHARK"
  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 . \
  76. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  77. -o -perm 511 \) -exec chmod 755 {} \; -o \
  78. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  79. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  80. cmake \
  81. -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
  82. -DBUILD_SHARED_LIBS=TRUE \
  83. -DCMAKE_INSTALL_PREFIX=/usr \
  84. -DLIBDIR=/usr/lib${LIBDIRSUFFIX} \
  85. -DCMAKE_BUILD_TYPE=Release
  86. make
  87. make install DESTDIR=$PKG
  88. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  89. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  90. mv $PKG/usr/share/man $PKG/usr/
  91. gzip $PKG/usr/man/man7/$PRGNAM.7
  92. #remove old man path
  93. rm -r $PKG/usr/share
  94. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  95. cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
  96. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  97. mkdir -p $PKG/install
  98. cat $CWD/slack-desc > $PKG/install/slack-desc
  99. cd $PKG
  100. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE