#!/bin/sh

# Emacs install: /usr/lib/emacsen-common/packages/install/aumix-mode

# Copyright 2005, 2007, 2009, 2010, 2014 Kevin Ryde
# Copyright 1998, 2009 Robert Browning
#
# This file is part of aumix-mode.  It was derived from the example code in
# /usr/share/doc/emacsen-common/debian-emacs-policy.gz of emacsen-common
# version 1.4.16.  That code is by Rob Browning and covered by the GPL, as
# described in /usr/share/doc/emacsen-common/copyright.
#
#
# aumix-mode is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3, or (at your option) any later
# version.
#
# aumix-mode is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


# This uses the "single directory" style.  The .el file is symlinked
# into the $FLAVOUR directory and compiled there.  The symlinks are
# left so the source is available for the various help tools like
# `find-function'.

set -e

FLAVOR=$1
echo install/aumix-mode: Handling install of emacsen flavor $FLAVOR

byte_compile_options="-batch -q -no-site-file -f batch-byte-compile"
el_files="aumix-mode.el" 
el_dir=/usr/share/emacs/site-lisp/aumix-mode
elc_dir=/usr/share/$FLAVOR/site-lisp/aumix-mode

if [ $FLAVOR != emacs ]
then
  echo install/aumix-mode: byte-compiling for $FLAVOR

  [ -d $elc_dir ] || mkdir $elc_dir

  # Symlink .el file
  for i in $el_files; do
    ln -sf $el_dir/$i $elc_dir/$i
  done

  # Byte compile .el file
  cd $elc_dir
  echo "$FLAVOR $byte_compile_options $el_files"
  $FLAVOR $byte_compile_options $el_files
fi
exit 0;
