slackbuilds/e/mmm-mode/mmm-mode.SlackBuild
2011-07-22 08:41:46 +02:00

93 lines
2.3 KiB
Bash
Executable file

#!/bin/sh -x
# variables
VERSION=master_$(date +"%Y.%m.%d_%H.%M")
BUILD=1
TAG=cyco
OUTPUT=/tmp
TMP=/tmp/$TAG
CWD=$(pwd)
PRGNAM=mmm-mode
PKG=$TMP/pkg-$PRGNAM
ARCH=$(uname -m)
REPOSITORY=/home/installs/SlackBuilds/repositories/$PRGNAM
PREFIX=/usr
EMACS=$(basename $(ls /usr/bin/emacs-2*))
EMACS_VERSION=$(echo "$EMACS" | grep -o "\-[0-9\.]*\-" | tr -d - | head -n1)
# nettoyage préalable
rm -fr $PKG $TMP/$PRGNAM-$VERSION
mkdir -p $PKG
# mise en place
cd $TMP
if [ ! -e $REPOSITORY ] ; then
mkdir -p $(dirname $REPOSITORY)
cd $(dirname $REPOSITORY)
git clone "https://github.com/purcell/mmm-mode.git" $PRGNAM
else
cd $REPOSITORY
git pull
fi
cp -R $REPOSITORY $TMP/$PRGNAM-$VERSION
cd $TMP/$PRGNAM-$VERSION
./autogen.sh
./configure \
--prefix=/usr \
--infodir=/usr/info
make
make install DESTDIR=$PKG
rm $PKG/usr/info/dir
find $PKG/usr/info/* -type f -exec gzip -9 {} \;
# correction
cd $PKG
chown -R root:root *
# 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
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
$PRGNAM: $PRGNAM (MMM Mode for Emacs)
$PRGNAM:
$PRGNAM: MMM Mode is a minor mode for Emacs that allows Multiple Major Modes
$PRGNAM: to coexist in one buffer. It is well-suited to editing:
$PRGNAM: * Preprocessed code, such as server-side Perl or PHP embedded in
$PRGNAM: HTML
$PRGNAM: * Code generating code, such as HTML output by CGI scripts
$PRGNAM: * Embedded code, such as Javascript in HTML
$PRGNAM: * Literate programming: code interspersed with documentation,
$PRGNAM: e.g. Noweb
$PRGNAM:
$PRGNAM: https://github.com/purcell/mmm-mode
EOF
# empaquetage
makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz