guile1.8.SlackBuild 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. #!/bin/bash
  2. # Copyright 2013-2016 Willy Sudiarto Raharjo <willysr@slackbuilds.org>
  3. # All rights reserved.
  4. #
  5. # Redistribution and use of this script, with or without modification, is
  6. # permitted provided that the following conditions are met:
  7. #
  8. # 1. Redistributions of this script must retain the above copyright
  9. # notice, this list of conditions and the following disclaimer.
  10. #
  11. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
  12. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  14. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  16. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  17. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  18. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  19. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  20. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  21. cd $(dirname $0) ; CWD=$(pwd)
  22. PRGNAM=guile1.8
  23. SRCNAM=guile
  24. VERSION=${VERSION:-1.8.8}
  25. BUILD=${BUILD:-4}
  26. TAG=${TAG:-_SBo}
  27. PKGTYPE=${PKGTYPE:-tgz}
  28. if [ -z "$ARCH" ]; then
  29. case "$( uname -m )" in
  30. i?86) ARCH=i586 ;;
  31. arm*) ARCH=arm ;;
  32. *) ARCH=$( uname -m ) ;;
  33. esac
  34. fi
  35. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  36. # the name of the created package would be, and then exit. This information
  37. # could be useful to other scripts.
  38. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  39. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  40. exit 0
  41. fi
  42. TMP=${TMP:-/tmp/SBo}
  43. PKG=$TMP/package-$PRGNAM
  44. OUTPUT=${OUTPUT:-/tmp}
  45. if [ "$ARCH" = "i586" ]; then
  46. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  47. LIBDIRSUFFIX=""
  48. elif [ "$ARCH" = "i686" ]; then
  49. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  50. LIBDIRSUFFIX=""
  51. elif [ "$ARCH" = "x86_64" ]; then
  52. SLKCFLAGS="-O2 -fPIC"
  53. LIBDIRSUFFIX="64"
  54. else
  55. SLKCFLAGS="-O2"
  56. LIBDIRSUFFIX=""
  57. fi
  58. set -e
  59. rm -rf $PKG
  60. mkdir -p $TMP $PKG $OUTPUT
  61. cd $TMP
  62. rm -rf $SRCNAM-$VERSION
  63. tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
  64. cd $SRCNAM-$VERSION
  65. # fix segfault - thanks gentoo maintainers.
  66. patch -p1 -i $CWD/guile-1.8.8-gcc46.patch
  67. chown -R root:root .
  68. find -L . \
  69. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  70. -o -perm 511 \) -exec chmod 755 {} \; -o \
  71. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  72. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  73. CFLAGS="$SLKCFLAGS" \
  74. ./configure \
  75. --prefix=/usr \
  76. --libdir=/usr/lib${LIBDIRSUFFIX} \
  77. --infodir=/usr/info \
  78. --mandir=/usr/man \
  79. --with-threads \
  80. --program-suffix=1.8 \
  81. --disable-error-on-warning \
  82. --disable-static \
  83. --build=$ARCH-slackware-linux
  84. make -j1 LDFLAGS+="-lpthread"
  85. make install DESTDIR=$PKG
  86. rm -rf $PKG/usr/lib${LIBDIRSUFFIX}/*.la
  87. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  88. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  89. find $PKG/usr/man -type f -exec gzip -9 {} \;
  90. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  91. # Compress info files
  92. if [ -d $PKG/usr/info ]; then
  93. ( cd $PKG/usr/info
  94. rm -f dir
  95. gzip -9 *
  96. # rename it so that it will not overwrite Slackware's guile 2.0 package
  97. for i in {1..7}
  98. do
  99. mv guile.info-$i.gz guile1.8.info-$i.gz
  100. done
  101. mv guile.info.gz guile1.8.info.gz
  102. mv r5rs.info.gz r5rs1.8.info.gz
  103. )
  104. fi
  105. # Avoid duplicate with Slackware's guile.m4
  106. # It can detect newer (2.0) and older (1.8) version of guile installed on system
  107. mv $PKG/usr/share/aclocal/guile.m4 $PKG/usr/share/aclocal/guile18.m4
  108. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  109. cp -a AUTHORS COPYING* GUILE-VERSION HACKING INSTALL LICENSE NEWS README* THANKS \
  110. $PKG/usr/doc/$PRGNAM-$VERSION
  111. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  112. # Fix guile-config1.8 info
  113. sed -i '1s/guile/guile1.8/' -i $PKG/usr/bin/guile-config1.8
  114. mkdir -p $PKG/install
  115. cat $CWD/slack-desc > $PKG/install/slack-desc
  116. cd $PKG
  117. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE