Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 108 lines (95 sloc) 2.99 KB
#!/usr/bin/env sh
# Installation script for Emacs-IDE
# Copyright (C) 2008-2012 Cédric Marie
# This program 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 of
# the License, or (at your option) any later version.
# This program 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/>.
option_local=0
while getopts l OPT
do
case $OPT in
l) option_local=1;;
*) exit 1;;
esac
done
shift $(($OPTIND - 1))
if [ $option_local -eq 0 ]; then
printf "\033[1mCheck root privileges:\033[0m "
if [ $(id -u) -eq 0 ]; then
printf "\033[1;32mOK\033[0m\n\n"
else
printf "\033[1;31mFAILED: You need root privileges to install\033[0m\n"
printf "Alternatively, you can use -l option to install locally, i.e. for this user only\n"
exit 1
fi
fi
printf "\033[1mCheck dependencies\033[0m\n"
printf "ctags: "
if which ctags > /dev/null ; then
if ctags --version | grep -q Exuberant ; then
printf "\033[1;32mOK\033[0m\n"
else
printf "\033[1;31mFAILED: Your version of ctags is not \"Exuberant Ctags\"\033[0m\n"
exit 1
fi
else
printf "\033[1;31mFAILED: ctags is not installed\033[0m\n"
exit 1
fi
printf "cscope: "
if which cscope > /dev/null ; then
printf "\033[1;32mOK\033[0m\n"
else
printf "\033[1;31mFAILED: cscope is not installed\033[0m\n"
exit 1
fi
printf "\n\033[1mRemove .elc files (if any)\033[0m\n"
rm -vf src/*.elc
printf "\n\033[1mCompile Emacs-IDE\033[0m\n"
emacs -nw -q -l compile-eide.el
# -nw: don't use X interface
# -q: don't load ~/.emacs
# -l file.el: load lisp file
compilation_ok=1
for file in `ls src/*.el`; do
printf "${file}: "
if [ -e ${file}c ]; then
printf "\033[1;32mOK\033[0m\n"
else
printf "\033[1;31mFAILED\033[0m\n"
compilation_ok=0
fi
done
if [ $compilation_ok -eq 0 ]; then
exit 1
fi
printf "\n\033[1mInstall Emacs-IDE\033[0m\n"
if [ $option_local -eq 0 ]; then
if [ -d /usr/local/share/emacs/site-lisp ]; then
cp -vf src/*.elc /usr/local/share/emacs/site-lisp/
elif [ -d /usr/share/emacs/site-lisp ]; then
cp -vf src/*.elc /usr/share/emacs/site-lisp/
else
printf "\033[1;31mERROR: Neither /usr/local/share/emacs/site-lisp nor /usr/share/emacs/site-lisp exists\033[0m\n"
exit 1
fi
else
mkdir -p ~/.emacs.d/site-lisp
cp -vf src/*.elc ~/.emacs.d/site-lisp/
fi
printf "\n\033[1mRemove .elc files\033[0m\n"
rm -vf src/*.elc
printf "\n\033[1mInstructions for enabling Emacs-IDE\033[0m\n"
printf "You must add following lines in your ~/.emacs:\n\n"
if [ $option_local -eq 1 ]; then
printf "(add-to-list 'load-path \"~/.emacs.d/site-lisp/\")\n"
fi
printf "(require 'eide)\n"
printf "(eide-start)\n"