slackbuilds/e/emacs/emacs-git.SlackBuild
Gwenhael Le Moine a80b5b5e5e build with libotf ; allow building a specific
Signed-off-by: Gwenhael Le Moine <cycojesus@darkstar.example.net>
2009-12-09 17:19:59 +07:00

134 lines
3.4 KiB
Bash
Executable file

#!/bin/sh -x
# variables
TMP=/tmp
CWD=$(pwd)
APP_NAME=emacs
PKG=$TMP/package-$APP_NAME
VERSION=${VERSION:-git$(date +"%Y%m%d")}
ARCH=x86_64
BUILD=1cyco
REPOSITORY=/home/cycojesus/projets/packages/repositories/emacs
PREFIX=/usr
SLCKFLAGS="-O2"
# nettoyage préalable
rm -fr $PKG $TMP/$APP_NAME-$VERSION
mkdir -p $PKG
# mise en place
cd $TMP
if [ ! -e $CWD/$APP_NAME-$VERSION.tar.?z* ] ; then
mkdir $APP_NAME-$VERSION
if [ ! -e $REPOSITORY ] ; then
mkdir -p $(dirname $REPOSITORY)
cd $(dirname $REPOSITORY)
git clone http://git.sv.gnu.org/r/emacs.git
fi
cd $REPOSITORY
make distclean
git pull
else
tar xvf $CWD/$APP_NAME-$VERSION.tar.?z*
cd $APP_NAME-$VERSION
REPOSITORY=.
fi
CFLAGS=$SLCKFLAGS \
CXXFLAGS=$SLCKFLAGS \
$REPOSITORY/configure \
--prefix=$PREFIX \
--infodir=$PREFIX/info \
--mandir=$PREFIX/man \
--libdir=$PREFIX/lib64 \
--enable-font-backend \
--with-x-toolkit=gtk \
--with-freetype \
--with-libotf \
--with-xft
make bootstrap
# cd ..
make
# installation
make install DESTDIR=$PKG
rm $PKG/usr/bin/emacs
cat <<EOF > $PKG$PREFIX/bin/emacs
#!/bin/sh
XMODIFIERS= GTK_IM_MODULE= QT_IM_MODULE= $(basename $(ls $PKG$PREFIX/bin/emacs-*.*.*)) "\$@"
EOF
chmod +x $PKG$PREFIX/bin/emacs
# correction
cd $PKG
chown -R root:root *
[ -d $PKG/usr/man ] && find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;
rm $PKG/usr/info/dir
[ -d $PKG/usr/info ] && find $PKG/usr/info -type f -name "*" -exec gzip -9f {} \;
#gunzip $PKG/usr/info/dir.gz
# Strip binaries
( cd $PKG
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find . | 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
# Vim ships a better (IMHO) version of ctags, and we don't want
# to overwrite it with this one. If you really want emacs' ctags
# either copy or link it into place yourself, or remove the vim
# packages and reinstall emacs. Besides, does anyone know/use
# *both* emacs and vi? I'd think that would bring the universe
# to an end. ;-)
if [ ! -e usr/bin/ctags ]; then
cp -a usr/bin/ctags-emacs usr/bin/ctags
cp -a usr/man/man1/ctags-emacs.1.gz usr/man/man1/ctags.1.gz
fi
#rebuild /usr/info/dir
( cd /usr/info
for i in $(ls *.gz | grep -v ".*\-[0-9]*.gz$") ; do
install-info $i ./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 (Almighty editor)
$APP_NAME:
$APP_NAME: GNU Emacs is a version of Emacs, written by the author of the
$APP_NAME: original (PDP-10) Emacs, Richard Stallman.
$APP_NAME:
$APP_NAME: The one and only.
$APP_NAME:
$APP_NAME:
$APP_NAME:
$APP_NAME:
$APP_NAME: see /usr/doc/$APP_NAME-$VERSION$VERSION for more details
EOF
# empaquetage
cd $PKG
makepkg -l y -c n $TMP/$APP_NAME-$VERSION-$ARCH-$BUILD.txz