bgs.SlackBuild 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/bin/sh
  2. #
  3. # Slackware build script for bgs
  4. #
  5. # Copyright (C) 2023-2024 Ricardo García Jiménez <ricardogj08@riseup.net>
  6. #
  7. # This program is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. #
  20. PRGNAM=bgs
  21. VERSION=${VERSION:-git}
  22. SOURCE="https://github.com/Gottox/${PRGNAM}.${VERSION}"
  23. BUILD=${BUILD:-1}
  24. TAG=${TAG:-_rgj}
  25. PKGTYPE=${PKGTYPE:-tgz}
  26. NUMJOBS=${NUMJOBS:-"$(nproc)"}
  27. if [ -z "${ARCH}" ]; then
  28. case "$(uname -m)" in
  29. i?86) ARCH=i586 ;;
  30. arm*) ARCH=arm ;;
  31. *) ARCH=$(uname -m) ;;
  32. esac
  33. fi
  34. CWD=$(pwd)
  35. TMP=${TMP:-/tmp/build}
  36. PKG="${TMP}/package-${PRGNAM}"
  37. OUTPUT=${OUTPUT:-/tmp}
  38. set -e
  39. rm -rf "${PKG}"
  40. mkdir -p "${TMP}" "${PKG}" "${OUTPUT}"
  41. cd "${TMP}"
  42. rm -rf "${PRGNAM}"
  43. git clone "${SOURCE}"
  44. cd "${PRGNAM}"
  45. chown -R root:root .
  46. find -L . \
  47. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  48. -o -perm 511 \) -exec chmod 755 {} \; -o \
  49. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  50. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  51. make install \
  52. -j"${NUMJOBS}" \
  53. PREFIX=/usr \
  54. MANPREFIX=/usr/man \
  55. DESTDIR="${PKG}"
  56. find "${PKG}" -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  57. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  58. find "${PKG}/usr/man" -type f -exec gzip -9 {} \;
  59. mkdir -p "${PKG}/usr/doc/${PRGNAM}-${VERSION}"
  60. cp -a \
  61. LICENSE README \
  62. "${PKG}/usr/doc/${PRGNAM}-${VERSION}"
  63. cat "${CWD}/${PRGNAM}.SlackBuild" > "${PKG}/usr/doc/${PRGNAM}-${VERSION}/${PRGNAM}.SlackBuild"
  64. mkdir -p "${PKG}/install"
  65. cat "${CWD}/slack-desc" > "${PKG}/install/slack-desc"
  66. cd "${PKG}"
  67. /sbin/makepkg -l y -c n "${OUTPUT}/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.${PKGTYPE}"