ralcgm.SlackBuild 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #!/bin/bash
  2. # Slackware build script for ralcgm
  3. # Written by B. Watson (urchlay@slackware.uk)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. cd $(dirname $0) ; CWD=$(pwd)
  6. PRGNAM=ralcgm
  7. VERSION=${VERSION:-3.50}
  8. BUILD=${BUILD:-1}
  9. TAG=${TAG:-_SBo}
  10. PKGTYPE=${PKGTYPE:-tgz}
  11. if [ -z "$ARCH" ]; then
  12. case "$( uname -m )" in
  13. i?86) ARCH=i586 ;;
  14. arm*) ARCH=arm ;;
  15. *) ARCH=$( uname -m ) ;;
  16. esac
  17. fi
  18. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  19. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  20. exit 0
  21. fi
  22. TMP=${TMP:-/tmp/SBo}
  23. PKG=$TMP/package-$PRGNAM
  24. OUTPUT=${OUTPUT:-/tmp}
  25. if [ "$ARCH" = "i586" ]; then
  26. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  27. LIBDIRSUFFIX=""
  28. elif [ "$ARCH" = "i686" ]; then
  29. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  30. LIBDIRSUFFIX=""
  31. elif [ "$ARCH" = "x86_64" ]; then
  32. SLKCFLAGS="-O2 -fPIC"
  33. LIBDIRSUFFIX="64"
  34. else
  35. SLKCFLAGS="-O2"
  36. LIBDIRSUFFIX=""
  37. fi
  38. set -e
  39. rm -rf $PKG
  40. mkdir -p $TMP $PKG $OUTPUT
  41. cd $TMP
  42. rm -rf $PRGNAM-$VERSION
  43. mkdir -p $PRGNAM-$VERSION
  44. cd $PRGNAM-$VERSION
  45. tar xvf $CWD/$PRGNAM-$VERSION.tar.Z
  46. chown -R root:root .
  47. # Departure from template here due to annoying perms in the tarball.
  48. find . -type d -exec chmod 755 {} \+
  49. find . -type f -exec chmod 644 {} \+
  50. # This SlackBuild owes a great debt to PLD Linux:
  51. # git://git.pld-linux.org/packages/ralcgm.git
  52. # Add "linux" as a supported OS.
  53. patch -p1 < $CWD/ralcgm-linux.patch
  54. # Patch was created by running the interactive config, then diffing against
  55. # the un-configured source. Also file locations were edited in mach.h.
  56. patch -p1 < $CWD/no_interactive_config.diff
  57. # Compiler warnings scare me.
  58. patch -p1 < $CWD/fix_warnings.diff
  59. # These 3 stanzas come from PLD's ralcgm.spec:
  60. # The genbez and genher tools need to be built with DATADIR set to ../data/
  61. make -j1 -C src COMPILE="gcc $SLKCFLAGS" cgmfile.o cgmerr.o genbez genher
  62. # ..everything else needs it as /usr/share/ralcgm/.
  63. sed -i '/^#define *DATADIR/s,"\..*,"/usr/share/ralcgm/",' include/mach.h
  64. # Clean up, then build for real.
  65. rm -f src/cgmfile.o src/cgmerr.o
  66. make -C src $PRGNAM cgmlib COMPILE="gcc $SLKCFLAGS"
  67. # Manual install, since the "install" script doesn't actually install.
  68. # Not sure that all the includes are necessary, but they shouldn't do
  69. # any harm.
  70. mkdir -p $PKG/usr/bin $PKG/usr/lib$LIBDIRSUFFIX $PKG/usr/man/man1 \
  71. $PKG/usr/share/$PRGNAM $PKG/usr/include/$PRGNAM
  72. install -s -oroot -groot -m0755 bin/$PRGNAM $PKG/usr/bin
  73. install -oroot -groot -m0644 bin/libcgm.a $PKG/usr/lib$LIBDIRSUFFIX
  74. install -oroot -groot -m0644 data/* $PKG/usr/share/$PRGNAM
  75. install -oroot -groot -m0644 include/* $PKG/usr/include/$PRGNAM
  76. gzip -9c < docs/$PRGNAM.man > $PKG/usr/man/man1/$PRGNAM.1.gz
  77. # The INSTALL actually has somewhat useful info.
  78. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  79. cp -a README docs/INSTALL examples $PKG/usr/doc/$PRGNAM-$VERSION
  80. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  81. mkdir -p $PKG/install
  82. cat $CWD/slack-desc > $PKG/install/slack-desc
  83. cd $PKG
  84. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE