slackbuilds/UNUSED/e/Pymacs/SlackBuild
2020-06-25 11:23:11 +02:00

96 lines
2.7 KiB
Bash
Executable file

#!/bin/sh
# variables
CWD=$(pwd)
PRGNAM=$(basename $CWD)
VERSION=0.24-beta2
ARCH=$(uname -m)
BUILD=1
TAG=gwh
TMP=/tmp/$TAG
PKG=$TMP/pkg-$PRGNAM
OUTPUT=/tmp
PREFIX=/usr
DOCS="ChangeLog COPYING PKG-INFO README THANKS TODO"
EMACS=$(basename $(ls /usr/bin/emacs-2*))
# nettoyage préalable
rm -fr $PKG $TMP/$PRGNAM-$VERSION
mkdir -p $PKG
# mise en place
( cd $TMP
[ ! -e $CWD/$PRGNAM-$VERSION.tar.?z* ] && \
wget -c --no-check-certificate https://github.com/pinard/Pymacs/tarball/v$VERSION \
-O $CWD/$PRGNAM-$VERSION.tar.gz
tar xf $CWD/$PRGNAM-$VERSION.tar.?z*
mv pinard-Pymacs-*/ $PRGNAM-$VERSION/
)
( cd $TMP/$PRGNAM-$VERSION
make
# installation
python setup.py install --root=$PKG
mkdir -p $PKG$PREFIX/share/emacs/site-lisp/
cp pymacs.el $PKG$PREFIX/share/emacs/site-lisp/
)
# correction
chown -R root:root $PKG/*
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
( cd $TMP/$PRGNAM-$VERSION
cp -R $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
[ ! -e $CWD/pymacs.html ] && \
wget -c http://pymacs.progiciels-bpi.ca/pymacs.html -O $CWD/pymacs.html
cp -R $CWD/pymacs.html $PKG/usr/doc/$PRGNAM-$VERSION
[ ! -e $CWD/pymacs.pdf ] && \
wget -c http://pymacs.progiciels-bpi.ca/pymacs.pdf -O $CWD/pymacs.pdf
cp -R $CWD/pymacs.pdf $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 (Emacs-lisp <-> Python)
$PRGNAM:
$PRGNAM: Pymacs is a powerful tool which, once started from Emacs, allows both-way
$PRGNAM: communication between Emacs Lisp and Python. Pymacs aims Python as an
$PRGNAM: extension language for Emacs rather than the other way around, and this
$PRGNAM: asymmetry is reflected in some design choices. Within Emacs Lisp code, one
$PRGNAM: may load and use Python modules. Python functions may themselves use Emacs
$PRGNAM: services, and handle Emacs Lisp objects kept in Emacs Lisp space.
$PRGNAM:
$PRGNAM: http://pymacs.progiciels-bpi.ca/
$PRGNAM:
EOF
# empaquetage
( cd $PKG
makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | tr -d -)-$ARCH-$BUILD$TAG.txz
)