xephem.SlackBuild 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #!/bin/bash
  2. # Slackware build script for xephem
  3. # Written by Dario Nicodemi dario.sbo@gmail.com
  4. cd $(dirname $0) ; CWD=$(pwd)
  5. PRGNAM=xephem
  6. VERSION=${VERSION:-3.7.7}
  7. BUILD=${BUILD:-1}
  8. TAG=${TAG:-_SBo}
  9. PKGTYPE=${PKGTYPE:-tgz}
  10. if [ -z "$ARCH" ]; then
  11. case "$( uname -m )" in
  12. i?86) ARCH=i586 ;;
  13. arm*) ARCH=arm ;;
  14. *) ARCH=$( uname -m ) ;;
  15. esac
  16. fi
  17. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  18. # the name of the created package would be, and then exit. This information
  19. # could be useful to other scripts.
  20. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  21. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  22. exit 0
  23. fi
  24. TMP=${TMP:-/tmp/SBo}
  25. PKG=$TMP/package-$PRGNAM
  26. OUTPUT=${OUTPUT:-/tmp}
  27. if [ "$ARCH" = "i586" ]; then
  28. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  29. LIBDIRSUFFIX=""
  30. elif [ "$ARCH" = "i686" ]; then
  31. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  32. LIBDIRSUFFIX=""
  33. elif [ "$ARCH" = "x86_64" ]; then
  34. SLKCFLAGS="-O2 -fPIC"
  35. LIBDIRSUFFIX="64"
  36. else
  37. SLKCFLAGS="-O2"
  38. LIBDIRSUFFIX=""
  39. fi
  40. set -e
  41. rm -rf $PKG
  42. mkdir -p $TMP $PKG $OUTPUT
  43. cd $TMP
  44. rm -rf $PRGNAM-$VERSION
  45. tar xvf $CWD/$PRGNAM-$VERSION.tgz
  46. cd $PRGNAM-$VERSION
  47. chown -R root:root .
  48. find -L . \
  49. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  50. -exec chmod 755 {} \; -o \
  51. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  52. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  53. sed -i 's/^CFLAGS=/override CFLAGS+=/g' libip/Makefile
  54. sed -i 's/^CFLAGS =/override CFLAGS +=/g' libpng/Makefile
  55. sed -i 's/^CFLAGS =/override CFLAGS +=/g' GUI/xephem/Makefile
  56. cd GUI/xephem
  57. patch -p3 < $CWD/00_trailmenu.patch
  58. make -j1 CFLAGS="$SLKCFLAGS" CLDFLAGS="" MOTIFL="/usr/lib$LIBDIRSUFFIX" || exit 1
  59. mkdir -p $PKG/usr/{bin,man/man1,share/xephem}
  60. cp xephem $PKG/usr/bin
  61. cp XEphem.png $PKG/usr/share/xephem
  62. cp -R auxil $PKG/usr/share/xephem
  63. cp -R catalogs $PKG/usr/share/xephem
  64. cp -R fifos $PKG/usr/share/xephem
  65. cp -R fits $PKG/usr/share/xephem
  66. cp -R gallery $PKG/usr/share/xephem
  67. cp -R help $PKG/usr/share/xephem
  68. cp -R lo $PKG/usr/share/xephem
  69. cp xephem.1 $PKG/usr/man/man1
  70. cd -
  71. # Install desktop file
  72. mkdir -p $PKG/usr/share/{applications,pixmaps}
  73. cat $CWD/xephem.desktop > $PKG/usr/share/applications/xephem.desktop
  74. cat $PKG/usr/share/xephem/XEphem.png > $PKG/usr/share/pixmaps/xephem.png
  75. # Install X defaults
  76. mkdir -p $PKG/etc/X11/app-defaults
  77. cat $CWD/XEphem > $PKG/etc/X11/app-defaults/XEphem.new
  78. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  79. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  80. ( cd $PKG/usr/man
  81. find . -type f -exec gzip -9 {} \;
  82. for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  83. )
  84. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  85. cp -a \
  86. Copyright INSTALL README \
  87. $PKG/usr/doc/$PRGNAM-$VERSION
  88. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  89. mkdir -p $PKG/install
  90. cat $CWD/slack-desc > $PKG/install/slack-desc
  91. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  92. cd $PKG
  93. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE