unsf.SlackBuild 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #!/bin/bash
  2. # Slackware build script for unsf
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # Upstream hasn't done a proper release since 1.0, we use latest git.
  6. # Use git2targz.sh to prepare source tarballs, when it's time to update.
  7. # 20211126 bkw: update for v1.1+git20201107
  8. cd $(dirname $0) ; CWD=$(pwd)
  9. PRGNAM=unsf
  10. VERSION=${VERSION:-1.1+git20201107}
  11. BUILD=${BUILD:-1}
  12. TAG=${TAG:-_SBo}
  13. PKGTYPE=${PKGTYPE:-tgz}
  14. if [ -z "$ARCH" ]; then
  15. case "$( uname -m )" in
  16. i?86) ARCH=i586 ;;
  17. arm*) ARCH=arm ;;
  18. *) ARCH=$( uname -m ) ;;
  19. esac
  20. fi
  21. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  22. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  23. exit 0
  24. fi
  25. TMP=${TMP:-/tmp/SBo}
  26. PKG=$TMP/package-$PRGNAM
  27. OUTPUT=${OUTPUT:-/tmp}
  28. if [ "$ARCH" = "i586" ]; then
  29. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  30. LIBDIRSUFFIX=""
  31. elif [ "$ARCH" = "i686" ]; then
  32. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  33. LIBDIRSUFFIX=""
  34. elif [ "$ARCH" = "x86_64" ]; then
  35. SLKCFLAGS="-O2 -fPIC"
  36. LIBDIRSUFFIX="64"
  37. else
  38. SLKCFLAGS="-O2"
  39. LIBDIRSUFFIX=""
  40. fi
  41. set -e
  42. rm -rf $PKG
  43. mkdir -p $TMP $PKG $OUTPUT
  44. cd $TMP
  45. rm -rf $PRGNAM-$VERSION
  46. tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
  47. cd $PRGNAM-$VERSION
  48. chown -R root:root .
  49. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  50. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  51. # upstream forgot to create include/ in the src, revisit this later.
  52. sed -i 's#include/\(libunsf\.h\)#\1#' CMakeLists.txt
  53. mkdir -p build
  54. cd build
  55. cmake \
  56. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  57. -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
  58. -DCMAKE_INSTALL_PREFIX=/usr \
  59. -DLIB_SUFFIX=${LIBDIRSUFFIX} \
  60. -DMAN_INSTALL_DIR=/usr/man \
  61. -DCMAKE_BUILD_TYPE=Release ..
  62. make
  63. make install/strip DESTDIR=$PKG
  64. cd ..
  65. # don't see a way to get cmake to skip the static lib/exe.
  66. rm -f $PKG/usr/bin/$PRGNAM-static $PKG/usr/lib$LIBDIRSUFFIX/*.a
  67. # install doesn't install the man page...
  68. mkdir -p $PKG/usr/man/man1/
  69. gzip -9c < $PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
  70. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  71. cp -a README* LICENSE $PKG/usr/doc/$PRGNAM-$VERSION
  72. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  73. mkdir -p $PKG/install
  74. cat $CWD/slack-desc > $PKG/install/slack-desc
  75. cd $PKG
  76. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE