slackbuilds/d/smalltalk/smalltalk.SlackBuild
2011-04-02 20:45:52 +07:00

101 lines
2.4 KiB
Bash
Executable file

#!/bin/sh -x
# variables
CWD=$(pwd)
PRGNAM=$(basename $CWD)
VERSION=3.2.4
ARCH=$(uname -m)
BUILD=1
TAG=cyco
TMP=/tmp/$TAG
PKG=$TMP/pkg-$PRGNAM
OUTPUT=/tmp
PREFIX=/usr
DOCS="ABOUT-NLS AUTHORS ChangeLog COPYING* INSTALL NEWS README THANKS TODO"
SLCKFLAGS="-O2"
case $ARCH in
"x86_64")
SLCKFLAGS="$SLCKFLAGS -fPIC"
;;
*)
esac
# nettoyage préalable
rm -fr $PKG $TMP/$PRGNAM-$VERSION
mkdir -p $PKG
# mise en place
cd $TMP
[ ! -e $CWD/$PRGNAM-$VERSION.tar.xz ] && \
wget -c ftp://ftp.gnu.org/gnu/smalltalk/$PRGNAM-$VERSION.tar.xz \
-O $CWD/$PRGNAM-$VERSION.tar.xz
tar xf $CWD/$PRGNAM-$VERSION.tar.xz
cd $TMP/$PRGNAM-$VERSION
# configuration
CCPFLAGS=$SLCKFLAGS \
CFLAGS=$SLCKFLAGS \
./configure \
--prefix=$PREFIX \
--mandir=$PREFIX/man \
--infodir=$PREFIX/info \
--docdir=$PREFIX/doc/$PRGNAM-$VERSION \
--includedir=$PREFIX/include \
--libdir=$PREFIX/lib$(echo $ARCH | grep -o 64) \
--enable-disassembler \
--enable-preemption
# compilation
make PREFIX=$PREFIX
# installation
make install DESTDIR=$PKG
# correction
chown -R root:root $PKG/*
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -R $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
[ -d $PKG/usr/man ] && find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;
[ -d $PKG/usr/info ] && find $PKG/usr/info -type f -name "*.info*" -exec gzip -9f {} \;
[ -d $PKG/usr/info ] && rm $PKG/usr/info/dir
# Strip binaries
find $PKG | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find $PKG | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
# embaumement
mkdir -p $PKG/install
cat <<EOF > $PKG/install/doinst.sh
cd /usr/info
[ -e dir ] && rm dir
[ -e dir.gz ] && rm dir.gz
[ -e dir.new ] && rm dir.new
for file in \$(ls *.gz | grep -v ".*\-[0-9]\+\.gz")
do
install-info \$file ./dir
done
EOF
cat <<EOF > $PKG/install/slack-desc
$PRGNAM: $PRGNAM (The Smalltalk for those who can type)
$PRGNAM:
$PRGNAM: GNU Smalltalk is a free implementation of the Smalltalk-80 language.
$PRGNAM: It runs on most POSIX compatible operating systems (including GNU/Linux,
$PRGNAM: of course), as well as under Windows. Smalltalk is a dynamic
$PRGNAM: object-oriented language, well-versed to scripting tasks.
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: http://smalltalk.gnu.org/
$PRGNAM:
EOF
# empaquetage
cd $PKG
makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | tr -d -)-$ARCH-$BUILD$TAG.txz