qmapshack.SlackBuild 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #!/bin/bash
  2. # Slackware build script for qmapshack
  3. # Copyright 2015-2020 Daniel Stolarski <daniel.stolarski@gmail.com>
  4. #
  5. # This program is free software. It comes without any warranty, to
  6. # the extent permitted by applicable law. You can redistribute it
  7. # and/or modify it under the terms of the Do What The Fuck You Want
  8. # To Public License, Version 2, as published by Sam Hocevar. See
  9. # http://sam.zoy.org/wtfpl/COPYING for more details.
  10. cd $(dirname $0) ; CWD=$(pwd)
  11. PRGNAM=qmapshack
  12. VERSION=${VERSION:-1.16.1}
  13. BUILD=${BUILD:-1}
  14. TAG=${TAG:-_SBo}
  15. PKGTYPE=${PKGTYPE:-tgz}
  16. if [ -z "$ARCH" ]; then
  17. case "$( uname -m )" in
  18. i?86) ARCH=i586 ;;
  19. arm*) ARCH=arm ;;
  20. *) ARCH=$( uname -m ) ;;
  21. esac
  22. fi
  23. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  24. # the name of the created package would be, and then exit. This information
  25. # could be useful to other scripts.
  26. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  27. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  28. exit 0
  29. fi
  30. TMP=${TMP:-/tmp/SBo}
  31. PKG=$TMP/package-$PRGNAM
  32. OUTPUT=${OUTPUT:-/tmp}
  33. if [ "$ARCH" = "i586" ]; then
  34. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  35. LIBDIRSUFFIX=""
  36. elif [ "$ARCH" = "i686" ]; then
  37. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  38. LIBDIRSUFFIX=""
  39. elif [ "$ARCH" = "x86_64" ]; then
  40. SLKCFLAGS="-O2 -fPIC"
  41. LIBDIRSUFFIX="64"
  42. else
  43. SLKCFLAGS="-O2"
  44. LIBDIRSUFFIX=""
  45. fi
  46. set -e
  47. rm -rf $PKG
  48. mkdir -p $TMP $PKG $OUTPUT
  49. cd $TMP
  50. rm -rf $PRGNAM-V_${VERSION}
  51. tar xvf $CWD/${PRGNAM}-V_${VERSION}.tar.gz
  52. cd ${PRGNAM}-V_${VERSION}
  53. # cmake / autotools problem in proj package if proj switches to cmake in
  54. # future, cmake should be able to find proj here.
  55. # thanks debian maintainers
  56. zcat $CWD/proj.patch.gz | patch -p1
  57. chown -R root:root .
  58. find -L . \
  59. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  60. -o -perm 511 \) -exec chmod 755 {} \; -o \
  61. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  62. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  63. mkdir -p build
  64. cd build
  65. cmake \
  66. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  67. -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
  68. -DCMAKE_INSTALL_PREFIX=/usr \
  69. -DLIB_SUFFIX=${LIBDIRSUFFIX} \
  70. -DMAN_INSTALL_DIR=/usr/man \
  71. -DSYSCONF_INSTALL_DIR=/etc \
  72. -DCMAKE_BUILD_TYPE=Release ..
  73. make
  74. make install DESTDIR=$PKG
  75. cd ..
  76. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  77. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  78. # Move and compress man pages
  79. mv $PKG/usr/share/man $PKG/usr
  80. find $PKG/usr/man -type f -exec gzip -9 {} \;
  81. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  82. cp -a README.md changelog.txt LICENSE $PKG/usr/doc/$PRGNAM-$VERSION
  83. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  84. mkdir -p $PKG/install
  85. cat $CWD/slack-desc > $PKG/install/slack-desc
  86. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  87. cd $PKG
  88. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE