slackbuilds/e/magit/magit.SlackBuild
2010-09-09 15:01:04 +07:00

102 lines
2.9 KiB
Bash
Executable file

#!/bin/sh -x
# variables
BRANCH=master
VERSION=${VERSION:-${BRANCH}_$(date +"%Y.%m.%d_%H.%M")}
ARCH=${ARCH:-$(uname -m)}
BUILD=${BUILD:-1}
PACKAGER=cyco
TMP=/tmp/$PACKAGER
OUTPUT=/tmp
CWD=$(pwd)
PRGNAM=$(basename $CWD)
PKG=$TMP/$PACKAGER/pkg-$PRGNAM
REPOSITORY=/home/cycojesus/projets/packages/repositories/$PRGNAM
PREFIX=/usr
EMACS=$(basename $(ls /usr/bin/emacs-2*))
EMACS_VERSION=$(echo "$EMACS" | grep -o "[0-9\.]*")
# 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 http://github.com/philjackson/magit.git $PRGNAM
fi
( cd $REPOSITORY
git pull
)
cp -R $REPOSITORY $TMP/$PRGNAM-$VERSION
( cd $TMP/$PRGNAM-$VERSION
sed -i 's|/share/info|/info|g' Makefile
make PREFIX=$PREFIX
make PREFIX=$PREFIX DESTDIR=$PKG install
)
# correction
( cd $PKG
chown -R root:root *
[ -d $PKG/usr/man ] && find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;
rm $PKG$PREFIX/info/dir
[ -d $PKG/usr/info ] && find $PKG/usr/info -type f -name "*" -exec gzip -9f {} \;
[ -d $PKG$PREFIX/share/emacs/site-lisp ] && \
find $PKG$PREFIX/share/emacs/site-lisp -type f -name "*.el" -exec gzip -9f {} \;
# magit wants to install etc/emacs/site-start.d/50magit.el which seems to be a debianism
# and I think it sucks, so rm
# it'll be in $PKG/usr/doc/$PRGNAM-$VERSION/ if you want it
rm -r $PKG/etc
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/
cp 50magit.el COPYING AUTHORS ChangeLog NEWS README $PKG/usr/doc/$PRGNAM-$VERSION/
)
# embaumement
mkdir -p $PKG/install
cat <<EOF > $PKG/install/doinst.sh
cd /usr/info
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 (A Emacs mode for Git)
$PRGNAM: With Magit, you can inspect and modify your Git repositories with Emacs.
$PRGNAM: You can review and commit the changes you have made to the tracked files,
$PRGNAM: for example, and you can browse the history of past changes. There is
$PRGNAM: support for cherry picking, reverting, merging, rebasing, and other
$PRGNAM: common Git operations.
$PRGNAM:
$PRGNAM: http://zagadka.vm.bytemark.co.uk/magit/magit.html
$PRGNAM: http://daemianmack.com/magit-cheatsheet.html
$PRGNAM:
$PRGNAM: http://zagadka.vm.bytemark.co.uk/magit/
EOF
# empaquetage
cd $PKG
makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$PACKAGER.txz