slackbuilds/e/org-mode/org-mode.SlackBuild
2010-09-09 15:14:47 +07:00

120 lines
3.6 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)
APP_NAME=$(basename $CWD)
PKG=$TMP/$PACKAGER/pkg-$APP_NAME
REPOSITORY=/home/cycojesus/projets/packages/repositories/$APP_NAME
PREFIX=/usr
EMACS=$(basename $(ls /usr/bin/emacs-2*))
EMACS_VERSION=$(echo "$EMACS" | grep -o "[0-9\.]*")
# nettoyage préalable
rm -fr $PKG $TMP/$APP_NAME-$VERSION
mkdir -p $PKG
# mise en place
cd $TMP
if [ ! -e $REPOSITORY ] ; then
mkdir -p $(dirname $REPOSITORY)
cd $(dirname $REPOSITORY)
git clone git://repo.or.cz/org-mode.git
fi
( cd $REPOSITORY
git pull
)
cp -R $REPOSITORY $TMP/$APP_NAME-$VERSION
( cd $TMP/$APP_NAME-$VERSION
sed -i "s|EMACS=emacs|EMACS=$EMACS|" Makefile
sed -i "s|prefix=/usr/local|prefix=$PREFIX|" Makefile
sed -i 's|infodir = $(prefix)/share/info|infodir = $(prefix)/info|' Makefile
make
# installation
sed -i "s|prefix=$PREFIX|prefix=$PKG$PREFIX|" Makefile
# May we have your ATTENTION please:
# next line Emacs' bundled org-mode TO BE REPLACED !!
#sed -i "s|lispdir = \$(prefix)/share/emacs/site-lisp|lispdir = \$(prefix)/share/emacs/$EMACS_VERSION/lisp/org|" Makefile
# you can now resume your normal existence, cảm ơn lắm.
make install
make install-info
rm $PKG$PREFIX/info/dir
# # install contrib
# cp -R contrib/lisp $PKG$PREFIX/share/emacs/site-lisp/org-mode-contrib
# # install org-babel
# cp -R contrib/babel/lisp $PKG$PREFIX/share/emacs/site-lisp/org-mode-contrib/babel
# ( cd $PKG$PREFIX/share/emacs/site-lisp/org-mode-contrib
# emacs -batch -f batch-byte-compile-file *.el
# )
# ( cd $PKG$PREFIX/share/emacs/site-lisp/org-mode-contrib/babel
# emacs -batch -f batch-byte-compile-file *.el
# )
mkdir -p $PKG$PREFIX/doc/$APP_NAME
cp -R contrib $PKG$PREFIX/doc/$APP_NAME
)
# correction
( cd $PKG
chown -R root:root *
[ -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 "*" -exec gzip -9f {} \;
# [ -d $PKG$PREFIX/share/emacs/$EMACS_VERSION/lisp/org ] && \
# find $PKG$PREFIX/share/emacs/$EMACS_VERSION/lisp/org -type f -name "*.el" -exec gzip -9f {} \;
# [ -d $PKG$PREFIX/share/emacs/site-lisp ] && \
# find $PKG$PREFIX/share/emacs/site-lisp -type f -name "*.el" -exec gzip -9f {} \;
# gunzip $PKG/usr/info/dir.gz
)
# 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------------------------------------------------------|
$APP_NAME: $APP_NAME (an Emacs Mode for Notes, Project Planning, and Authoring)
$APP_NAME:
$APP_NAME: Org-mode is for keeping notes, maintaining ToDo lists, doing project
$APP_NAME: planning, and authoring with a fast and effective plain-text system.
$APP_NAME:
$APP_NAME:
$APP_NAME:
$APP_NAME:
$APP_NAME:
$APP_NAME:
$APP_NAME: http://orgmode.org/
EOF
# empaquetage
cd $PKG
makepkg -l y -c n $OUTPUT/$APP_NAME-$VERSION-$ARCH-$BUILD$PACKAGER.txz